From f41fcabfaf1cb53192a516631780047fe7de5837 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Wed, 11 May 2022 17:48:09 +0100 Subject: [PATCH] AVX check priorities change, checking avx flag before xcr0 instead. closes #1018 --- Sources/Core/CpuID.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Core/CpuID.cpp b/Sources/Core/CpuID.cpp index 43fe96991..faf773edb 100644 --- a/Sources/Core/CpuID.cpp +++ b/Sources/Core/CpuID.cpp @@ -54,7 +54,7 @@ namespace spades { featureEdx = ar[3]; // xsave/osxsave - if ((featureEcx & 26) && (featureEcx & 27)) { + if ((featureEcx & (1U << 28)) && (featureEcx & 26) && (featureEcx & 27)) { auto x = xcr0(); featureXcr0Avx = ((x & 6) == 6); featureXcr0Avx512 = ((x & 224) == 224); @@ -89,7 +89,7 @@ namespace spades { case CpuFeature::SSE3: return featureEcx & (1U << 0); case CpuFeature::SSSE3: return featureEcx & (1U << 9); case CpuFeature::FMA: return featureEcx & (1U << 12); - case CpuFeature::AVX: return (featureXcr0Avx && (featureEcx & (1U << 28))); + case CpuFeature::AVX: return featureXcr0Avx; case CpuFeature::AVX2: return (featureXcr0Avx && subfeature & (1U << 5)); case CpuFeature::AVX512CD: return (featureXcr0Avx512 && subfeature & (1U << 28)); case CpuFeature::AVX512ER: return (featureXcr0Avx512 && subfeature & (1U << 27));