diff options
author | Peyton, Jonathan L <jonathan.l.peyton@intel.com> | 2021-03-02 07:44:15 -0600 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2021-03-05 09:23:38 -0800 |
commit | 99350dcc3f5b46d564338c0067c2cbd139b841ee (patch) | |
tree | 3de3088728fb31645c466d0ce1e9a7cb5b83465e | |
parent | 4ed9f17e9390a6845cfd8a235f2078cb9b0e4719 (diff) | |
download | llvm-99350dcc3f5b46d564338c0067c2cbd139b841ee.zip llvm-99350dcc3f5b46d564338c0067c2cbd139b841ee.tar.gz llvm-99350dcc3f5b46d564338c0067c2cbd139b841ee.tar.bz2 |
[OpenMP] Fix clang-cl build error regarding TSX intrinsics
Fix for https://bugs.llvm.org/show_bug.cgi?id=49339
The CMake check for the RTM intrinsics needs the -mrtm flag to be set
during the test. This way clang-cl correctly detects it has the
_xbegin() intrinsic. Otherwise, the CMake check fails.
Differential Revision: https://reviews.llvm.org/D97413
(cherry picked from commit e83380fccc2cc9842bdcfd268efddf6fce90544d)
-rw-r--r-- | openmp/runtime/cmake/config-ix.cmake | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/openmp/runtime/cmake/config-ix.cmake b/openmp/runtime/cmake/config-ix.cmake index f06fda6..ed62aef 100644 --- a/openmp/runtime/cmake/config-ix.cmake +++ b/openmp/runtime/cmake/config-ix.cmake @@ -172,6 +172,10 @@ if (IA32 OR INTEL64) } int main() { int a = __kmp_umwait(0, 1000); return a; }") check_cxx_source_compiles("${source_code}" LIBOMP_HAVE_WAITPKG_INTRINSICS) + set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + if (LIBOMP_HAVE_MRTM_FLAG) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mrtm") + endif() set(source_code "// check for attribute rtm and rtm intrinsics #ifdef IMMINTRIN_H #include <immintrin.h> @@ -188,6 +192,7 @@ if (IA32 OR INTEL64) int main() { int a = __kmp_xbegin(); return a; }") check_cxx_source_compiles("${source_code}" LIBOMP_HAVE_RTM_INTRINSICS) set(CMAKE_REQUIRED_DEFINITIONS) + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) endif() # Find perl executable |