aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmina Chabane <amina.chabane@arm.com>2025-08-08 16:04:54 +0100
committerGitHub <noreply@github.com>2025-08-08 16:04:54 +0100
commit478b415181ee1637e95e3e7969f21d20e15e4c64 (patch)
tree3cd4994d0084d7d08ee150a2321f738e24453742
parente91f68487cf1af83d4225f3459482b2f171f20a4 (diff)
downloadllvm-478b415181ee1637e95e3e7969f21d20e15e4c64.zip
llvm-478b415181ee1637e95e3e7969f21d20e15e4c64.tar.gz
llvm-478b415181ee1637e95e3e7969f21d20e15e4c64.tar.bz2
[AArch64] Enable svcompact intrinsic in streaming mode with SME2.2 (#151703)
When the target enables +sme2p2, the svcompact intrinsic is now available in streaming SVE mode, through updating the guards in arm_sve.td. Included Sema test acle_sve_compact.cpp.
-rw-r--r--clang/include/clang/Basic/arm_sve.td4
-rw-r--r--clang/test/Sema/aarch64-sve-intrinsics/acle_sve_compact.cpp18
2 files changed, 20 insertions, 2 deletions
diff --git a/clang/include/clang/Basic/arm_sve.td b/clang/include/clang/Basic/arm_sve.td
index 07786c6..7513a3e 100644
--- a/clang/include/clang/Basic/arm_sve.td
+++ b/clang/include/clang/Basic/arm_sve.td
@@ -980,8 +980,8 @@ defm SVCLASTA_N : SVEPerm<"svclasta[_n_{d}]", "sPsd", "aarch64_sve_clasta_n">;
defm SVCLASTB : SVEPerm<"svclastb[_{d}]", "dPdd", "aarch64_sve_clastb">;
defm SVCLASTB_N : SVEPerm<"svclastb[_n_{d}]", "sPsd", "aarch64_sve_clastb_n">;
-let SVETargetGuard = "sve", SMETargetGuard = InvalidMode in {
-def SVCOMPACT : SInst<"svcompact[_{d}]", "dPd", "ilUiUlfd", MergeNone, "aarch64_sve_compact">;
+let SVETargetGuard = "sve", SMETargetGuard = "sme2p2" in {
+def SVCOMPACT : SInst<"svcompact[_{d}]", "dPd", "ilUiUlfd", MergeNone, "aarch64_sve_compact", [VerifyRuntimeMode]>;
}
// Note: svdup_lane is implemented using the intrinsic for TBL to represent a
diff --git a/clang/test/Sema/aarch64-sve-intrinsics/acle_sve_compact.cpp b/clang/test/Sema/aarch64-sve-intrinsics/acle_sve_compact.cpp
new file mode 100644
index 0000000..4de3f39
--- /dev/null
+++ b/clang/test/Sema/aarch64-sve-intrinsics/acle_sve_compact.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \
+// RUN: -verify -verify-ignore-unexpected=error,note -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme \
+// RUN: -verify -verify-ignore-unexpected=error,note -emit-llvm -o - %s
+// REQUIRES: aarch64-registered-target
+// expected-no-diagnostics
+
+#include <arm_sve.h>
+
+__attribute__((target("sme2p2")))
+void test_svcompact(svbool_t pg, svfloat32_t op) __arm_streaming{
+ svcompact(pg, op);
+}
+
+void test_svcompact_nofeature(svbool_t pg, svfloat32_t op) __arm_streaming{
+ // expected-error@+1 {{'svcompact' needs target feature (sve)|(sme, sme2p2)}}
+ svcompact(pg, op);
+} \ No newline at end of file