aarch64: Treat p12-p15 as call-preserved in SVE PCS functions
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 16 Mar 2020 15:26:35 +0000 (15:26 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 18 Mar 2020 11:24:59 +0000 (11:24 +0000)
commitcb26919c857f002fc17f7c478e7c8f0eb2a7c9b2
tree99c7e79633a68dac54f052ad56a7f4ec2f81dbba
parent4da9288745d8f9c0d6918b685522e89c277020c7
aarch64: Treat p12-p15 as call-preserved in SVE PCS functions

Due to a stupid mistake that I can't really explain, I'd got the
treatment of p12-p15 mixed up when adding support for the SVE PCS.
The registers are supposed to be call-preserved rather than
call-clobbered.

The fix is simple, but it has quite a big effect on the PCS tests
(as it should!).

2020-03-18  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64.c (aarch64_sve_abi): Treat p12-p15 as
call-preserved for SVE PCS functions.
(aarch64_layout_frame): Cope with up to 12 predicate save slots.
Optimize the case in which there are no following vector save slots.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/cpy_1.c: Leave gaps for in the
check-function-bodies patterns for p15 to be saved.
* gcc.target/aarch64/sve/pcs/args_1.c (callee_pred): Expect two
predicates to be saved.
* gcc.target/aarch64/sve/pcs/saves_1_be_nowrap.c (test_1): Expect
p12-p15 to be saved and restored.
(test_2): Remove p12-p15 from the clobber list.
* gcc.target/aarch64/sve/pcs/saves_1_be_wrap.c (test_1): Expect
p12-p15 to be saved and restored.
(test_2): Remove p12-p15 from the clobber list.
* gcc.target/aarch64/sve/pcs/saves_1_le_nowrap.c (test_1): Expect
p12-p15 to be saved and restored.
(test_2): Remove p12-p15 from the clobber list.
* gcc.target/aarch64/sve/pcs/saves_1_le_wrap.c (test_1): Expect
p12-p15 to be saved and restored.
(test_2): Remove p12-p15 from the clobber list.
* gcc.target/aarch64/sve/pcs/saves_2_be_nowrap.c: Expect p12-p15
to be saved and restored.
* gcc.target/aarch64/sve/pcs/saves_2_be_wrap.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_2_le_nowrap.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_2_le_wrap.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_4_be.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_4_le.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_5_be.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_5_le.c: Likewise.
* gcc.target/aarch64/sve/pcs/stack_clash_1.c (test_1): Likewise.
(test_2): Remove p12-p15 from the clobber list.
* gcc.target/aarch64/sve/pcs/stack_clash_1_128.c (test_1): Expect
p12-p15 to be saved and restored.
(test_2): Remove p12-p15 from the clobber list.
* gcc.target/aarch64/sve/pcs/stack_clash_1_256.c (test_1): Expect
p12-p15 to be saved and restored.
(test_2): Remove p12-p15 from the clobber list.
(test_4): Expect only 16 bytes of stack to be allocated for the
predicate save slot.
* gcc.target/aarch64/sve/pcs/stack_clash_1_512.c (test_1): Expect
p12-p15 to be saved and restored.
(test_2): Remove p12-p15 from the clobber list.
(test_4): Expect only 16 bytes of stack to be allocated for the
predicate save slot.
* gcc.target/aarch64/sve/pcs/stack_clash_1_1024.c (test_1): Expect
p12-p15 to be saved and restored.
(test_2): Remove p12-p15 from the clobber list.
(test_4): Expect only 16 bytes of stack to be allocated for the
predicate save slot.
* gcc.target/aarch64/sve/pcs/stack_clash_1_2048.c (test_1): Expect
p12-p15 to be saved and restored.
(test_2): Remove p12-p15 from the clobber list.
(test_4): Expect only 32 bytes of stack to be allocated for the
predicate save slot.
* gcc.target/aarch64/sve/pcs/stack_clash_2_256.c: Use z16 rather
than p4 to create a vector-sized save slot.
* gcc.target/aarch64/sve/pcs/stack_clash_2_512.c: Likewise.
* gcc.target/aarch64/sve/pcs/stack_clash_2_1024.c: Likewise.
* gcc.target/aarch64/sve/pcs/stack_clash_2_2048.c: Likewise.
27 files changed:
gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/sve/acle/general/cpy_1.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/args_1.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_1_be_nowrap.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_1_be_wrap.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_1_le_nowrap.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_1_le_wrap.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_2_be_nowrap.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_2_be_wrap.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_2_le_nowrap.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_2_le_wrap.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_4_be.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_4_le.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_5_be.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/saves_5_le.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_1.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_1_1024.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_1_128.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_1_2048.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_1_256.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_1_512.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_2_1024.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_2_2048.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_2_256.c
gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_2_512.c