[clang] 22734e1 - [Clang][AArch64] Fix 'svzero_za' intrinsic to take no arguments. (#82648)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 23 03:31:28 PST 2024
Author: Sander de Smalen
Date: 2024-02-23T11:31:24Z
New Revision: 22734e15d8f2c437e8543f19632299d2e09b31f3
URL: https://github.com/llvm/llvm-project/commit/22734e15d8f2c437e8543f19632299d2e09b31f3
DIFF: https://github.com/llvm/llvm-project/commit/22734e15d8f2c437e8543f19632299d2e09b31f3.diff
LOG: [Clang][AArch64] Fix 'svzero_za' intrinsic to take no arguments. (#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.
Added:
clang/test/Sema/aarch64-sme-intrinsics/acle_sme_zero.c
Modified:
clang/include/clang/Basic/arm_sme.td
Removed:
################################################################################
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}}
+}
More information about the cfe-commits
mailing list