diff options
author | Peter Varga <[email protected]> | 2022-12-13 17:59:03 +0100 |
---|---|---|
committer | Peter Varga <[email protected]> | 2022-12-15 23:16:04 +0100 |
commit | 702ffc45d6d3641ee3baf2625a10493b95ce33a7 (patch) | |
tree | 942c8b2850a154073ef8ccc94999bdfdc608b1c4 | |
parent | 514a6cb7dcc6f40c2be16ebcd356aadb422c16fa (diff) |
Fix clang-cl build with disabled x86 intrinsics
clang-cl's intrinsics support is broken, it doesn't declare the AVX2
intrinsics if they are disabled and this doesn't match GCC or MSVC
behavior: https://github.com/llvm/llvm-project/issues/53520
This fix allows to disable x86 intrinsiscs during configuration of
clang-cl build.
clang-cl build is still not guaranteed to work with enabled x86 intrinsics.
Change-Id: Icd295f6b4d868adf10bcd425d5280c56b43cb9f7
Reviewed-by: Thiago Macieira <[email protected]>
-rw-r--r-- | configure.cmake | 10 | ||||
-rw-r--r-- | src/corelib/global/qnumeric_p.h | 2 | ||||
-rw-r--r-- | src/corelib/global/qsimd.h | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/configure.cmake b/configure.cmake index 95995a558df..adc3d481b01 100644 --- a/configure.cmake +++ b/configure.cmake @@ -1276,6 +1276,16 @@ All x86 intrinsics and SIMD support were disabled. If this was in error, check the result of the build in config.tests/x86intrin and report at https://bugreports.qt.io. ]=] ) + elseif (MSVC AND CLANG) + # Warn only + qt_configure_add_report_entry( + TYPE WARNING + CONDITION (NOT QT_FEATURE_x86intrin) + MESSAGE [=[ +x86 intrinsics support is disabled for clang-cl build. This might be necessary due to +https://github.com/llvm/llvm-project/issues/53520 +]=] + ) else() qt_configure_add_report_entry( TYPE ERROR diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 9765ce4a319..40c459991c8 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -180,7 +180,7 @@ static inline bool convertDoubleTo(double v, T *value, bool allow_precision_upgr // correct, but Clang, ICC and MSVC don't realize that it's a constant and // the math call stays in the compiled code. -#ifdef Q_PROCESSOR_X86_64 +#if defined(Q_PROCESSOR_X86_64) && defined(__SSE2__) // Of course, UB doesn't apply if we use intrinsics, in which case we are // allowed to dpeend on exactly the processor's behavior. This // implementation uses the truncating conversions from Scalar Double to diff --git a/src/corelib/global/qsimd.h b/src/corelib/global/qsimd.h index 6ed7821e269..4ef925ca337 100644 --- a/src/corelib/global/qsimd.h +++ b/src/corelib/global/qsimd.h @@ -55,7 +55,7 @@ #if defined(Q_PROCESSOR_X86) && defined(Q_CC_MSVC) // MSVC doesn't define __SSE2__, so do it ourselves -# if (defined(_M_X64) || _M_IX86_FP >= 2) +# if (defined(_M_X64) || _M_IX86_FP >= 2) && defined(QT_COMPILER_SUPPORTS_SSE2) # define __SSE__ 1 # define __SSE2__ 1 # endif |