[AArch64] Add a new CC mode for SVE conditions
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 18 Jun 2019 14:54:34 +0000 (14:54 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 18 Jun 2019 14:54:34 +0000 (14:54 +0000)
commit57d6f4d04d438522dc03488ca31f71b4b7b904c8
treedd650f90d4926e5b59e3f819ee22468af7c43e87
parentea403d8bb5129632aac4d2f270566d2d0073a8ae
[AArch64] Add a new CC mode for SVE conditions

The SVE ACLE patches need to introduce a new CC_NZC mode for the
conditions that can be tested after a PTRUE.  In particular, LT needs
to map to "mi"/"first" and GE to "pl"/"nfrst", instead of the normal
CC mapping.

Another advantage of using a separate mode is that we can print the SVE
names of the conditions, which makes the output a bit easier to read.
It therefore seems like an independent improvement that can go in now.

The patch also avoids using (compare X (const_int 0)), because that gets
folded away when used with LTU and GEU ("cc"/"last" and "cs"/"nlast").
Just using an unspec should be OK.

The full set of conditions can't be tested without other SVE ACLE patches.

2019-06-18  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64-modes.def (CC_NZC): New CC_MODE.
* config/aarch64/aarch64-sve.md (*<optab><mode>3_cc)
(ptest_ptrue<mode>, while_ult<GPI:mode><PRED_ALL:mode>)
(*while_ult<GPI:mode><PRED_ALL:mode>_cc, *cmp<cmp_op><mode>)
(*cmp<cmp_op><mode>_ptest, *cmp<cmp_op><mode>_cc)
(*pred_cmp<cmp_op><mode>_combine, *pred_cmp<cmp_op><mode>)
(vec_cmp<mode><vpred>, vec_cmpu<mode><vpred>, cbranch<mode>4):
Use CC_NZC instead of CC.
* config/aarch64/aarch64.md (condjump): Print a '.' in SVE conditions.
* config/aarch64/aarch64.c (aarch64_sve_condition_codes): New variable.
(aarch64_print_operand): Handle E_CC_NZCmode.
(aarch64_emit_sve_ptrue_op_cc): Use gen_set_clobber_cc_nzc instead
of gen_set_clobber_cc.

gcc/testsuite/
* gcc.target/aarch64/sve/struct_vect_18.c: Allow branches to
contain dots.
* gcc.target/aarch64/sve/struct_vect_19.c: Likewise.
* gcc.target/aarch64/sve/struct_vect_20.c: Likewise.
* gcc.target/aarch64/sve/struct_vect_21.c: Likewise.
* gcc.target/aarch64/sve/struct_vect_22.c: Likewise.
* gcc.target/aarch64/sve/struct_vect_23.c: Likewise.
* gcc.target/aarch64/sve/unroll-1.c: Likewise.
* gcc.target/aarch64/sve/while_1.c: Check for b.any.

From-SVN: r272427
14 files changed:
gcc/ChangeLog
gcc/config/aarch64/aarch64-modes.def
gcc/config/aarch64/aarch64-sve.md
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/sve/struct_vect_18.c
gcc/testsuite/gcc.target/aarch64/sve/struct_vect_19.c
gcc/testsuite/gcc.target/aarch64/sve/struct_vect_20.c
gcc/testsuite/gcc.target/aarch64/sve/struct_vect_21.c
gcc/testsuite/gcc.target/aarch64/sve/struct_vect_22.c
gcc/testsuite/gcc.target/aarch64/sve/struct_vect_23.c
gcc/testsuite/gcc.target/aarch64/sve/unroll-1.c
gcc/testsuite/gcc.target/aarch64/sve/while_1.c