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

[Clang][AArch64] Fix 'svzero_za' intrinsic to take no arguments. #82648

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

sdesmalen-arm
Copy link
Collaborator

We previously defined svzero_za as:

void svzero_za();

rather than:

void svzero_za(void);

Which meant that Clang accepted arguments. Compiling for example svzero_za(<non-constant integer>) ended up with incorrect IR and a compiler crash because it couldn't select an instruction for it.

We previously defined svzero_za as:

  void svzero_za();

rather than:

  void svzero_za(void);

Which meant that Clang accepted arguments. Compiling for example
`svzero_za(<non-constant integer>)` ended up with incorrect IR and a
compiler crash because it couldn't select an instruction for it.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Feb 22, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 22, 2024

@llvm/pr-subscribers-clang

Author: Sander de Smalen (sdesmalen-arm)

Changes

We previously defined svzero_za as:

void svzero_za();

rather than:

void svzero_za(void);

Which meant that Clang accepted arguments. Compiling for example svzero_za(&lt;non-constant integer&gt;) ended up with incorrect IR and a compiler crash because it couldn't select an instruction for it.


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

2 Files Affected:

  • (modified) clang/include/clang/Basic/arm_sme.td (+1-1)
  • (added) clang/test/Sema/aarch64-sme-intrinsics/acle_sme_zero.c (+7)
diff --git a/clang/include/clang/Basic/arm_sme.td b/clang/include/clang/Basic/arm_sme.td
index 2da0e8d2aba9a4..1ac6d5170ea283 100644
--- a/clang/include/clang/Basic/arm_sme.td
+++ b/clang/include/clang/Basic/arm_sme.td
@@ -142,7 +142,7 @@ let TargetGuard = "sme" in {
   def SVZERO_MASK_ZA : SInst<"svzero_mask_za", "vi", "", MergeNone, "aarch64_sme_zero",
                              [IsOverloadNone, IsStreamingCompatible, IsInOutZA],
                              [ImmCheck<0, ImmCheck0_255>]>;
-  def SVZERO_ZA      : SInst<"svzero_za", "v", "", MergeNone, "aarch64_sme_zero",
+  def SVZERO_ZA      : SInst<"svzero_za", "vv", "", MergeNone, "aarch64_sme_zero",
                              [IsOverloadNone, IsStreamingCompatible, IsOutZA]>;
 }
 
diff --git a/clang/test/Sema/aarch64-sme-intrinsics/acle_sme_zero.c b/clang/test/Sema/aarch64-sme-intrinsics/acle_sme_zero.c
new file mode 100644
index 00000000000000..e0b6c391d98902
--- /dev/null
+++ b/clang/test/Sema/aarch64-sme-intrinsics/acle_sme_zero.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -fsyntax-only -verify %s
+
+void test_svzero_args(uint64_t m) {
+  svzero_za(0); // expected-error {{too many arguments to function call, expected 0, have 1}}
+  svzero_za(m); // expected-error {{too many arguments to function call, expected 0, have 1}}
+  svzero_mask_za(m); // expected-error {{argument to 'svzero_mask_za' must be a constant integer}}
+}

@sdesmalen-arm sdesmalen-arm merged commit 22734e1 into llvm:main Feb 23, 2024
6 of 7 checks passed
@sdesmalen-arm sdesmalen-arm deleted the sme-fix-svzero-za branch February 23, 2024 11:36
sdesmalen-arm added a commit that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

None yet

3 participants