aarch64: Ensure ZT0 is zeroed in a new-ZT0 function
commit22f0cf36ec0ad4ec76b50cd87eaab925bda74df8
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 21 Feb 2024 11:12:28 +0000 (21 11:12 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 21 Feb 2024 11:12:28 +0000 (21 11:12 +0000)
tree3eac4385902196b3666916457385c72a9e7c9e55
parent58930e9fd1816c2a71c4f4e54a82e870d3afe10a
aarch64: Ensure ZT0 is zeroed in a new-ZT0 function

ACLE guarantees that a function like:

  __arm_new("zt0") foo() { ... }

will start with ZT0 equal to zero.  I'd forgotten to enforce that
after commiting a lazy save.  After such a save, we should zero
ZA iff the function has ZA state and zero ZT0 iff the function
has ZT0 state.

gcc/
* config/aarch64/aarch64.cc (aarch64_mode_emit_local_sme_state):
In the code that commits a lazy save, only zero ZA if the function
has ZA state.  Similarly zero ZT0 if the function has ZT0 state.

gcc/testsuite/
* gcc.target/aarch64/sme/zt0_state_5.c (test3): Expect ZT0 rather
than ZA to be zeroed.
(test5): Remove zeroing of ZA.
gcc/config/aarch64/aarch64.cc
gcc/testsuite/gcc.target/aarch64/sme/zt0_state_5.c