0013-Check-for-atomic-double-intrinsics.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. From b0310dcff11cade76add2b84f9d694fc626284ee Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Mon, 18 Nov 2019 17:00:29 -0800
  4. Subject: [PATCH] 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. Upstream-Status: Pending
  11. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  12. ---
  13. llvm/cmake/modules/CheckAtomic.cmake | 3 ++-
  14. 1 file changed, 2 insertions(+), 1 deletion(-)
  15. diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
  16. index f11cadf39ff6..80a18a92956a 100644
  17. --- a/llvm/cmake/modules/CheckAtomic.cmake
  18. +++ b/llvm/cmake/modules/CheckAtomic.cmake
  19. @@ -30,10 +30,11 @@ function(check_working_cxx_atomics64 varname)
  20. #include <atomic>
  21. #include <cstdint>
  22. std::atomic<uint64_t> x (0);
  23. +std::atomic<double> y (0);
  24. int main() {
  25. uint64_t i = x.load(std::memory_order_relaxed);
  26. (void)i;
  27. - return 0;
  28. + return int(y);
  29. }
  30. " ${varname})
  31. set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})