[llvm-branch-commits] [compiler-rt] 483db58 - compiler-rt: Allow build without __c11_atomic_fetch_nand

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 7 17:41:08 PDT 2022


Author: Brooks Davis
Date: 2022-06-07T17:38:05-07:00
New Revision: 483db58f3eb5c625615e212283800cea2cb04b3e

URL: https://github.com/llvm/llvm-project/commit/483db58f3eb5c625615e212283800cea2cb04b3e
DIFF: https://github.com/llvm/llvm-project/commit/483db58f3eb5c625615e212283800cea2cb04b3e.diff

LOG: compiler-rt: Allow build without __c11_atomic_fetch_nand

Don't build atomic fetch nand libcall functions when the required
compiler builtin isn't available. Without this compiler-rt can't be
built with LLVM 13 or earlier.

Not building the libcall functions isn't optimal, but aligns with the
usecase in FreeBSD where compiler-rt from LLVM 14 is built with an LLVM
13 clang and no LLVM 14 clang is built.

Reviewed By:	efriedma

Differential Revision:	https://reviews.llvm.org/D126710

(cherry picked from commit 18efa420da5fa065d88ba451cdcdbd950a2090c1)

Added: 
    

Modified: 
    compiler-rt/lib/builtins/atomic.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/atomic.c b/compiler-rt/lib/builtins/atomic.c
index 4c3ebb99a5136..8dc2f4fc013a8 100644
--- a/compiler-rt/lib/builtins/atomic.c
+++ b/compiler-rt/lib/builtins/atomic.c
@@ -363,6 +363,9 @@ OPTIMISED_CASES
 #define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW(n, lockfree, type, xor, ^)
 OPTIMISED_CASES
 #undef OPTIMISED_CASE
+// Allow build with clang without __c11_atomic_fetch_nand builtin (pre-14)
+#if __has_builtin(__c11_atomic_fetch_nand)
 #define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW_NAND(n, lockfree, type)
 OPTIMISED_CASES
 #undef OPTIMISED_CASE
+#endif


        


More information about the llvm-branch-commits mailing list