]> git.ipfire.org Git - thirdparty/gcc.git/commit
amdgcn: Don't clobber VCC if we don't need to
authorAndrew Stubbs <ams@baylibre.com>
Fri, 11 Jul 2025 13:41:19 +0000 (13:41 +0000)
committerAndrew Stubbs <ams@baylibre.com>
Wed, 30 Jul 2025 12:57:13 +0000 (12:57 +0000)
commit476ff6a043c3aad033e9b450172dbe7621ff3157
tree88c3d161d87883dfc4e19ca5a468d403ebb02783
parent5b9cd5086db9e24c2c7db8b0140482670af04e28
amdgcn: Don't clobber VCC if we don't need to

This is a hold-over from GCN3 where v_add always wrote to the condition
register, whether you wanted it or not.  This hasn't been true since GCN5, and
we dropped support for GCN3 a little while ago, so let's fix it.

There was actually a latent bug here because some other post-reload splitters
were generating v_add instructions without declaring the VCC clobber (at least
mul did this), so this should fix some wrong-code bugs also.

gcc/ChangeLog:

* config/gcn/gcn-valu.md (add<mode>3<exec_clobber>): Rename ...
(add<mode>3<exec>): ... to this, remove the clobber, and change the
instruction from v_add_co_u32 to v_add_u32.
(add<mode>3_dup<exec_clobber>): Rename ...
(add<mode>3_dup<exec>): ... to this, and likewise.
(sub<mode>3<exec_clobber>): Rename ...
(sub<mode>3<exec>): ... to this, and likewise
* config/gcn/gcn.md (addsi3): Remove the DI clobber, and change the
instruction from v_add_co_u32 to v_add_u32.
(addsi3_scc): Likewise.
(subsi3): Likewise, but for v_sub_co_u32.
(muldi3): Likewise.

(cherry picked from commit 0eee2dd2865faf61d9d74425510421e20434ec03)
gcc/config/gcn/gcn-valu.md
gcc/config/gcn/gcn.md