[AArch64] Rework SVE integer comparisons

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

The remaining uses of UNSPEC_MERGE_PTRUE were in integer comparison patterns. These aren't actually merging operations but zeroing ones, although there's no practical difference when the predicate is a PTRUE.

All comparisons produced by expand are predicated on a PTRUE, although we try to pattern-match a compare-and-AND as a predicated comparison during combine.

Like previous patches, this one rearranges things in a way that works better with the ACLE, where the initial predicate might or might not be a PTRUE. The new patterns use UNSPEC_PRED_Z to represent zeroing predication, with a aarch64_sve_ptrue_flag to record whether the predicate is all-true (as for UNSPEC_PTEST).

See the block comment in the patch for more details.

2019-08-14 Richard Sandiford

- config/aarch64/aarch64-protos.h (aarch64_sve_same_pred_for_ptest_p): Declare.
- config/aarch64/aarch64.c (aarch64_sve_same_pred_for_ptest_p) (aarch64_sve_emit_int_cmp): New functions. (aarch64_convert_sve_data_to_pred): Use aarch64_sve_emit_int_cmp. (aarch64_sve_cmp_operand_p, aarch64_emit_sve_ptrue_op_cc): Delete. (aarch64_expand_sve_vec_cmp_int): Use aarch64_sve_emit_int_cmp.
- config/aarch64/aarch64.md (UNSPEC_MERGE_PTRUE): Delete. (UNSPEC_PRED_Z): New unspec. (set_clobber_cc_nzc): Delete.
- config/aarch64/aarch64-sve.md: Add a block comment about UNSPEC_PRED_Z. (*cmp): Rename to... (@aarch64_pred_cmp): ...this, replacing the old pattern with that name. Use UNSPEC_PRED_Z instead of UNSPEC_MERGE_PTRUE. (*cmp_cc): Use UNSPEC_PRED_Z instead of UNSPEC_MERGE_PTRUE. Use aarch64_sve_same_pred_for_ptest_p to check for compatible predicates. (*cmp_ptest): Likewise. (*cmp_and): Match a known-ptrue UNSPEC_PRED_Z instead of UNSPEC_MERGE_PTRUE. Split into the new form of predicated comparisons above.

2afd4668e80 [AArch64] Rework SVE integer comparisons
gcc/ChangeLog | 26 ++++++
gcc/config/aarch64/aarch64-protos.h | 1 +
gcc/config/aarch64/aarch64-sve.md | 155 ++++++++++++++++++++++++------------
gcc/config/aarch64/aarch64.c | 108 +++++++++++--------------
gcc/config/aarch64/aarch64.md | 8 +-
5 files changed, 179 insertions(+), 119 deletions(-)

Upstream: gcc.gnu.org

  • Share