[AArch64] Use SVE binary immediate instructions for conditional arithmetic
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 15 Aug 2019 08:18:03 +0000 (08:18 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 15 Aug 2019 08:18:03 +0000 (08:18 +0000)
commita19ba9e1b15d248e5a13ee773f4acd4ae29fdeaa
tree585d320966057caeb76464388dcb7d0d8a8c20e4
parentbf30864e4c241e50585745af504b09db55f7f08b
[AArch64] Use SVE binary immediate instructions for conditional arithmetic

This patch lets us use the immediate forms of FADD, FSUB, FSUBR,
FMUL, FMAXNM and FMINNM for conditional arithmetic.  (We already
use them for normal unconditional arithmetic.)

2019-08-15  Richard Sandiford  <richard.sandiford@arm.com>
    Kugan Vivekanandarajah  <kugan.vivekanandarajah@linaro.org>

gcc/
* config/aarch64/aarch64.c (aarch64_print_vector_float_operand):
Print 2.0 naturally.
(aarch64_sve_float_mul_immediate_p): Return true for 2.0.
* config/aarch64/predicates.md
(aarch64_sve_float_negated_arith_immediate): New predicate,
renamed from aarch64_sve_float_arith_with_sub_immediate.
(aarch64_sve_float_arith_with_sub_immediate): Test for both
positive and negative constants.
(aarch64_sve_float_arith_with_sub_operand): Redefine as a register
or an aarch64_sve_float_arith_with_sub_immediate.
* config/aarch64/constraints.md (vsN): Use
aarch64_sve_float_negated_arith_immediate.
* config/aarch64/iterators.md (SVE_COND_FP_BINARY_I1): New int
iterator.
(sve_pred_fp_rhs2_immediate): New int attribute.
* config/aarch64/aarch64-sve.md
(cond_<SVE_COND_FP_BINARY:optab><SVE_F:mode>): Use
sve_pred_fp_rhs1_operand and sve_pred_fp_rhs2_operand.
(*cond_<SVE_COND_FP_BINARY_I1:optab><SVE_F:mode>_2_const)
(*cond_<SVE_COND_FP_BINARY_I1:optab><SVE_F:mode>_any_const)
(*cond_add<SVE_F:mode>_2_const, *cond_add<SVE_F:mode>_any_const)
(*cond_sub<mode>_3_const, *cond_sub<mode>_any_const): New patterns.

gcc/testsuite/
* gcc.target/aarch64/sve/cond_fadd_1.c: New test.
* gcc.target/aarch64/sve/cond_fadd_1_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fadd_2.c: Likewise.
* gcc.target/aarch64/sve/cond_fadd_2_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fadd_3.c: Likewise.
* gcc.target/aarch64/sve/cond_fadd_3_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fadd_4.c: Likewise.
* gcc.target/aarch64/sve/cond_fadd_4_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fsubr_1.c: Likewise.
* gcc.target/aarch64/sve/cond_fsubr_1_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fsubr_2.c: Likewise.
* gcc.target/aarch64/sve/cond_fsubr_2_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fsubr_3.c: Likewise.
* gcc.target/aarch64/sve/cond_fsubr_3_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fsubr_4.c: Likewise.
* gcc.target/aarch64/sve/cond_fsubr_4_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_1.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_1_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_2.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_2_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_3.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_3_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_4.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_4_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_1.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_1_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_2.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_2_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_3.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_3_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_4.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_4_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmul_1.c: Likewise.
* gcc.target/aarch64/sve/cond_fmul_1_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmul_2.c: Likewise.
* gcc.target/aarch64/sve/cond_fmul_2_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmul_3.c: Likewise.
* gcc.target/aarch64/sve/cond_fmul_3_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmul_4.c: Likewise.
* gcc.target/aarch64/sve/cond_fmul_4_run.c: Likewise.

Co-Authored-By: Kugan Vivekanandarajah <kuganv@linaro.org>
From-SVN: r274508
47 files changed:
gcc/ChangeLog
gcc/config/aarch64/aarch64-sve.md
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/constraints.md
gcc/config/aarch64/iterators.md
gcc/config/aarch64/predicates.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/sve/cond_fadd_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fadd_1_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fadd_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fadd_2_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fadd_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fadd_3_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fadd_4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fadd_4_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmaxnm_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmaxnm_1_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmaxnm_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmaxnm_2_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmaxnm_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmaxnm_3_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmaxnm_4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmaxnm_4_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fminnm_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fminnm_1_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fminnm_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fminnm_2_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fminnm_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fminnm_3_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fminnm_4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fminnm_4_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmul_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmul_1_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmul_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmul_2_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmul_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmul_3_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmul_4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fmul_4_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fsubr_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fsubr_1_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fsubr_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fsubr_2_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fsubr_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fsubr_3_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fsubr_4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/cond_fsubr_4_run.c [new file with mode: 0644]