[llvm-branch-commits] [llvm] release/18.x: [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (#91694) (PR #91705)

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue May 14 16:26:23 PDT 2024


https://github.com/tstellar updated https://github.com/llvm/llvm-project/pull/91705

>From fac122ac439191d5f46da6400681c54b0bf7e3db Mon Sep 17 00:00:00 2001
From: Phoebe Wang <phoebe.wang at intel.com>
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 1adef15771fa1..848b531dd8dd9 100644
--- a/llvm/lib/TargetParser/Host.cpp
+++ b/llvm/lib/TargetParser/Host.cpp
@@ -1774,7 +1774,8 @@ bool sys::getHostCPUFeatures(StringMap<bool> &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);



More information about the llvm-branch-commits mailing list