Skip to content

Commit a7b8b89

Browse files
phoebewangtstellar
authored andcommitted
[X86] Enable EVEX512 when host CPU has AVX512 (#90479)
This is used when -march=native run on an unknown CPU to old version of LLVM. (cherry picked from commit b329179)
1 parent 4da5b14 commit a7b8b89

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/TargetParser/Host.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1266,8 +1266,10 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf,
12661266
setFeature(X86::FEATURE_AVX2);
12671267
if (HasLeaf7 && ((EBX >> 8) & 1))
12681268
setFeature(X86::FEATURE_BMI2);
1269-
if (HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save)
1269+
if (HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save) {
12701270
setFeature(X86::FEATURE_AVX512F);
1271+
setFeature(X86::FEATURE_EVEX512);
1272+
}
12711273
if (HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save)
12721274
setFeature(X86::FEATURE_AVX512DQ);
12731275
if (HasLeaf7 && ((EBX >> 19) & 1))
@@ -1772,6 +1774,7 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) {
17721774
Features["rtm"] = HasLeaf7 && ((EBX >> 11) & 1);
17731775
// AVX512 is only supported if the OS supports the context save for it.
17741776
Features["avx512f"] = HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save;
1777+
Features["evex512"] = Features["avx512f"];
17751778
Features["avx512dq"] = HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save;
17761779
Features["rdseed"] = HasLeaf7 && ((EBX >> 18) & 1);
17771780
Features["adx"] = HasLeaf7 && ((EBX >> 19) & 1);

0 commit comments

Comments
 (0)