[Openmp-commits] [openmp] e83380f - [OpenMP] Fix clang-cl build error regarding TSX intrinsics

via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 2 05:47:52 PST 2021


Author: Peyton, Jonathan L
Date: 2021-03-02T07:47:42-06:00
New Revision: e83380fccc2cc9842bdcfd268efddf6fce90544d

URL: https://github.com/llvm/llvm-project/commit/e83380fccc2cc9842bdcfd268efddf6fce90544d
DIFF: https://github.com/llvm/llvm-project/commit/e83380fccc2cc9842bdcfd268efddf6fce90544d.diff

LOG: [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

Added: 
    

Modified: 
    openmp/runtime/cmake/config-ix.cmake

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/cmake/config-ix.cmake b/openmp/runtime/cmake/config-ix.cmake
index 0b3556b24c03..56d0ddb321f6 100644
--- a/openmp/runtime/cmake/config-ix.cmake
+++ b/openmp/runtime/cmake/config-ix.cmake
@@ -175,6 +175,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>
@@ -191,6 +195,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


        


More information about the Openmp-commits mailing list