From fac122ac439191d5f46da6400681c54b0bf7e3db Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Fri, 10 May 2024 13:25:37 +0800 Subject: [PATCH] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (#91694) (cherry picked from commit 87f3407856e61a73798af4e41b28bc33b5bf4ce6) --- llvm/lib/TargetParser/Host.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/TargetParser/Host.cpp b/llvm/lib/TargetParser/Host.cpp index 1adef15771fa17..848b531dd8dd9f 100644 --- a/llvm/lib/TargetParser/Host.cpp +++ b/llvm/lib/TargetParser/Host.cpp @@ -1774,7 +1774,8 @@ bool sys::getHostCPUFeatures(StringMap &Features) { Features["rtm"] = HasLeaf7 && ((EBX >> 11) & 1); // AVX512 is only supported if the OS supports the context save for it. Features["avx512f"] = HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save; - Features["evex512"] = Features["avx512f"]; + if (Features["avx512f"]) + Features["evex512"] = true; Features["avx512dq"] = HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save; Features["rdseed"] = HasLeaf7 && ((EBX >> 18) & 1); Features["adx"] = HasLeaf7 && ((EBX >> 19) & 1);