From 5b217a14d6802ffe5cd586dd8aa5cc44610eb633 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 23 Feb 2024 20:48:14 -0800 Subject: [PATCH] lib/x86: fix XCR0 check for AVX-512VL According to the Intel manual, the ZMM_Hi256 bit needs to be checked for all AVX-512 instructions, even if 512-bit vectors aren't being used. --- lib/x86/cpu_features.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/x86/cpu_features.c b/lib/x86/cpu_features.c index 72bd37c2..ba7a39ff 100644 --- a/lib/x86/cpu_features.c +++ b/lib/x86/cpu_features.c @@ -171,7 +171,7 @@ void libdeflate_init_x86_cpu_features(void) features |= X86_CPU_FEATURE_ZMM; if ((b & (1 << 16)) && ((xcr0 & 0xe6) == 0xe6)) features |= X86_CPU_FEATURE_AVX512F; - if ((b & (1U << 31)) && ((xcr0 & 0xa6) == 0xa6)) + if ((b & (1U << 31)) && ((xcr0 & 0xe6) == 0xe6)) features |= X86_CPU_FEATURE_AVX512VL; if ((c & (1 << 10)) && ((xcr0 & 0x6) == 0x6)) features |= X86_CPU_FEATURE_VPCLMULQDQ;