]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Require SVE2 and/or SME2 for SVE FAMINMAX intrinsics
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 31 Oct 2024 19:52:07 +0000 (19:52 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 31 Oct 2024 19:52:07 +0000 (19:52 +0000)
After the previous patch, we can now accurately model the ISA
requirements for the SVE FAMINMAX intrinsics.  They can be used
in non-streaming mode if TARGET_SVE2 and in streaming mode if
TARGET_SME2 (with both cases also requiring TARGET_FAMINMAX).
They can be used in streaming-compatible mode if TARGET_SVE2
&& TARGET_SME2.

Also, Kyrill pointed out in the original review of the FAMINMAX
support that it would be more consistent to define the rtl patterns
in aarch64-sve2.md rather than aarch64-sve.md, so the pushed patch
did that.  This patch moves the definitions of the intrinsics to
the sve2 files too, for consistency.

gcc/
* config/aarch64/aarch64-sve-builtins-base.cc (svmax, svamin): Move
definitions to...
* config/aarch64/aarch64-sve-builtins-sve2.cc: ...here.
* config/aarch64/aarch64-sve-builtins-base.def (svmax, svamin): Move
definitions to...
* config/aarch64/aarch64-sve-builtins-sve2.def: ...here.  Require
SME2 in streaming mode.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/amin_1.c: New test.
* gcc.target/aarch64/sve2/acle/asm/amax_f16.c: Enabled sve2 and
(for streaming mode) sme2.
* gcc.target/aarch64/sve2/acle/asm/amax_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/amax_f64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/amin_f16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/amin_f32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/amin_f64.c: Likewise.

gcc/config/aarch64/aarch64-sve-builtins-base.cc
gcc/config/aarch64/aarch64-sve-builtins-base.def
gcc/config/aarch64/aarch64-sve-builtins-sve2.cc
gcc/config/aarch64/aarch64-sve-builtins-sve2.def
gcc/testsuite/gcc.target/aarch64/sve/acle/general/amin_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/amax_f16.c
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/amax_f32.c
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/amax_f64.c
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/amin_f16.c
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/amin_f32.c
gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/amin_f64.c

index fe16d93adcd1fb5047baf79bc66e662f22c48d4d..1c9f515a52cb48811d2aa9abc0103dfbc40f1e55 100644 (file)
@@ -3184,10 +3184,6 @@ FUNCTION (svadrb, svadr_bhwd_impl, (0))
 FUNCTION (svadrd, svadr_bhwd_impl, (3))
 FUNCTION (svadrh, svadr_bhwd_impl, (1))
 FUNCTION (svadrw, svadr_bhwd_impl, (2))
-FUNCTION (svamax, cond_or_uncond_unspec_function,
-         (UNSPEC_COND_FAMAX, UNSPEC_FAMAX))
-FUNCTION (svamin, cond_or_uncond_unspec_function,
-         (UNSPEC_COND_FAMIN, UNSPEC_FAMIN))
 FUNCTION (svand, rtx_code_function, (AND, AND))
 FUNCTION (svandv, reduction, (UNSPEC_ANDV))
 FUNCTION (svasr, rtx_code_function, (ASHIFTRT, ASHIFTRT))
index edfe2574507ef311391d042a270104f4b1a6f397..da2a0e41aa5dfcd321cf5b5f9be86001179c666a 100644 (file)
@@ -368,8 +368,3 @@ 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 ssve (AARCH64_FL_FAMINMAX)
-DEF_SVE_FUNCTION (svamax, binary_opt_single_n, all_float, mxz)
-DEF_SVE_FUNCTION (svamin, binary_opt_single_n, all_float, mxz)
-#undef REQUIRED_EXTENSIONS
index d29c2209fdfe2392c897ac79b0fb9a34a0575d72..64f86035c30e76229decff68a2f24ded63fd3153 100644 (file)
@@ -591,6 +591,10 @@ FUNCTION (svaesd, fixed_insn_function, (CODE_FOR_aarch64_sve2_aesd))
 FUNCTION (svaese, fixed_insn_function, (CODE_FOR_aarch64_sve2_aese))
 FUNCTION (svaesimc, fixed_insn_function, (CODE_FOR_aarch64_sve2_aesimc))
 FUNCTION (svaesmc, fixed_insn_function, (CODE_FOR_aarch64_sve2_aesmc))
+FUNCTION (svamax, cond_or_uncond_unspec_function,
+         (UNSPEC_COND_FAMAX, UNSPEC_FAMAX))
+FUNCTION (svamin, cond_or_uncond_unspec_function,
+         (UNSPEC_COND_FAMIN, UNSPEC_FAMIN))
 FUNCTION (svbcax, CODE_FOR_MODE0 (aarch64_sve2_bcax),)
 FUNCTION (svbdep, unspec_based_function, (UNSPEC_BDEP, UNSPEC_BDEP, -1))
 FUNCTION (svbext, unspec_based_function, (UNSPEC_BEXT, UNSPEC_BEXT, -1))
index 345a7621b6f94057c83f49e1eaae39bdb8e9a970..e4021559f36d509eed630d2c443c94b5e745e814 100644 (file)
@@ -283,3 +283,10 @@ DEF_SVE_FUNCTION (svwhilelt, compare_scalar_count, while_x_c, none)
 DEF_SVE_FUNCTION_GS (svzip, unaryxn, all_data, x24, none)
 DEF_SVE_FUNCTION_GS (svzipq, unaryxn, all_data, x24, none)
 #undef REQUIRED_EXTENSIONS
+
+#define REQUIRED_EXTENSIONS \
+  sve_and_sme (AARCH64_FL_SVE2 | AARCH64_FL_FAMINMAX, \
+              AARCH64_FL_SME2 | AARCH64_FL_FAMINMAX)
+DEF_SVE_FUNCTION (svamax, binary_opt_single_n, all_float, mxz)
+DEF_SVE_FUNCTION (svamin, binary_opt_single_n, all_float, mxz)
+#undef REQUIRED_EXTENSIONS
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/amin_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/amin_1.c
new file mode 100644 (file)
index 0000000..e2c28cf
--- /dev/null
@@ -0,0 +1,9 @@
+#include <arm_sve.h>
+
+#pragma GCC target "+nosme2+sve2+faminmax+sme"
+
+svfloat32_t
+foo (svfloat32_t x, svfloat32_t y) __arm_streaming
+{
+  return svamin_x (svptrue_b8 (), x, y); /* { dg-error {ACLE function '[^']*' requires ISA extension 'sme2'} } */
+}
index 3d99e4bd92d795125dc7faf8fd5ed828e3aa3b7f..43c1e4d9c5148ef62e9ed1874f4a8e554d632ce0 100644 (file)
@@ -3,7 +3,10 @@
 
 #include "test_sve_acle.h"
 
-#pragma GCC target "+sve+faminmax"
+#pragma GCC target "+sve2+faminmax"
+#if STREAMING_COMPATIBLE
+#pragma GCC target "+sme2"
+#endif
 
 /*
 ** amax_f16_m_tied1:
index 686996625fba09917abff1395ad736c40532a757..56e6b7333a083f0189b3da721ddff17bd63683b9 100644 (file)
@@ -3,7 +3,10 @@
 
 #include "test_sve_acle.h"
 
-#pragma GCC target "+sve+faminmax"
+#pragma GCC target "+sve2+faminmax"
+#if STREAMING_COMPATIBLE
+#pragma GCC target "+sme2"
+#endif
 
 /*
 ** amax_f32_m_tied1:
index e0f0ac32e54d563e6859f653cf480645b3aeef13..458c70517025234efe84dded52c15fdb14259ccc 100644 (file)
@@ -3,7 +3,10 @@
 
 #include "test_sve_acle.h"
 
-#pragma GCC target "+sve+faminmax"
+#pragma GCC target "+sve2+faminmax"
+#if STREAMING_COMPATIBLE
+#pragma GCC target "+sme2"
+#endif
 
 /*
 ** amax_f64_m_tied1:
index f93aed6cba53eda092ce5b42d2a7f3894e7f01c0..4c36c425493e40e040b153187f238783431b0f19 100644 (file)
@@ -3,7 +3,10 @@
 
 #include "test_sve_acle.h"
 
-#pragma GCC target "+sve+faminmax"
+#pragma GCC target "+sve2+faminmax"
+#if STREAMING_COMPATIBLE
+#pragma GCC target "+sme2"
+#endif
 
 /*
 ** amin_f16_m_tied1:
index cc1a343160ebdf19a1d6563c23d4549f269d473a..56943fc065788aad0958ade562d7e6c038a06acb 100644 (file)
@@ -3,7 +3,10 @@
 
 #include "test_sve_acle.h"
 
-#pragma GCC target "+sve+faminmax"
+#pragma GCC target "+sve2+faminmax"
+#if STREAMING_COMPATIBLE
+#pragma GCC target "+sme2"
+#endif
 
 /*
 ** amin_f32_m_tied1:
index b5133f12950a80243099d3b73984a37cf55452ce..a93f7d687f555cd8b7268718a3c7357e4c583c3e 100644 (file)
@@ -3,7 +3,10 @@
 
 #include "test_sve_acle.h"
 
-#pragma GCC target "+sve+faminmax"
+#pragma GCC target "+sve2+faminmax"
+#if STREAMING_COMPATIBLE
+#pragma GCC target "+sme2"
+#endif
 
 /*
 ** amin_f64_m_tied1: