aarch64: Require SVE2 and/or SME2 for SVE FAMINMAX intrinsics

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.
This commit is contained in:
Richard Sandiford 2024-10-31 19:52:07 +00:00
parent ede97598e2
commit a00a0e34b8
11 changed files with 44 additions and 15 deletions

View 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))

View 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

View 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))

View 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

View file

@ -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'} } */
}

View 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:

View 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:

View 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:

View 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:

View 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:

View 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: