Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp545592pxb; Thu, 25 Feb 2021 08:51:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYS/UvtXkM2CCSzUBVyEahI+o4wEAlO2nNx3E+9A3SwmS64G3AcXfJdS4x9iGHz9/pGgvc X-Received: by 2002:a17:906:a016:: with SMTP id p22mr3438029ejy.456.1614271896342; Thu, 25 Feb 2021 08:51:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614271896; cv=none; d=google.com; s=arc-20160816; b=QgKKUKr/G+2C4cYHIiipsz0h9KnN/Amwbt+chN6p+crAWOVl3UIcik+DJ4QBoLLqSt 8W80su7OLbe45EnraSyY4hLtnPn+MSjg+/d6Fpc0rqz23WeJW7alkAjwAuSadUr/K0xZ QR4AERfCb4GcgsJbVQ6/3BiRktUF3ttKE/dz2tSIfvxnJTMrBffXGZ7ufR3UFthUS/1/ cuZ/xkqwnH8+Jo8PZFcKgxwqAkyM5jleiGgEZK8C9ORy/okU6sRKvUrVgbofkm0NxLFC LlddPTnN1fIMknSwphXcP4uKt8QACLtJI0BRi/+HR6qamfjUisGc4tMa1kcnGbpAvweW a3Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kx0YmsyhMpw6/oF7CzbvPp4EV6GcuhPhu2ZRMb4ciNw=; b=hcA++HKJ0gv1o/7e1aK+22sG/W/uJeOsTXQHw0YlZPogJVc8Hv1bwi7jpoiFddjJUs dSG0MbafyKK/anMzxkb+WZ9YeoTiTy+the99QvGOPZv7iGcOpq5QVI6VJqCIxjgmL+O/ JEQ1kLw8pAr5dgFxLg6hxT9bysdDj73GNI6Nw27Cusr6Heb57JOza6qQE2ANULQc5GKC Y7CL8W2mylggaBhESCErbmHrZQfDHN7/tYq6ppZfnkmKHUTIyRfcbzXINm/AkYcDNhR5 UDE2t06JwdThAEn8KepfYSFPbrLgkIpAs/bnzcQeuPN1BTVrrWpo3wOc4wd7KCKTTPiP 8Agw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="sXQX2Mh/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du16si3873793ejc.388.2021.02.25.08.51.13; Thu, 25 Feb 2021 08:51:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="sXQX2Mh/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233541AbhBYQuA (ORCPT + 99 others); Thu, 25 Feb 2021 11:50:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:59896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233162AbhBYQqH (ORCPT ); Thu, 25 Feb 2021 11:46:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 349F664F03; Thu, 25 Feb 2021 16:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614271520; bh=XRJIv+0+/8Nj1u+obSmK1DS17lE9bT/ZjCm47/50Gf4=; h=From:To:Cc:Subject:Date:From; b=sXQX2Mh/K0e9XUVXMZacifSOWdh+X26EAtCs5pqQYww2CpZazIzMnHaikMbGyl9u4 OaJwaS37R7sXUlbz7TTw9rHxbImpA+tIKnv6V+vKsMy62/w7PbEELARSWIre0fFZLB hnpc5AcMqqu5ew18esInd7Ye6rTCao4P/jntiejgkdi87k6MomwEnVDZPmdThx9GDM TcjFyL2/v6DJCJhddIL6NU8kmZT2b/sRKLtxrk/UT5nVf83Q5o52nZxi+QES9ED7db zTPTxh55X41OaxiWfTEsj480yM0yNFNNDQYLFsMycrShq7ywy3TkY6rVr6tfmmMyfk z/bFB8YbsZnWQ== From: Arnd Bergmann To: Masahiro Yamada , Nathan Chancellor , Nick Desaulniers Cc: Arnd Bergmann , Miguel Ojeda , Kees Cook , Andrew Morton , Marco Elver , Sami Tolvanen , Arvind Sankar , Randy Dunlap , clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: [PATCH] linux/compiler-clang.h: define HAVE_BUILTIN_BSWAP* Date: Thu, 25 Feb 2021 17:45:09 +0100 Message-Id: <20210225164513.3667778-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Separating compiler-clang.h from compiler-gcc.h inadventently dropped the definitions of the three HAVE_BUILTIN_BSWAP macros, which requires falling back to the open-coded version and hoping that the compiler detects it. Since all versions of clang support the __builtin_bswap interfaces, add back the flags and have the headers pick these up automatically. This results in a 4% improvement of compilation speed for arm defconfig. Fixes: 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive") Signed-off-by: Arnd Bergmann --- include/linux/compiler-clang.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index 6478bff6fcc2..bbfa9ff6a2ec 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -33,6 +33,16 @@ #define __no_sanitize_thread #endif +/* + * sparse (__CHECKER__) pretends to be gcc, but can't do constant + * folding in __builtin_bswap*() (yet), so don't set these for it. + */ +#if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP) && !defined(__CHECKER__) +#define __HAVE_BUILTIN_BSWAP32__ +#define __HAVE_BUILTIN_BSWAP64__ +#define __HAVE_BUILTIN_BSWAP16__ +#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP && !__CHECKER__ */ + #if __has_feature(undefined_behavior_sanitizer) /* GCC does not have __SANITIZE_UNDEFINED__ */ #define __no_sanitize_undefined \ -- 2.29.2