[PATCH] D70636: Add Cmake Check for atomic<double> intrinsic

Khem Raj via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 23 12:00:40 PST 2019


raj.khem created this revision.
raj.khem added a project: LLVM.
Herald added subscribers: llvm-commits, usaxena95, kadircet, jfb, ilya-biryukov, mgorny.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70636

Files:
  llvm/cmake/modules/CheckAtomic.cmake


Index: llvm/cmake/modules/CheckAtomic.cmake
===================================================================
--- llvm/cmake/modules/CheckAtomic.cmake
+++ llvm/cmake/modules/CheckAtomic.cmake
@@ -26,9 +26,10 @@
 #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);
-  return 0;
+  return int(y);
 }
 " ${varname})
   set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70636.230772.patch
Type: text/x-patch
Size: 481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191123/d5d21f18/attachment.bin>


More information about the llvm-commits mailing list