From patchwork Tue May 28 23:57:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10965949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0A7F6C5 for ; Tue, 28 May 2019 23:57:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDE9728421 for ; Tue, 28 May 2019 23:57:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE48328660; Tue, 28 May 2019 23:57:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2329D28421 for ; Tue, 28 May 2019 23:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=3Fr3GVOeh9i/vqKL1uryQP0s/HvSOj9Ijouz6ScBNjA=; b=LldpDlY39tT6Qe soYCOBGjluS9Z7fjXxZN/0WA67vv94jmDwSXqAp1tjRTctoa78GKijQ+CKvnxlfVoLn/dAHfnpNCU vHUJ3Z3dwfw1O4v0hXQoixnttX2FyHZskRWe0PeX7J1uycyRd3yKYbu7tC9MN2UcYu7Lbilu3Wcu+ /ed4mXBChSuB0gT7sIX132xuPdwfGGNREgvkmmUHpklwDu28UTD1/+khjxkmyxAShnrRYZ9V1jI4W adzhup4EPycpvCE0wXd6f6hkjl1VUObpEzOKznCY0ldt85zUa07/0A/HM9eooBB8Ms2eOkz1DA2DT quZx9uW+PGIE1+sWaOlg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVlyZ-0001Qn-G9; Tue, 28 May 2019 23:57:51 +0000 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVlyW-0001QU-OS for linux-arm-kernel@lists.infradead.org; Tue, 28 May 2019 23:57:50 +0000 Received: by mail-ed1-x541.google.com with SMTP id a8so660627edx.3 for ; Tue, 28 May 2019 16:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tY1S9QD7vrCtWoh/cKmDSkmGt1HGWJIL0pZvj39EZVc=; b=JI5A5RfOFw7zOIGH20VztXP0bA2BvcknRnm0vFZRC3rSsuffHbE7bgrV9ZVhUenjBH PSug/nv+vELoCpRaNVwey/8uixFj8fMi/O+9mYe+HSkse6CsLZnYP04lRBQsMBthTRs3 2RmR8I4z+x6MODC5cdThOQrYER+d0kg5skVN2WAkU7AEIoYTkxUglfTfVCxackfHR1qi 7FcwGF5FbgrlcZ3OMCkUSYakKTtnVkHD8yscBKtVvSittUlBw1W0ZyWJllZml7InwpLC NrSQJ39xiWtSyVaNN3+sxnM6l8IgncM8c/PQXM61UtfTBgbYtGDPnksQf6rUhwZGMnTo ndkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tY1S9QD7vrCtWoh/cKmDSkmGt1HGWJIL0pZvj39EZVc=; b=Ko+rHG53vO1gi2Oog98HneCpjfjjssQ5GHDKBIrONNhZTqQD+X9QDL+Fr7PZ7/Pg3r 5gI34WGSzV4ZO/R6BxgdEPfxJkmd+pJXkbM2Re/7Lqkn5SOuKuacxp7UKmfIJlCH84Ed cKwPMQdmAK/MbxnWJGi/eriNcv0T8Mn29gPaxa37Oo4gzja2DwDcXis6YRLXzkBKiwLG lidiyJXg6iHuJqtNga7Ak4VKUMMb8jYsDKeHUv99RGpRojF1ZGCFMSnk7TTYIMDb309V FF6r0Mt6kKj5shV+er+MJVRsYbcBhDmuGYjS7nnSIosYbRPTaDXzB/QK6XfSjRpVDHF/ pQGg== X-Gm-Message-State: APjAAAVdODqSrfv63m4Ojoqs1gPzTZTft1JDu03egvR4LOv8DKpW6JAl cNkH4Aq29k0BBUNlEE2LGnA= X-Google-Smtp-Source: APXvYqwe8zzoO0T1q2g/lUQM7eKqTZrrvLgQ/+AH38CB0uekNs1XDc1NdxoBewlXX0FRRvcFAk/Ayg== X-Received: by 2002:a17:906:ca5b:: with SMTP id jx27mr94012887ejb.233.1559087866574; Tue, 28 May 2019 16:57:46 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f9:2b:2b15::2]) by smtp.gmail.com with ESMTPSA id v22sm2499638eji.13.2019.05.28.16.57.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 16:57:45 -0700 (PDT) From: Nathan Chancellor To: Russell King Subject: [PATCH] ARM: xor-neon: Replace __GNUC__ checks with CONFIG_CC_IS_GCC Date: Tue, 28 May 2019 16:57:42 -0700 Message-Id: <20190528235742.105510-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.22.0.rc1 MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190528_165748_822757_ACA4F39F X-CRM114-Status: GOOD ( 14.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Ard Biesheuvel , Nicolas Pitre , Nick Desaulniers , linux-kernel@vger.kernel.org, Stefan Agner , clang-built-linux@googlegroups.com, Nathan Chancellor , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, when compiling this code with clang, the following warning is emitted: CC arch/arm/lib/xor-neon.o arch/arm/lib/xor-neon.c:33:2: warning: This code requires at least version 4.6 of GCC [-W#warnings] This is because clang poses as GCC 4.2.1 with its __GNUC__ conditionals for glibc compatibility[1]: $ echo | clang -dM -E -x c /dev/null | grep GNUC | awk '{print $2" "$3}' __GNUC_MINOR__ 2 __GNUC_PATCHLEVEL__ 1 __GNUC_STDC_INLINE__ 1 __GNUC__ 4 As pointed out by Ard Biesheuvel and Arnd Bergmann in an earlier thread[2], the oldest version of GCC that is currently supported is gcc 4.6 after commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6") so we do not need to check for anything older anymore. However, just removing the version check is not enough to silence clang because it does not recognize '#pragma GCC optimize': arch/arm/lib/xor-neon.c:25:13: warning: unknown pragma ignored [-Wunknown-pragmas] #pragma GCC optimize "tree-vectorize" Looking into it further, -ftree-vectorize (which '#pragma GCC optimize "tree-vectorize"' enables) is an alias in clang for -fvectorize[3], which according to the documentation is on by default[4] (at least at -O2 or -Os). Just add the pragma when compiling with GCC so that clang does not unnecessarily warn. [1]: https://reviews.llvm.org/D51011#1206981 [2]: https://lore.kernel.org/lkml/CAK8P3a3NjTCgFd2dQ9KbHP8DpXf6s-ULfeU6acAYC4SDi+2qvw@mail.gmail.com/ [3]: https://github.com/llvm/llvm-project/blob/eafe8ef6f2b44ba/clang/include/clang/Driver/Options.td#L1729 [4]: https://llvm.org/docs/Vectorizers.html#usage Link: https://github.com/ClangBuiltLinux/linux/issues/496 Reported-by: Nick Desaulniers Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers --- arch/arm/lib/xor-neon.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/arch/arm/lib/xor-neon.c b/arch/arm/lib/xor-neon.c index c691b901092f..d532bc072ee4 100644 --- a/arch/arm/lib/xor-neon.c +++ b/arch/arm/lib/xor-neon.c @@ -22,15 +22,8 @@ MODULE_LICENSE("GPL"); * -ftree-vectorize) to attempt to exploit implicit parallelism and emit * NEON instructions. */ -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +#ifdef CONFIG_CC_IS_GCC #pragma GCC optimize "tree-vectorize" -#else -/* - * While older versions of GCC do not generate incorrect code, they fail to - * recognize the parallel nature of these functions, and emit plain ARM code, - * which is known to be slower than the optimized ARM code in asm-arm/xor.h. - */ -#warning This code requires at least version 4.6 of GCC #endif #pragma GCC diagnostic ignored "-Wunused-variable"