123456789101112131415161718192021222324252627282930313233343536373839 |
- From 59e66928b489591a960f9663dc588f33bae65617 Mon Sep 17 00:00:00 2001
- From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
- Date: Fri, 22 Oct 2021 11:37:31 +0800
- Subject: [PATCH] Check for atomic<double> intrinsics
- On some architectures e.g. x86/32bit gcc decides to inline calls to
- double atomic variables but clang does not and defers it to libatomic
- therefore detect if clang can use built-ins for atomic<double> if not
- then link libatomic, this helps building clangd for x86 on linux systems
- with gcc runtime
- Rebased to LLVM 14.0.0 by Jun Yuan Tan
- Signed-off-by: Khem Raj <raj.khem@gmail.com>
- Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
- ---
- llvm/cmake/modules/CheckAtomic.cmake | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
- diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
- index 3c5ba72993a3..34a1b950bbed 100644
- --- a/llvm/cmake/modules/CheckAtomic.cmake
- +++ b/llvm/cmake/modules/CheckAtomic.cmake
- @@ -30,10 +30,11 @@ function(check_working_cxx_atomics64 varname)
- #include <atomic>
- #include <cstdint>
- std::atomic<uint64_t> x (0);
- +std::atomic<double> y (0);
- int main() {
- uint64_t i = x.load(std::memory_order_relaxed);
- (void)i;
- - return 0;
- + return int(y);
- }
- " ${varname})
- set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
- --
- 2.33.0
|