amdgcn: fix vcc clobber in vector load/store
authorAndrew Stubbs <ams@codesourcery.com>
Wed, 13 May 2020 15:05:54 +0000 (16:05 +0100)
committerAndrew Stubbs <ams@codesourcery.com>
Thu, 14 May 2020 19:45:09 +0000 (20:45 +0100)
commit75d0b3d728864116144f9db52b156c573ae8d879
treefb76ce9b448d07876e380edabe7ca129a0d96141
parent9056cd80351c65c3b9a3257644236f2007c46a3f
amdgcn: fix vcc clobber in vector load/store

This switches the code that expands scalar addresses to vectors of addresses
from using VCC to using CC_SAVE_REG, for the lo-part to hi-part carry values.
These were fine in code expanded in earlier passes, but addresses expanded
late, such as for stack spills or reloads, could clobber live VCC values,
causing execution failures.

This is the first target-specific testcase for GCN, so the new .exp file is
included.

2020-05-14  Andrew Stubbs  <ams@codesourcery.com>

gcc/
* config/gcn/gcn-valu.md (add<mode>3_zext_dup): Change to a
define_expand, and rename the original to ...
(add<mode>3_vcc_zext_dup): ... this, and add a custom VCC operand.
(add<mode>3_zext_dup_exec): Likewise, with ...
(add<mode>3_vcc_zext_dup_exec): ... this.
(add<mode>3_zext_dup2): Likewise, with ...
(add<mode>3_zext_dup_exec): ... this.
(add<mode>3_zext_dup2_exec): Likewise, with ...
(add<mode>3_zext_dup2): ... this.
* config/gcn/gcn.c (gcn_expand_scalar_to_vector_address): Switch
addv64di3_zext* calls to use addv64di3_vcc_zext*.

gcc/testsuite/
* testsuite/gcc.target/gcn/gcn.exp: New file.
* testsuite/gcc.target/gcn/vcc-clobber.c: New file.
gcc/ChangeLog
gcc/config/gcn/gcn-valu.md
gcc/config/gcn/gcn.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/gcn/gcn.exp [new file with mode: 0644]
gcc/testsuite/gcc.target/gcn/vcc-clobber.c [new file with mode: 0644]