[AArch64] Canonicalise SVE predicate constants

Programming / Compilers / GCC - rsandifo [138bc75d-0d04-0410-961f-82ee72b054a4] - 14 August 2019 08:03 EDT

This patch makes sure that we build all SVE predicate constants as
VNx16BI before RA, to encourage similar constants to be reused between modes. This is also useful for the ACLE, where the single predicate type svbool_t is always a VNx16BI.

Also, and again to encourage reuse, the patch makes us use a .B PTRUE for all ptrue-predicated operations, rather than (for example) using a .S PTRUE for 32-bit operations and a .D PTRUE for 64-bit operations.

The only current case in which a .H, .S or .D operation needs to be predicated by a "strict" .H/.S/.D PTRUE is the PTEST in a conditional branch, which an earlier patch fixed to use an appropriate VNx16BI constant.

2019-08-14 Richard Sandiford

gcc/
- config/aarch64/aarch64.c (aarch64_target_reg): New function. (aarch64_emit_set_immediate): Likewise. (aarch64_ptrue_reg): Build a VNx16BI constant and then bitcast it. (aarch64_pfalse_reg): Likewise. (aarch64_convert_sve_data_to_pred): New function. (aarch64_sve_move_pred_via_while): Take an optional target register and the required register mode. (aarch64_expand_sve_const_pred_1): New function. (aarch64_expand_sve_const_pred): Likewise. (aarch64_expand_mov_immediate): Build an all-true predicate if the significant bits of the immediate are all true. Use aarch64_expand_sve_const_pred for all compile-time predicate constants. (aarch64_mov_operand_p): Force predicate constants to be VNx16BI before register allocation.
- config/aarch64/aarch64-sve.md (*vec_duplicate_reg): Use a VNx16BI PTRUE when splitting the memory alternative. (vec_duplicate): Update accordingly. (*pred_cmp): Rename to... (@aarch64_pred_cmp): ...this.

gcc/testsuite/
- gcc.target/aarch64/sve/spill_4.c: Expect all ptrues to be .Bs.
- gcc.target/aarch64/sve/single_1.c: Likewise.
- gcc.target/aarch64/sve/single_2.c: Likewise.
- gcc.target/aarch64/sve/single_3.c: Likewise.
- gcc.target/aarch64/sve/single_4.c: Likewise.

2f278c6c653 [AArch64] Canonicalise SVE predicate constants
gcc/ChangeLog | 22 +++
gcc/config/aarch64/aarch64-sve.md | 13 +-
gcc/config/aarch64/aarch64.c | 182 +++++++++++++++++++++---
gcc/testsuite/ChangeLog | 8 ++
gcc/testsuite/gcc.target/aarch64/sve/single_1.c | 5 +-
gcc/testsuite/gcc.target/aarch64/sve/single_2.c | 5 +-
gcc/testsuite/gcc.target/aarch64/sve/single_3.c | 5 +-
gcc/testsuite/gcc.target/aarch64/sve/single_4.c | 5 +-
gcc/testsuite/gcc.target/aarch64/sve/spill_4.c | 5 +-
9 files changed, 204 insertions(+), 46 deletions(-)

Upstream: gcc.gnu.org


  • Share