[all-commits] [llvm/llvm-project] a572a8: [CMake] CheckAtomic.cmake: catch false positives i...
Gokturk Yuksek via All-commits
all-commits at lists.llvm.org
Thu Feb 20 06:23:16 PST 2020
Branch: refs/heads/release/10.x
Home: https://github.com/llvm/llvm-project
Commit: a572a8a147c76b9d31585c2d4257a5db566c9a9d
https://github.com/llvm/llvm-project/commit/a572a8a147c76b9d31585c2d4257a5db566c9a9d
Author: Gokturk Yuksek <gokturk at binghamton.edu>
Date: 2020-02-20 (Thu, 20 Feb 2020)
Changed paths:
M llvm/cmake/modules/CheckAtomic.cmake
Log Message:
-----------
[CMake] CheckAtomic.cmake: catch false positives in RISC-V
The check for 'HAVE_CXX_ATOMICS_WITHOUT_LIB' may create false
positives in RISC-V. This is reproducible when compiling LLVM natively
using GCC on a rv64gc (rv64imafdgc) host. Due to the 'A' (atomic)
extension, g++ replaces calls to libatomic operations on the
std::atomic<int> type with the native hardware instructions. As a
result, the compilation succeeds and the build system thinks it
doesn't need to pass '-latomic'.
Improve the reliability of the 'HAVE_CXX_ATOMICS_WITHOUT_LIB' test in
two steps:
1. Force a pre-increment on x (++x), which should force a call to a
libatomic function;
2. Because step 1 would resolve the increment to 'amoadd.w.aq' under
the 'A' extension, force the same operation on sub-word types, for
which there is no hardware support.
Reviewers: jfb, hintonda, smeenai, mgorny, JDevlieghere, jyknight
Reviewed By: jfb
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68964
(cherry picked from commit cef85193b2cc1817ca43199a0ae9c6f25723997d)
More information about the All-commits
mailing list