Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 8 commits into from
Nov 14, 2023

Conversation

phoebewang
Copy link
Contributor

@phoebewang phoebewang commented Nov 13, 2023

#71318 failed to clear EVEX512 feature for intended intrinsics.

Fixes #72106

failed to clear EVEX512 feature for intended intrinsics.

Fixes llvm#72106
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:X86 clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Nov 13, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 13, 2023

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-backend-x86

Author: Phoebe Wang (phoebewang)

Changes

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 --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;
+}

…t for test"

This reverts commit 2124770.

Do not initialize AVX10.1 features for now since it affects other lit tests.
@ronlieb
Copy link
Contributor

ronlieb commented Nov 13, 2023

i applied the proposed patch on top of latest and the build issues are gone.

Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ronlieb ronlieb assigned ronlieb and unassigned ronlieb Nov 13, 2023
@ronlieb ronlieb self-requested a review November 13, 2023 23:00
@ronlieb
Copy link
Contributor

ronlieb commented Nov 13, 2023

ok to land,

Copy link
Contributor

@KanRobert KanRobert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@e-kud e-kud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. LGTM

@phoebewang phoebewang merged commit 451c594 into llvm:main Nov 14, 2023
3 checks passed
@phoebewang phoebewang deleted the Fix72106 branch November 14, 2023 07:15
phoebewang added a commit that referenced this pull request Nov 14, 2023
…ibute (#72126)"

This reverts commit 451c594.

Revert due to buildbot fails.
@ronlieb
Copy link
Contributor

ronlieb commented Nov 15, 2023

thanks for the fix, working great now.

zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Nov 20, 2023
zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Nov 20, 2023
…ibute (llvm#72126)"

This reverts commit 451c594.

Revert due to buildbot fails.
zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression since "[X86][AVX10] Permit AVX512 options/features used together with AVX10 (#71318)"
6 participants