Skip to content

Commit e83380f

Browse files
committed
[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
1 parent 462cf39 commit e83380f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

openmp/runtime/cmake/config-ix.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ if (IA32 OR INTEL64)
175175
}
176176
int main() { int a = __kmp_umwait(0, 1000); return a; }")
177177
check_cxx_source_compiles("${source_code}" LIBOMP_HAVE_WAITPKG_INTRINSICS)
178+
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
179+
if (LIBOMP_HAVE_MRTM_FLAG)
180+
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mrtm")
181+
endif()
178182
set(source_code "// check for attribute rtm and rtm intrinsics
179183
#ifdef IMMINTRIN_H
180184
#include <immintrin.h>
@@ -191,6 +195,7 @@ if (IA32 OR INTEL64)
191195
int main() { int a = __kmp_xbegin(); return a; }")
192196
check_cxx_source_compiles("${source_code}" LIBOMP_HAVE_RTM_INTRINSICS)
193197
set(CMAKE_REQUIRED_DEFINITIONS)
198+
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
194199
endif()
195200

196201
# Find perl executable

0 commit comments

Comments
 (0)