Skip to content

Commit 266495b

Browse files
committed
MDEV-33817 fixup: Disable for macOS
According to https://discussions.apple.com/thread/8256853 an attempt to use AVX512 registers on macOS will result in #UD (crash at runtime). Also, starting with clang-18 and GCC 14, we must add "evex512" to the target flags so that AVX and SSE instructions can use AVX512 specific encodings. This flag was introduced together with the avx10.1-512 target. Older compiler versions do not recognize "evex512". We do not want to write "avx10.1-512" because it could enable some AVX512 subfeatures that we do not have any CPUID check for. Reviewed by: Vladislav Vaintroub Tested on macOS by: Valerii Kravchuk
1 parent 310fd6f commit 266495b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mysys/crc32/crc32c_x86.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
# endif
2525
#else
2626
# include <cpuid.h>
27-
# if __GNUC__ >= 11 || (defined __clang_major__ && __clang_major__ >= 8)
27+
# ifdef __APPLE__ /* AVX512 states are not enabled in XCR0 */
28+
# elif __GNUC__ >= 14 || (defined __clang_major__ && __clang_major__ >= 18)
29+
# define TARGET "pclmul,evex512,avx512f,avx512dq,avx512bw,avx512vl,vpclmulqdq"
30+
# define USE_VPCLMULQDQ __attribute__((target(TARGET)))
31+
# elif __GNUC__ >= 11 || (defined __clang_major__ && __clang_major__ >= 8)
2832
# define TARGET "pclmul,avx512f,avx512dq,avx512bw,avx512vl,vpclmulqdq"
2933
# define USE_VPCLMULQDQ __attribute__((target(TARGET)))
3034
# endif

0 commit comments

Comments
 (0)