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

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 23:39:54 PST 2023


Author: Phoebe Wang
Date: 2023-11-14T15:39:30+08:00
New Revision: e96eddec5e8ecc0fdab377571aabe85a2ee7617e

URL: https://github.com/llvm/llvm-project/commit/e96eddec5e8ecc0fdab377571aabe85a2ee7617e
DIFF: https://github.com/llvm/llvm-project/commit/e96eddec5e8ecc0fdab377571aabe85a2ee7617e.diff

LOG: Reland "[X86][AVX10] Fix a bug when using -march with no-evex512 attribute (#72126)"

Fixes #72106

Added: 
    clang/test/CodeGen/X86/pr72106.c

Modified: 
    clang/lib/Basic/Targets/X86.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index eb127a8a11fffd5..85d0697ad63cae3 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -122,9 +122,9 @@ bool X86TargetInfo::initFeatureMap(
   std::vector<std::string> UpdatedAVX10FeaturesVec;
   enum { FE_NOSET = -1, FE_FALSE, FE_TRUE };
   int HasEVEX512 = FE_NOSET;
-  bool HasAVX512F = false;
-  bool HasAVX10 = false;
-  bool HasAVX10_512 = false;
+  bool HasAVX512F = Features.lookup("avx512f");
+  bool HasAVX10 = Features.lookup("avx10.1-256");
+  bool HasAVX10_512 = Features.lookup("avx10.1-512");
   std::string LastAVX10;
   std::string LastAVX512;
   for (const auto &Feature : FeaturesVec) {

diff  --git a/clang/test/CodeGen/X86/pr72106.c b/clang/test/CodeGen/X86/pr72106.c
new file mode 100644
index 000000000000000..937b74ec58d7b3e
--- /dev/null
+++ b/clang/test/CodeGen/X86/pr72106.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple x86_64 -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;
+}


        


More information about the cfe-commits mailing list