Skip to content

Commit b329179

Browse files
authored
[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.
1 parent 6ea0c0a commit b329179

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
@@ -1287,8 +1287,10 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf,
12871287
setFeature(X86::FEATURE_AVX2);
12881288
if (HasLeaf7 && ((EBX >> 8) & 1))
12891289
setFeature(X86::FEATURE_BMI2);
1290-
if (HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save)
1290+
if (HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save) {
12911291
setFeature(X86::FEATURE_AVX512F);
1292+
setFeature(X86::FEATURE_EVEX512);
1293+
}
12921294
if (HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save)
12931295
setFeature(X86::FEATURE_AVX512DQ);
12941296
if (HasLeaf7 && ((EBX >> 19) & 1))
@@ -1799,6 +1801,7 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) {
17991801
Features["rtm"] = HasLeaf7 && ((EBX >> 11) & 1);
18001802
// AVX512 is only supported if the OS supports the context save for it.
18011803
Features["avx512f"] = HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save;
1804+
Features["evex512"] = Features["avx512f"];
18021805
Features["avx512dq"] = HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save;
18031806
Features["rdseed"] = HasLeaf7 && ((EBX >> 18) & 1);
18041807
Features["adx"] = HasLeaf7 && ((EBX >> 19) & 1);

0 commit comments

Comments
 (0)