rs6000: Optimize __builtin_shuffle when it's used to zero the upper bits [PR102868]
authorXionghu Luo <luoxhu@linux.ibm.com>
Fri, 29 Oct 2021 02:28:43 +0000 (21:28 -0500)
committerXionghu Luo <luoxhu@linux.ibm.com>
Fri, 29 Oct 2021 02:28:43 +0000 (21:28 -0500)
commit146b83e14a0a76a9ce8a4cb79997a078f437f779
treec465e9f9a5451b51fcd5422aad53319c9e60fb2e
parent84bcefd5555af6d95e08cd980965098961289215
rs6000: Optimize __builtin_shuffle when it's used to zero the upper bits [PR102868]

If the second operand of __builtin_shuffle is const vector 0, and with
specific mask, it can be optimized to vspltisw+xxpermdi instead of lxv.

gcc/ChangeLog:

PR target/102868
* config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Add
patterns match and emit for VSX xxpermdi.

gcc/testsuite/ChangeLog:

PR target/102868
* gcc.target/powerpc/pr102868.c: New test.
gcc/config/rs6000/rs6000.c
gcc/testsuite/gcc.target/powerpc/pr102868.c [new file with mode: 0644]