[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)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 9 23:51:00 PDT 2024


https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/91705

Backport 87f3407856e61a73798af4e41b28bc33b5bf4ce6

Requested by: @phoebewang

>From dc1713855159bbc14e6387fb57d8065037f92145 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