]> git.ipfire.org Git - thirdparty/gcc.git/commit
rs6000: Disable optimizing multiple xxsetaccz instructions into one xxsetaccz
authorPeter Bergner <bergner@linux.ibm.com>
Tue, 14 Sep 2021 15:47:18 +0000 (10:47 -0500)
committerPeter Bergner <bergner@linux.ibm.com>
Wed, 29 Sep 2021 19:16:55 +0000 (14:16 -0500)
commit1f377a1f51e99bacb8b77b603e69523f79649498
tree49f5a20b2299dbb4f28bde47bb900674d3aa1a36
parent1074147135d7cc068fd74cca6fd784a93c2fcbd0
rs6000: Disable optimizing multiple xxsetaccz instructions into one xxsetaccz

Fwprop will happily optimize two xxsetaccz instructions into one xxsetaccz
by propagating the results of the first to the uses of the second.
We really don't want that to happen given the late priming/depriming of
accumulators.  I fixed this by making the xxsetaccz source operand an
unspec volatile.  I also removed the mma_xxsetaccz define_expand and
define_insn_and_split and replaced it with a simple define_insn.
The expand and splitter patterns were leftovers from the pre opaque mode
code when the xxsetaccz code was part of the movpxi pattern, and we don't
need them now.

Rather than a new test case, I was able to just modify the current test case
to add another __builtin_mma_xxsetaccz call which shows the bad code gen
with unpatched compilers.

2021-09-14  Peter Bergner  <bergner@linux.ibm.com>

gcc/
* config/rs6000/mma.md (unspec): Delete UNSPEC_MMA_XXSETACCZ.
(unspecv): Add UNSPECV_MMA_XXSETACCZ.
(*mma_xxsetaccz): Delete.
(mma_xxsetaccz): Change to define_insn.  Remove operand 1.
Use UNSPECV_MMA_XXSETACCZ.  Update comment.
* config/rs6000/rs6000.c (rs6000_rtx_costs): Use UNSPECV_MMA_XXSETACCZ.

gcc/testsuite/
* gcc.target/powerpc/mma-builtin-6.c: Add second call to xxsetacc
built-in.  Update instruction counts.

(cherry picked from commit f80b9be083e0e7d49e7744b7e531b9aa52acd563)
gcc/config/rs6000/mma.md
gcc/config/rs6000/rs6000.c
gcc/testsuite/gcc.target/powerpc/mma-builtin-6.c