0014-Check-for-atomic-double-intrinsics.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 35335e2b2490ff476ba5ece2a0f4287a469deb2e Mon Sep 17 00:00:00 2001
  2. From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  3. Date: Tue, 9 Nov 2021 10:18:59 +0800
  4. Subject: [PATCH 14/34] Check for atomic<double> intrinsics
  5. On some architectures e.g. x86/32bit gcc decides to inline calls to
  6. double atomic variables but clang does not and defers it to libatomic
  7. therefore detect if clang can use built-ins for atomic<double> if not
  8. then link libatomic, this helps building clangd for x86 on linux systems
  9. with gcc runtime
  10. Rebased to LLVM 14.0.0 by Jun Yuan Tan
  11. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  12. Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  13. ---
  14. llvm/cmake/modules/CheckAtomic.cmake | 3 ++-
  15. 1 file changed, 2 insertions(+), 1 deletion(-)
  16. diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
  17. index 04eed1448482..e890cfecd139 100644
  18. --- a/llvm/cmake/modules/CheckAtomic.cmake
  19. +++ b/llvm/cmake/modules/CheckAtomic.cmake
  20. @@ -30,10 +30,11 @@ function(check_working_cxx_atomics64 varname)
  21. #include <atomic>
  22. #include <cstdint>
  23. std::atomic<uint64_t> x (0);
  24. +std::atomic<double> y (0);
  25. int main() {
  26. uint64_t i = x.load(std::memory_order_relaxed);
  27. (void)i;
  28. - return 0;
  29. + return int(y);
  30. }
  31. " ${varname})
  32. set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
  33. --
  34. 2.33.1