Skip to content

Commit 22734e1

Browse files
[Clang][AArch64] Fix 'svzero_za' intrinsic to take no arguments. (llvm#82648)
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.
1 parent 790bcec commit 22734e1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/include/clang/Basic/arm_sme.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ let TargetGuard = "sme" in {
142142
def SVZERO_MASK_ZA : SInst<"svzero_mask_za", "vi", "", MergeNone, "aarch64_sme_zero",
143143
[IsOverloadNone, IsStreamingCompatible, IsInOutZA],
144144
[ImmCheck<0, ImmCheck0_255>]>;
145-
def SVZERO_ZA : SInst<"svzero_za", "v", "", MergeNone, "aarch64_sme_zero",
145+
def SVZERO_ZA : SInst<"svzero_za", "vv", "", MergeNone, "aarch64_sme_zero",
146146
[IsOverloadNone, IsStreamingCompatible, IsOutZA]>;
147147
}
148148

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -fsyntax-only -verify %s
2+
3+
void test_svzero_args(uint64_t m) {
4+
svzero_za(0); // expected-error {{too many arguments to function call, expected 0, have 1}}
5+
svzero_za(m); // expected-error {{too many arguments to function call, expected 0, have 1}}
6+
svzero_mask_za(m); // expected-error {{argument to 'svzero_mask_za' must be a constant integer}}
7+
}

0 commit comments

Comments
 (0)