[clang] [X86][AVX10] Fix a bug when using -march with no-evex512 attribute (PR #72126)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 07:27:27 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-backend-x86

Author: Phoebe Wang (phoebewang)

<details>
<summary>Changes</summary>

failed to clear EVEX512 feature for intended intrinsics.

Fixes #<!-- -->72106

---
Full diff: https://github.com/llvm/llvm-project/pull/72126.diff


2 Files Affected:

- (modified) clang/lib/Basic/Targets/X86.cpp (+1-1) 
- (added) clang/test/CodeGen/X86/pr72106.c (+10) 


``````````diff
diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index eb127a8a11fffd5..acde3c1661748f0 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -122,7 +122,7 @@ bool X86TargetInfo::initFeatureMap(
   std::vector<std::string> UpdatedAVX10FeaturesVec;
   enum { FE_NOSET = -1, FE_FALSE, FE_TRUE };
   int HasEVEX512 = FE_NOSET;
-  bool HasAVX512F = false;
+  bool HasAVX512F = Features["avx512f"];
   bool HasAVX10 = false;
   bool HasAVX10_512 = false;
   std::string LastAVX10;
diff --git a/clang/test/CodeGen/X86/pr72106.c b/clang/test/CodeGen/X86/pr72106.c
new file mode 100644
index 000000000000000..7ff4012f319b5b1
--- /dev/null
+++ b/clang/test/CodeGen/X86/pr72106.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -ffreestanding -target-cpu cannonlake -emit-llvm < %s | FileCheck %s
+
+#include <immintrin.h>
+
+int main(int argc, char **argv) {
+  // CHECK-LABEL: @main
+  // CHECK: @llvm.masked.load.v4i64.p0
+  __m256i ptrs = _mm256_maskz_loadu_epi64(0, argv);
+  return 0;
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/72126


More information about the cfe-commits mailing list