rs6000: Use direct move for char/short vector CTOR [PR96933]
authorKewen Lin <linkw@linux.ibm.com>
Thu, 5 Nov 2020 06:04:10 +0000 (00:04 -0600)
committerKewen Lin <linkw@linux.ibm.com>
Thu, 5 Nov 2020 06:28:28 +0000 (00:28 -0600)
commit025f434a87336e38bf5140fba2005081876aa911
tree021b7f0061e50d898c54a847da764f73b600c9b7
parent35c125cb6ac47fa97aa5ee22f987a38e63adad08
rs6000: Use direct move for char/short vector CTOR [PR96933]

This patch is to make vector CTOR with char/short leverage direct
move instructions when they are available.  With one constructed
test case, it can speed up 145% for char and 190% for short on P9.

Tested SPEC2017 x264_r at -Ofast on P9, it gets 1.61% speedup
(but based on unexpected SLP see PR96789).

Bootstrapped/regtested on powerpc64{,le}-linux-gnu P8 and
powerpc64le-linux-gnu P9.

gcc/ChangeLog:

PR target/96933
* config/rs6000/rs6000.c (rs6000_expand_vector_init): Use direct move
instructions for vector construction with char/short types.
* config/rs6000/rs6000.md (p8_mtvsrwz_v16qisi2): New define_insn.
(p8_mtvsrd_v16qidi2): Likewise.

gcc/testsuite/ChangeLog:

PR target/96933
* gcc.target/powerpc/pr96933-1.c: New test.
* gcc.target/powerpc/pr96933-2.c: New test.
* gcc.target/powerpc/pr96933-3.c: New test.
* gcc.target/powerpc/pr96933-4.c: New test.
* gcc.target/powerpc/pr96933.h: New test.
* gcc.target/powerpc/pr96933-run.h: New test.
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.md
gcc/testsuite/gcc.target/powerpc/pr96933-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr96933-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr96933-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr96933-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr96933-run.h [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr96933.h [new file with mode: 0644]