llvm15/llvm-better-detect-64bit-atomics-support.patch

23 lines
795 B
Diff

Better detect 64bit atomics support.
It appears that on i586 std::atomic<uint64_t>::load is compiled into
instruction, but std::atomic<double>::load uses __atomic_load_8. This must
be detected so the build system links it to libatomic.
Index: llvm-12.0.0.src/cmake/modules/CheckAtomic.cmake
===================================================================
--- llvm-12.0.0.src.orig/cmake/modules/CheckAtomic.cmake
+++ llvm-12.0.0.src/cmake/modules/CheckAtomic.cmake
@@ -30,9 +30,12 @@ function(check_working_cxx_atomics64 var
#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);
+ double j = y.load(std::memory_order_relaxed);
(void)i;
+ (void)j;
return 0;
}
" ${varname})