]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: implement changes for COMPACT and EXPAND SVE instructions
authorArtemiy Volkov <artemiy.volkov@arm.com>
Sat, 10 Jan 2026 15:16:59 +0000 (15:16 +0000)
committerArtemiy Volkov <artemiy.volkov@arm.com>
Fri, 29 May 2026 11:33:18 +0000 (11:33 +0000)
SVE2.2 and SME2.2 extensions introduce the following changes related to
COMPACT/EXPAND instructions:

- COMPACT (Copy Active vector elements to lower-numbered elements) for 8-
  and 16-bit-wide vector elements: these variants of an existing instruction
  are new in SVE2.2 (or in streaming mode, SME2.2)
- COMPACT (Copy Active vector elements to lower-numbered elements) for 32-
  and 64-bit-wide vector elements: previously only legal in non-streaming
  mode, these variants are now allowed in streaming mode under SME2.2
- EXPAND (Copy lower-numbered vector elements to Active elements): this
  instruction is new in SVE2.2 (or in streaming mode, SME2.2)

The new supporting intrinsics are documented in the ACLE manual [0] and
are as follows:

sv{uint,int}{8,16}_t svcompact[_{u,s}{8,16}]
  (svbool_t pg, sv{uint,int}{8,16}_t zn);
sv{mfloat8,bfloat16,float16}_t svcompact[_{mf8,bf16,f16}]
  (svbool_t pg, sv{mfloat8,bfloat16,float16}_t zn);

sv{uint,int}{8,16,32,64}_t svexpand[_{u,s}{8,16,32,64}]
  (svbool_t pg, sv{uint,int}{8,16,32,64}_t zn);
svfloat{16,32,64}_t svexpand[_f{16,32,64}]
  (svbool_t pg, svfloat{16,32,64}_t zn);
sv{mfloat8,bfloat16}_t svexpand[_{mf8,bf16}]
  (svbool_t pg, sv{mfloat8,bfloat16}_t zn);

This patch implements the above changes throughout the SVE builtin
description files and aarch64-sve{,2}.md.

New ASM tests have been added as usual; also, an adjustment has been made
to aarch64-ssve.exp in g++.target/ to reflect the fact that the svcompact
intrinsic is not nonstreaming-only anymore.

[0] https://github.com/ARM-software/acle

gcc/ChangeLog:

* config/aarch64/aarch64-sve-builtins-base.cc (class svexpand_impl):
Define new SVE function base.
* config/aarch64/aarch64-sve-builtins-base.def (svcompact): Allow
execution in streaming mode when SME2p2 is enabled.
* config/aarch64/aarch64-sve-builtins-base.h (svexpand): Declare
new SVE function base.
* config/aarch64/aarch64-sve-builtins-sve2.def (svcompact): Define
new SVE function.
(svexpand): Likewise.
* config/aarch64/aarch64-sve.md (@aarch64_sve_compact<mode>):
Enable 32- and 64-bit element variants under SME2p2.  New
insn pattern for 8- and 16-bit elements.
(@aarch64_sve_expand<mode>): New insn pattern.
* config/aarch64/aarch64.h (TARGET_SVE_OR_SME2p2): New macro.
* config/aarch64/aarch64.md (UNSPEC_SVE_EXPAND): New UNSPEC.

gcc/testsuite/ChangeLog:

* g++.target/aarch64/sve/aarch64-ssve.exp: Add sve2p2 to the
target string.  Move svcompact from $nonstreaming_only to
$streaming_ok.
* gcc.target/aarch64/sve2/acle/asm/compact_bf16.c: New test.
* gcc.target/aarch64/sve2/acle/asm/compact_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/compact_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/compact_mf8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/compact_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/compact_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/compact_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/compact_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/compact_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/compact_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/compact_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/compact_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_bf16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_mf8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/expand_u8.c: Likewise.

32 files changed:
gcc/config/aarch64/aarch64-sve-builtins-base.cc
gcc/config/aarch64/aarch64-sve-builtins-base.def
gcc/config/aarch64/aarch64-sve-builtins-base.h
gcc/config/aarch64/aarch64-sve-builtins-sve2.def
gcc/config/aarch64/aarch64-sve.md
gcc/config/aarch64/aarch64.h
gcc/config/aarch64/aarch64.md
gcc/testsuite/g++.target/aarch64/sve/aarch64-ssve.exp
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_bf16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_f32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_f64.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_mf8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s64.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u64.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_bf16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_f32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_f64.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_mf8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s64.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u64.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u8.c [new file with mode: 0644]

index 4edb4f89c16590de2d97181de31ee05ecce45ebe..1fa7473283dc12f4faa071f01e4679f58ff0c5ee 100644 (file)
@@ -1291,6 +1291,19 @@ public:
   }
 };
 
+class svexpand_impl
+  : public QUIET_CODE_FOR_MODE0 (aarch64_sve_expand)
+{
+public:
+  gimple *
+  fold (gimple_folder &f) const override
+  {
+    if (is_pfalse (gimple_call_arg (f.call, 0)))
+      return f.fold_call_to (build_zero_cst (TREE_TYPE (f.lhs)));
+    return NULL;
+  }
+};
+
 /* Implements svextb, svexth and svextw.  */
 class svext_bhw_impl : public function_base
 {
@@ -3595,6 +3608,7 @@ FUNCTION (svdupq_lane, svdupq_lane_impl,)
 FUNCTION (sveor, rtx_code_function, (XOR, XOR, -1))
 FUNCTION (sveorv, sveorv_impl,)
 FUNCTION (svexpa, unspec_based_function, (-1, -1, UNSPEC_FEXPA))
+FUNCTION (svexpand, svexpand_impl,)
 FUNCTION (svext, QUIET_CODE_FOR_MODE0 (aarch64_sve_ext),)
 FUNCTION (svextb, svext_bhw_impl, (QImode))
 FUNCTION (svexth, svext_bhw_impl, (HImode))
index 9914e060f4d5ef54634d35f0a9db7e3156d71940..c1e00a51b7b471eadb2dc9e4798be8e8ee4aefd0 100644 (file)
@@ -274,7 +274,6 @@ DEF_SVE_FUNCTION (svadrb, adr_offset, none, none)
 DEF_SVE_FUNCTION (svadrd, adr_index, none, none)
 DEF_SVE_FUNCTION (svadrh, adr_index, none, none)
 DEF_SVE_FUNCTION (svadrw, adr_index, none, none)
-DEF_SVE_FUNCTION (svcompact, unary, sd_data, implicit)
 DEF_SVE_FUNCTION (svexpa, unary_uint, all_float, none)
 DEF_SVE_FUNCTION (svld1_gather, load_gather_sv, sd_data, implicit)
 DEF_SVE_FUNCTION (svld1_gather, load_gather_vs, sd_data, implicit)
@@ -374,3 +373,7 @@ DEF_SVE_FUNCTION (svuzp2q, binary, all_data, none)
 DEF_SVE_FUNCTION (svzip1q, binary, all_data, none)
 DEF_SVE_FUNCTION (svzip2q, binary, all_data, none)
 #undef REQUIRED_EXTENSIONS
+
+#define REQUIRED_EXTENSIONS sve_and_sme (0, AARCH64_FL_SME2p2)
+DEF_SVE_FUNCTION (svcompact, unary, sd_data, implicit)
+#undef REQUIRED_EXTENSIONS
index dc443524050e129d54bd49f61354fd75d962edfc..1ae2483f26846a63176a1a6d4b67c0daf9f06c03 100644 (file)
@@ -105,6 +105,7 @@ namespace aarch64_sve
     extern const function_base *const sveor;
     extern const function_base *const sveorv;
     extern const function_base *const svexpa;
+    extern const function_base *const svexpand;
     extern const function_base *const svext;
     extern const function_base *const svextb;
     extern const function_base *const svexth;
index dcb968c664a42252f614bcdbdba878fb09c60045..7fbf9c30708cbc1642c73ef1a625b481eaf9379c 100644 (file)
@@ -304,6 +304,8 @@ DEF_SVE_FUNCTION (svcvtlt, unary_convert, cvt_long, z)
 DEF_SVE_FUNCTION (svcvtnt, unary_convert_narrowt, cvt_narrow, z)
 DEF_SVE_FUNCTION (svcvtnt, unary_convert_narrowt, cvt_bfloat, z)
 DEF_SVE_FUNCTION (svcvtxnt, unary_convert_narrowt, cvt_narrow_s, z)
+DEF_SVE_FUNCTION (svcompact, unary, bh_data, implicit)
+DEF_SVE_FUNCTION (svexpand, unary, all_data, implicit)
 DEF_SVE_FUNCTION (svfirstp, count_pred, all_pred, implicit)
 DEF_SVE_FUNCTION (svlastp, count_pred, all_pred, implicit)
 DEF_SVE_FUNCTION (svrint32x, unary, sd_float, mxz)
index e36ff9d6468b9bc61760cf5542c0ef909a28f932..e21c77a6db8b429489a0787021f7a3f279e00a6f 100644 (file)
 ;; ---- [INT,FP] Special-purpose unary permutes
 ;; -------------------------------------------------------------------------
 ;; Includes:
-;; - COMPACT
+;; - COMPACT word/doubleword
+;; - COMPACT byte/halfword (SVE2p2)
+;; - EXPAND (SVE2p2)
 ;; - DUP
 ;; - REV
 ;; -------------------------------------------------------------------------
          [(match_operand:<VPRED> 1 "register_operand" "Upl")
           (match_operand:SVE_FULL_SD 2 "register_operand" "w")]
          UNSPEC_SVE_COMPACT))]
-  "TARGET_SVE && TARGET_NON_STREAMING"
+  "TARGET_SVE_OR_SME2p2"
+  "compact\t%0.<Vetype>, %1, %2.<Vetype>"
+  [(set_attr "sve_type" "sve_int_extract")]
+)
+
+(define_insn "@aarch64_sve_compact<mode>"
+  [(set (match_operand:SVE_FULL_BH 0 "register_operand" "=w")
+       (unspec:SVE_FULL_BH
+         [(match_operand:<VPRED> 1 "register_operand" "Upl")
+          (match_operand:SVE_FULL_BH 2 "register_operand" "w")]
+         UNSPEC_SVE_COMPACT))]
+  "TARGET_SVE2p2_OR_SME2p2"
   "compact\t%0.<Vetype>, %1, %2.<Vetype>"
   [(set_attr "sve_type" "sve_int_extract")]
 )
 
+;; Expand into active elements and set inactive elements to zero.
+(define_insn "@aarch64_sve_expand<mode>"
+  [(set (match_operand:SVE_FULL 0 "register_operand" "=w")
+       (unspec:SVE_FULL
+         [(match_operand:<VPRED> 1 "register_operand" "Upl")
+          (match_operand:SVE_FULL 2 "register_operand" "w")]
+         UNSPEC_SVE_EXPAND))]
+  "TARGET_SVE2p2_OR_SME2p2"
+  "expand\t%0.<Vetype>, %1, %2.<Vetype>"
+  [(set_attr "sve_type" "sve_int_extract")]
+)
+
 ;; Duplicate one element of a vector.
 (define_insn "@aarch64_sve_dup_lane<mode>"
   [(set (match_operand:SVE_ALL 0 "register_operand" "=w")
index 1f6284e40f1aa9d4644554d9f73cee83ef9b44e3..0ef1ec49e6faa25c4790cfa488d51a11f079836e 100644 (file)
@@ -516,6 +516,10 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE ATTRIBUTE_UNUSED
 
 /* Combinatorial tests.  */
 
+#define TARGET_SVE_OR_SME2p2 \
+  ((TARGET_SVE || TARGET_STREAMING) \
+   && (TARGET_SME2p2 || TARGET_NON_STREAMING))
+
 #define TARGET_SVE2_OR_SME2 \
   ((TARGET_SVE2 || TARGET_STREAMING) \
    && (TARGET_SME2 || TARGET_NON_STREAMING))
index 8cf26446006ca51176a2c611f4396c5d6111d1d6..0d2b2cde0a7b89f3b3e48b832ee2cfe1b43bd2a1 100644 (file)
     UNSPEC_SVE_PREFETCH
     UNSPEC_SVE_PREFETCH_GATHER
     UNSPEC_SVE_COMPACT
+    UNSPEC_SVE_EXPAND
     UNSPEC_SVE_SPLICE
     UNSPEC_GEN_TAG             ; Generate a 4-bit MTE tag.
     UNSPEC_GEN_TAG_RND         ; Generate a random 4-bit MTE tag.
index d83422d0db19991f6cf113a57933ebb70f574572..ea167eebf0da7a11c7897b6584411bbb02c536ee 100644 (file)
@@ -37,7 +37,7 @@ gcc_parallel_test_enable 0
 set preamble {
 #include <arm_sve.h>
 
-#pragma GCC target "+i8mm+f32mm+f64mm+sve2+sve2-bitperm+sve2-sm4+sve2-aes+sve2-sha3+sme"
+#pragma GCC target "+i8mm+f32mm+f64mm+sve2+sve2-bitperm+sve2-sm4+sve2-aes+sve2-sha3+sme+sme2p2"
 
 extern svbool_t &pred;
 
@@ -145,6 +145,7 @@ proc check_ssve_calls { harness calls should_pass } {
 set streaming_ok {
     s8 = svadd_x (pred, s8, s8)
     s8 = svld1 (pred, s8_ptr)
+    u32 = svcompact (pred, u32)
 }
 
 # This order follows the list in the SME manual.
@@ -164,8 +165,6 @@ set nonstreaming_only {
     u8 = svbdep (u8, u8)
     u8 = svbext (u8, u8)
     f32 = svbfmmla (f32, bf16, bf16)
-    u8 = svbgrp (u8, u8)
-    u32 = svcompact (pred, u32)
     f32 = svadda (pred, 1.0f, f32)
     f32 = svexpa (u32)
     f32 = svmmla (f32, f32, f32)
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_bf16.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_bf16.c
new file mode 100644 (file)
index 0000000..6bdf11f
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** compact_bf16_tied1:
+**     compact z0\.h, p0, z0\.h
+**     ret
+*/
+TEST_UNIFORM_Z (compact_bf16_tied1, svbfloat16_t,
+               z0 = svcompact_bf16 (p0, z0),
+               z0 = svcompact (p0, z0))
+
+/*
+** compact_bf16_untied:
+**     compact z0\.h, p0, z1\.h
+**     ret
+*/
+TEST_UNIFORM_Z (compact_bf16_untied, svbfloat16_t,
+               z0 = svcompact_bf16 (p0, z1),
+               z0 = svcompact (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_f32.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_f32.c
new file mode 100644 (file)
index 0000000..be6cd87
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-skip-if "" { *-*-* } { "" } { "-DSTREAMING_COMPATIBLE" } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sme2p2"
+
+#include "../../../sve/acle/asm/compact_f32.c"
+
+/*
+** compact_f32_tied1:
+**     compact z0\.s, p0, z0\.s
+**     ret
+*/
+
+/*
+** compact_f32_untied:
+**     compact z0\.s, p0, z1\.s
+**     ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_f64.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_f64.c
new file mode 100644 (file)
index 0000000..131364b
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-skip-if "" { *-*-* } { "" } { "-DSTREAMING_COMPATIBLE" } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sme2p2"
+
+#include "../../../sve/acle/asm/compact_f64.c"
+
+/*
+** compact_f64_tied1:
+**     compact z0\.d, p0, z0\.d
+**     ret
+*/
+
+/*
+** compact_f64_untied:
+**     compact z0\.d, p0, z1\.d
+**     ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_mf8.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_mf8.c
new file mode 100644 (file)
index 0000000..07490dd
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** compact_mf8_tied1:
+**     compact z0\.b, p0, z0\.b
+**     ret
+*/
+TEST_UNIFORM_Z (compact_mf8_tied1, svmfloat8_t,
+               z0 = svcompact_mf8 (p0, z0),
+               z0 = svcompact (p0, z0))
+
+/*
+** compact_mf8_untied:
+**     compact z0\.b, p0, z1\.b
+**     ret
+*/
+TEST_UNIFORM_Z (compact_mf8_untied, svmfloat8_t,
+               z0 = svcompact_mf8 (p0, z1),
+               z0 = svcompact (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s16.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s16.c
new file mode 100644 (file)
index 0000000..f35ad95
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** compact_s16_tied1:
+**     compact z0\.h, p0, z0\.h
+**     ret
+*/
+TEST_UNIFORM_Z (compact_s16_tied1, svint16_t,
+               z0 = svcompact_s16 (p0, z0),
+               z0 = svcompact (p0, z0))
+
+/*
+** compact_s16_untied:
+**     compact z0\.h, p0, z1\.h
+**     ret
+*/
+TEST_UNIFORM_Z (compact_s16_untied, svint16_t,
+               z0 = svcompact_s16 (p0, z1),
+               z0 = svcompact (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s32.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s32.c
new file mode 100644 (file)
index 0000000..40ff773
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-skip-if "" { *-*-* } { "" } { "-DSTREAMING_COMPATIBLE" } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sme2p2"
+
+#include "../../../sve/acle/asm/compact_s32.c"
+
+/*
+** compact_s32_tied1:
+**     compact z0\.s, p0, z0\.s
+**     ret
+*/
+
+/*
+** compact_s32_untied:
+**     compact z0\.s, p0, z1\.s
+**     ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s64.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s64.c
new file mode 100644 (file)
index 0000000..d4c747a
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-skip-if "" { *-*-* } { "" } { "-DSTREAMING_COMPATIBLE" } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sme2p2"
+
+#include "../../../sve/acle/asm/compact_s64.c"
+
+/*
+** compact_s64_tied1:
+**     compact z0\.d, p0, z0\.d
+**     ret
+*/
+
+/*
+** compact_s64_untied:
+**     compact z0\.d, p0, z1\.d
+**     ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s8.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_s8.c
new file mode 100644 (file)
index 0000000..f3cd944
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** compact_s8_tied1:
+**     compact z0\.b, p0, z0\.b
+**     ret
+*/
+TEST_UNIFORM_Z (compact_s8_tied1, svint8_t,
+               z0 = svcompact_s8 (p0, z0),
+               z0 = svcompact (p0, z0))
+
+/*
+** compact_s8_untied:
+**     compact z0\.b, p0, z1\.b
+**     ret
+*/
+TEST_UNIFORM_Z (compact_s8_untied, svint8_t,
+               z0 = svcompact_s8 (p0, z1),
+               z0 = svcompact (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u16.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u16.c
new file mode 100644 (file)
index 0000000..62f0f20
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** compact_u16_tied1:
+**     compact z0\.h, p0, z0\.h
+**     ret
+*/
+TEST_UNIFORM_Z (compact_u16_tied1, svuint16_t,
+               z0 = svcompact_u16 (p0, z0),
+               z0 = svcompact (p0, z0))
+
+/*
+** compact_u16_untied:
+**     compact z0\.h, p0, z1\.h
+**     ret
+*/
+TEST_UNIFORM_Z (compact_u16_untied, svuint16_t,
+               z0 = svcompact_u16 (p0, z1),
+               z0 = svcompact (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u32.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u32.c
new file mode 100644 (file)
index 0000000..1853af1
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-skip-if "" { *-*-* } { "" } { "-DSTREAMING_COMPATIBLE" } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sme2p2"
+
+#include "../../../sve/acle/asm/compact_u32.c"
+
+/*
+** compact_u32_tied1:
+**     compact z0\.s, p0, z0\.s
+**     ret
+*/
+
+/*
+** compact_u32_untied:
+**     compact z0\.s, p0, z1\.s
+**     ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u64.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u64.c
new file mode 100644 (file)
index 0000000..2f74bd1
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-skip-if "" { *-*-* } { "" } { "-DSTREAMING_COMPATIBLE" } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sme2p2"
+
+#include "../../../sve/acle/asm/compact_u64.c"
+
+/*
+** compact_u64_tied1:
+**     compact z0\.d, p0, z0\.d
+**     ret
+*/
+
+/*
+** compact_u64_untied:
+**     compact z0\.d, p0, z1\.d
+**     ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u8.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/compact_u8.c
new file mode 100644 (file)
index 0000000..4ca16b9
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** compact_u8_tied1:
+**     compact z0\.b, p0, z0\.b
+**     ret
+*/
+TEST_UNIFORM_Z (compact_u8_tied1, svuint8_t,
+               z0 = svcompact_u8 (p0, z0),
+               z0 = svcompact (p0, z0))
+
+/*
+** compact_u8_untied:
+**     compact z0\.b, p0, z1\.b
+**     ret
+*/
+TEST_UNIFORM_Z (compact_u8_untied, svuint8_t,
+               z0 = svcompact_u8 (p0, z1),
+               z0 = svcompact (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_bf16.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_bf16.c
new file mode 100644 (file)
index 0000000..86829eb
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_bf16_tied1:
+**     expand  z0\.h, p0, z0\.h
+**     ret
+*/
+TEST_UNIFORM_Z (expand_bf16_tied1, svbfloat16_t,
+               z0 = svexpand_bf16 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_bf16_untied:
+**     expand  z0\.h, p0, z1\.h
+**     ret
+*/
+TEST_UNIFORM_Z (expand_bf16_untied, svbfloat16_t,
+               z0 = svexpand_bf16 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_f32.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_f32.c
new file mode 100644 (file)
index 0000000..09d3a4f
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_f32_tied1:
+**     expand  z0\.s, p0, z0\.s
+**     ret
+*/
+TEST_UNIFORM_Z (expand_f32_tied1, svfloat32_t,
+               z0 = svexpand_f32 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_f32_untied:
+**     expand  z0\.s, p0, z1\.s
+**     ret
+*/
+TEST_UNIFORM_Z (expand_f32_untied, svfloat32_t,
+               z0 = svexpand_f32 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_f64.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_f64.c
new file mode 100644 (file)
index 0000000..e4dcdba
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_f64_tied1:
+**     expand  z0\.d, p0, z0\.d
+**     ret
+*/
+TEST_UNIFORM_Z (expand_f64_tied1, svfloat64_t,
+               z0 = svexpand_f64 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_f64_untied:
+**     expand  z0\.d, p0, z1\.d
+**     ret
+*/
+TEST_UNIFORM_Z (expand_f64_untied, svfloat64_t,
+               z0 = svexpand_f64 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_mf8.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_mf8.c
new file mode 100644 (file)
index 0000000..55b94e6
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_mf8_tied1:
+**     expand  z0\.b, p0, z0\.b
+**     ret
+*/
+TEST_UNIFORM_Z (expand_mf8_tied1, svmfloat8_t,
+               z0 = svexpand_mf8 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_mf8_untied:
+**     expand  z0\.b, p0, z1\.b
+**     ret
+*/
+TEST_UNIFORM_Z (expand_mf8_untied, svmfloat8_t,
+               z0 = svexpand_mf8 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s16.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s16.c
new file mode 100644 (file)
index 0000000..b939192
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_s16_tied1:
+**     expand  z0\.h, p0, z0\.h
+**     ret
+*/
+TEST_UNIFORM_Z (expand_s16_tied1, svint16_t,
+               z0 = svexpand_s16 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_s16_untied:
+**     expand  z0\.h, p0, z1\.h
+**     ret
+*/
+TEST_UNIFORM_Z (expand_s16_untied, svint16_t,
+               z0 = svexpand_s16 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s32.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s32.c
new file mode 100644 (file)
index 0000000..54785d6
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_s32_tied1:
+**     expand  z0\.s, p0, z0\.s
+**     ret
+*/
+TEST_UNIFORM_Z (expand_s32_tied1, svint32_t,
+               z0 = svexpand_s32 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_s32_untied:
+**     expand  z0\.s, p0, z1\.s
+**     ret
+*/
+TEST_UNIFORM_Z (expand_s32_untied, svint32_t,
+               z0 = svexpand_s32 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s64.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s64.c
new file mode 100644 (file)
index 0000000..3693081
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_s64_tied1:
+**     expand  z0\.d, p0, z0\.d
+**     ret
+*/
+TEST_UNIFORM_Z (expand_s64_tied1, svint64_t,
+               z0 = svexpand_s64 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_s64_untied:
+**     expand  z0\.d, p0, z1\.d
+**     ret
+*/
+TEST_UNIFORM_Z (expand_s64_untied, svint64_t,
+               z0 = svexpand_s64 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s8.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_s8.c
new file mode 100644 (file)
index 0000000..ba8e0cb
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_s8_tied1:
+**     expand  z0\.b, p0, z0\.b
+**     ret
+*/
+TEST_UNIFORM_Z (expand_s8_tied1, svint8_t,
+               z0 = svexpand_s8 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_s8_untied:
+**     expand  z0\.b, p0, z1\.b
+**     ret
+*/
+TEST_UNIFORM_Z (expand_s8_untied, svint8_t,
+               z0 = svexpand_s8 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u16.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u16.c
new file mode 100644 (file)
index 0000000..0323a71
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_u16_tied1:
+**     expand  z0\.h, p0, z0\.h
+**     ret
+*/
+TEST_UNIFORM_Z (expand_u16_tied1, svuint16_t,
+               z0 = svexpand_u16 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_u16_untied:
+**     expand  z0\.h, p0, z1\.h
+**     ret
+*/
+TEST_UNIFORM_Z (expand_u16_untied, svuint16_t,
+               z0 = svexpand_u16 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u32.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u32.c
new file mode 100644 (file)
index 0000000..a5c5d58
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_u32_tied1:
+**     expand  z0\.s, p0, z0\.s
+**     ret
+*/
+TEST_UNIFORM_Z (expand_u32_tied1, svuint32_t,
+               z0 = svexpand_u32 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_u32_untied:
+**     expand  z0\.s, p0, z1\.s
+**     ret
+*/
+TEST_UNIFORM_Z (expand_u32_untied, svuint32_t,
+               z0 = svexpand_u32 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u64.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u64.c
new file mode 100644 (file)
index 0000000..3193afb
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_u64_tied1:
+**     expand  z0\.d, p0, z0\.d
+**     ret
+*/
+TEST_UNIFORM_Z (expand_u64_tied1, svuint64_t,
+               z0 = svexpand_u64 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_u64_untied:
+**     expand  z0\.d, p0, z1\.d
+**     ret
+*/
+TEST_UNIFORM_Z (expand_u64_untied, svuint64_t,
+               z0 = svexpand_u64 (p0, z1),
+               z0 = svexpand (p0, z1))
diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u8.c b/gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/expand_u8.c
new file mode 100644 (file)
index 0000000..1c89138
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do assemble { target aarch64_asm_sve2p2_ok } } */
+/* { dg-do compile { target { ! aarch64_asm_sve2p2_ok } } } */
+/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
+
+#include "test_sve_acle.h"
+
+#pragma GCC target "+sve2p2"
+#ifdef STREAMING_COMPATIBLE
+#pragma GCC target "+sme2p2"
+#endif
+
+/*
+** expand_u8_tied1:
+**     expand  z0\.b, p0, z0\.b
+**     ret
+*/
+TEST_UNIFORM_Z (expand_u8_tied1, svuint8_t,
+               z0 = svexpand_u8 (p0, z0),
+               z0 = svexpand (p0, z0))
+
+/*
+** expand_u8_untied:
+**     expand  z0\.b, p0, z1\.b
+**     ret
+*/
+TEST_UNIFORM_Z (expand_u8_untied, svuint8_t,
+               z0 = svexpand_u8 (p0, z1),
+               z0 = svexpand (p0, z1))