rs6000: Prefer assigning the MMA vector operands to altivec registers [PR105556]
authorPeter Bergner <bergner@linux.ibm.com>
Wed, 18 May 2022 02:09:29 +0000 (21:09 -0500)
committerPeter Bergner <bergner@linux.ibm.com>
Fri, 20 May 2022 23:00:28 +0000 (18:00 -0500)
commitc83d78585078d6918853fbe0f74a3a78e88e3e32
tree163abcccd6e33317ead8b01451903fa1c2f7aba2
parentfdf50499a40399a48ac5e5d521ef93ed302be157
rs6000: Prefer assigning the MMA vector operands to altivec registers [PR105556]

When optimizing the DGEMM kernel in OpenBLAS to use MMA, the MMA code
uses all 8 accumulators, which overlap all vs0-vs31 vector registers.
Current trunk assigns one of the normal vector inputs to one of the MMA
instructions, which forces us to spill one of the accumulators to memory,
leading to poor performance.  The solution here is to replace the "wa"
constraints for the vector input operands in the MMA instruction patterns
with "v,?wa" so that we prefer using the altivec registers vs32-vs63
over the vs0-vs31 registers.

2022-05-17  Peter Bergner  <bergner@linux.ibm.com>
    Segher Boessenkool  <segher@kernel.crashing.org>

gcc/
PR target/105556
* config/rs6000/mma.md (mma_<vv>, mma_<avv>, mma_<pv>, mma_<apv>,
mma_<vvi4i4i8>, mma_<avvi4i4i8>, mma_<vvi4i4i2>, mma_<avvi4i4i2>,
mma_<vvi4i4>, mma_<avvi4i4>, mma_<pvi4i2>, mma_<apvi4i2>,
mma_<vvi4i4i4>, mma_<avvi4i4i4>): Replace "wa" constraints with "v,?wa".
Update other operands accordingly.

(cherry picked from commit c6e36f05fbb081abb068958d8900ad34b303a70b)
gcc/config/rs6000/mma.md