Skip to content

Commit

Permalink
AVX check priorities change, checking avx flag before xcr0 instead.
Browse files Browse the repository at this point in the history
closes yvt#1018
  • Loading branch information
devnexen committed May 11, 2022
1 parent eac96b8 commit f41fcab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Core/CpuID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit f41fcab

Please sign in to comment.