[compiler-rt] 18efa42 - compiler-rt: Allow build without __c11_atomic_fetch_nand
Ed Maste via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 1 09:58:38 PDT 2022
Author: Brooks Davis
Date: 2022-06-01T12:58:30-04:00
New Revision: 18efa420da5fa065d88ba451cdcdbd950a2090c1
URL: https://github.com/llvm/llvm-project/commit/18efa420da5fa065d88ba451cdcdbd950a2090c1
DIFF: https://github.com/llvm/llvm-project/commit/18efa420da5fa065d88ba451cdcdbd950a2090c1.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
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 6d54b61f6410f..852bb20f08672 100644
--- a/compiler-rt/lib/builtins/atomic.c
+++ b/compiler-rt/lib/builtins/atomic.c
@@ -365,6 +365,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-commits
mailing list