]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Add support for unpacked SVE FP conditional binary arithmetic
authorSpencer Abson <spencer.abson@arm.com>
Tue, 29 Jul 2025 16:37:26 +0000 (16:37 +0000)
committerSpencer Abson <spencer.abson@arm.com>
Tue, 29 Jul 2025 17:21:02 +0000 (17:21 +0000)
commit241380c6d632eb6d6595c0976663a29a9be47507
treee7fef4fa5bb2ab3e5afb530995556028aea99432
parentc6d1f58da7eb72e8bac307d342e4655012b36a89
aarch64: Add support for unpacked SVE FP conditional binary arithmetic

This patch extends the expander for conditional smax, smin, add, sub, mul,
min, max, and div to support partial SVE FP modes.

If exceptions from undefined vector elements must be suppressed, this
expansion converts the container-level predicate to an element-level one, and
ensures that these elements are inactive for the operation.  In practice, this
is a predicate AND with the existing mask and a container-size PTRUE.

gcc/ChangeLog:

* config/aarch64/aarch64-protos.h (aarch64_sve_emit_masked_fp_pred):
Declare.
* config/aarch64/aarch64-sve.md (and<mode>3):  Change this to...
(@and<mode>3): ...this, so that we can use gen_and3.
(@cond_<optab><mode>): Extend from SVE_FULL_F_B16B16 to SVE_F_B16B16,
use aarch64_predicate_operand.
(*cond_<optab><mode>_2_strict): Likewise.
(*cond_<optab><mode>_3_strict): Likewise.
(*cond_<optab><mode>_any_strict): Likwise.
(*cond_<optab><mode>_2_const_strict): Extend from SVE_FULL_F to SVE_F,
use aarch64_predicate_operand.
(*cond_<optab><mode>_any_const_strict): Likewise.
(*cond_sub<mode>_3_const_strict): Likwise.
(*cond_sub<mode>_const_strict): Likewise.
(*vcond_mask_<mode><vpred>): Use aarch64_predicate_operand, and update
the comment here.
* config/aarch64/aarch64.cc (aarch64_sve_emit_masked_fp_pred): New
function.  Helper to mask the predicate in conditional expanders.

gcc/testsuite/ChangeLog:

* g++.target/aarch64/sve/unpacked_cond_binary_bf16_2.C: New test.
* gcc.target/aarch64/sve/unpacked_cond_builtin_fmax_2.c: Likewise.
* gcc.target/aarch64/sve/unpacked_cond_builtin_fmin_2.c: Likewise.
* gcc.target/aarch64/sve/unpacked_cond_fadd_2.c: Likewise.
* gcc.target/aarch64/sve/unpacked_cond_fdiv_2.c: Likewise.
* gcc.target/aarch64/sve/unpacked_cond_fmaxnm_2.c: Likewise.
* gcc.target/aarch64/sve/unpacked_cond_fminnm_2.c: Likewise.
* gcc.target/aarch64/sve/unpacked_cond_fmul_2.c: Likewise.
* gcc.target/aarch64/sve/unpacked_cond_fsubr_2.c: Likewise.
12 files changed:
gcc/config/aarch64/aarch64-protos.h
gcc/config/aarch64/aarch64-sve.md
gcc/config/aarch64/aarch64.cc
gcc/testsuite/g++.target/aarch64/sve/unpacked_cond_binary_bf16_2.C [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/unpacked_cond_builtin_fmax_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/unpacked_cond_builtin_fmin_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/unpacked_cond_fadd_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/unpacked_cond_fdiv_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/unpacked_cond_fmaxnm_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/unpacked_cond_fminnm_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/unpacked_cond_fmul_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/unpacked_cond_fsubr_2.c [new file with mode: 0644]