Skip to content

Commit 99350dc

Browse files
jpeyton52tstellar
authored andcommitted
[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 e83380f)
1 parent 4ed9f17 commit 99350dc

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
@@ -172,6 +172,10 @@ if (IA32 OR INTEL64)
172172
}
173173
int main() { int a = __kmp_umwait(0, 1000); return a; }")
174174
check_cxx_source_compiles("${source_code}" LIBOMP_HAVE_WAITPKG_INTRINSICS)
175+
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
176+
if (LIBOMP_HAVE_MRTM_FLAG)
177+
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mrtm")
178+
endif()
175179
set(source_code "// check for attribute rtm and rtm intrinsics
176180
#ifdef IMMINTRIN_H
177181
#include <immintrin.h>
@@ -188,6 +192,7 @@ if (IA32 OR INTEL64)
188192
int main() { int a = __kmp_xbegin(); return a; }")
189193
check_cxx_source_compiles("${source_code}" LIBOMP_HAVE_RTM_INTRINSICS)
190194
set(CMAKE_REQUIRED_DEFINITIONS)
195+
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
191196
endif()
192197

193198
# Find perl executable

0 commit comments

Comments
 (0)