From fa1ee4881e2d418c2acd61751da07928ffe1fcdf Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 16 May 2026 13:37:11 -0700 Subject: [PATCH 1/2] Revert "lib/x86: Bring back evex512 and no-evex512 for clang 18" This reverts commit e886d45f7710db491ca49f94a05bcbe94f9c03d0. It's still not working. The error happens with -march=native, probabilistically depending on the CPU that GitHub Actions assigns. --- lib/x86/adler32_impl.h | 4 ++-- lib/x86/cpu_features.h | 9 --------- lib/x86/crc32_impl.h | 4 ++-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/x86/adler32_impl.h b/lib/x86/adler32_impl.h index cc118c76..74c7b312 100644 --- a/lib/x86/adler32_impl.h +++ b/lib/x86/adler32_impl.h @@ -82,7 +82,7 @@ */ # define adler32_x86_avx512_vl256_vnni adler32_x86_avx512_vl256_vnni # define SUFFIX _avx512_vl256_vnni -# define ATTRIBUTES _target_attribute("avx512bw,avx512vl,avx512vnni" NO_EVEX512) +# define ATTRIBUTES _target_attribute("avx512bw,avx512vl,avx512vnni") # define VL 32 # define USE_VNNI 1 # define USE_AVX512 1 @@ -94,7 +94,7 @@ */ # define adler32_x86_avx512_vl512_vnni adler32_x86_avx512_vl512_vnni # define SUFFIX _avx512_vl512_vnni -# define ATTRIBUTES _target_attribute("avx512bw,avx512vnni" EVEX512) +# define ATTRIBUTES _target_attribute("avx512bw,avx512vnni") # define VL 64 # define USE_VNNI 1 # define USE_AVX512 1 diff --git a/lib/x86/cpu_features.h b/lib/x86/cpu_features.h index 032896a7..cb225b98 100644 --- a/lib/x86/cpu_features.h +++ b/lib/x86/cpu_features.h @@ -165,15 +165,6 @@ static inline u32 get_x86_cpu_features(void) { return 0; } # define HAVE_AVXVNNI(features) ((features) & X86_CPU_FEATURE_AVXVNNI) #endif -#if ((CLANG_PREREQ(18, 0, 18000000) && !CLANG_PREREQ(19, 0, 19000000))) \ - && !defined(__EVEX512__) /* avoid subtracting the evex512 feature */ -# define EVEX512 ",evex512" /* needed to override potential -mno-evex512 */ -# define NO_EVEX512 ",no-evex512" -#else -# define EVEX512 "" -# define NO_EVEX512 "" -#endif - #endif /* ARCH_X86_32 || ARCH_X86_64 */ #endif /* LIB_X86_CPU_FEATURES_H */ diff --git a/lib/x86/crc32_impl.h b/lib/x86/crc32_impl.h index 47551c5f..50ea52bb 100644 --- a/lib/x86/crc32_impl.h +++ b/lib/x86/crc32_impl.h @@ -104,7 +104,7 @@ static const u8 MAYBE_UNUSED shift_tab[48] = { */ # define crc32_x86_vpclmulqdq_avx512_vl256 crc32_x86_vpclmulqdq_avx512_vl256 # define SUFFIX _vpclmulqdq_avx512_vl256 -# define ATTRIBUTES _target_attribute("vpclmulqdq,pclmul,avx512bw,avx512vl" NO_EVEX512) +# define ATTRIBUTES _target_attribute("vpclmulqdq,pclmul,avx512bw,avx512vl") # define VL 32 # define USE_AVX512 1 # include "crc32_pclmul_template.h" @@ -117,7 +117,7 @@ static const u8 MAYBE_UNUSED shift_tab[48] = { */ # define crc32_x86_vpclmulqdq_avx512_vl512 crc32_x86_vpclmulqdq_avx512_vl512 # define SUFFIX _vpclmulqdq_avx512_vl512 -# define ATTRIBUTES _target_attribute("vpclmulqdq,pclmul,avx512bw,avx512vl" EVEX512) +# define ATTRIBUTES _target_attribute("vpclmulqdq,pclmul,avx512bw,avx512vl") # define VL 64 # define USE_AVX512 1 # include "crc32_pclmul_template.h" From 31e921aae0d7acbce95b8d2549b85c62baa03f9a Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 16 May 2026 13:40:04 -0700 Subject: [PATCH 2/2] lib/x86: Disable AVX512 code with clang 18 Another attempt to work around the backwards compatibility break in clang 18 which went away in clang 19. --- lib/x86/adler32_impl.h | 1 + lib/x86/crc32_impl.h | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/x86/adler32_impl.h b/lib/x86/adler32_impl.h index 74c7b312..f1102b5e 100644 --- a/lib/x86/adler32_impl.h +++ b/lib/x86/adler32_impl.h @@ -72,6 +72,7 @@ #endif #if (GCC_PREREQ(8, 1) || CLANG_PREREQ(6, 0, 10000000) || MSVC_PREREQ(1920)) && \ + !(CLANG_PREREQ(18, 0, 18000000) && !CLANG_PREREQ(19, 0, 19000000)) && \ !defined(LIBDEFLATE_ASSEMBLER_DOES_NOT_SUPPORT_AVX512VNNI) /* * AVX512VNNI implementation using 256-bit vectors. This is very similar to the diff --git a/lib/x86/crc32_impl.h b/lib/x86/crc32_impl.h index 50ea52bb..4fbdef7e 100644 --- a/lib/x86/crc32_impl.h +++ b/lib/x86/crc32_impl.h @@ -92,6 +92,7 @@ static const u8 MAYBE_UNUSED shift_tab[48] = { #endif #if (GCC_PREREQ(10, 1) || CLANG_PREREQ(6, 0, 10000000) || MSVC_PREREQ(1920)) && \ + !(CLANG_PREREQ(18, 0, 18000000) && !CLANG_PREREQ(19, 0, 19000000)) && \ !defined(LIBDEFLATE_ASSEMBLER_DOES_NOT_SUPPORT_VPCLMULQDQ) /* * VPCLMULQDQ/AVX512 implementation using 256-bit vectors. This is very similar