]> gcc.gnu.org Git - gcc.git/commit
rs6000: Splat vector small V2DI constants with vspltisw and vupkhsw
authorHaochen Gui <guihaoc@gcc.gnu.org>
Wed, 28 Jun 2023 08:30:44 +0000 (16:30 +0800)
committerHaochen Gui <guihaoc@gcc.gnu.org>
Wed, 28 Jun 2023 08:37:57 +0000 (16:37 +0800)
commitf3d87219dd502d5c11608ffb83fbe66c79baf784
tree31cf9bd41553f47dc3d5f8dff26dc064bf724db3
parent7198573f44fb579843bff8deda695107858d8cff
rs6000: Splat vector small V2DI constants with vspltisw and vupkhsw

This patch adds a new insn for vector splat with small V2DI constants on P8.
If the value of constant is in RANGE (-16, 15) but not 0 or -1, it can be
loaded with vspltisw and vupkhsw on P8.

gcc/
PR target/104124
* config/rs6000/altivec.md (*altivec_vupkhs<VU_char>_direct): Rename
to...
(altivec_vupkhs<VU_char>_direct): ...this.
* config/rs6000/predicates.md (vspltisw_vupkhsw_constant_split): New
predicate to test if a constant can be loaded with vspltisw and
vupkhsw.
(easy_vector_constant): Call vspltisw_vupkhsw_constant_p to Check if
a vector constant can be synthesized with a vspltisw and a vupkhsw.
* config/rs6000/rs6000-protos.h (vspltisw_vupkhsw_constant_p):
Declare.
* config/rs6000/rs6000.cc (vspltisw_vupkhsw_constant_p): New
function to return true if OP mode is V2DI and can be synthesized
with vupkhsw and vspltisw.
* config/rs6000/vsx.md (*vspltisw_v2di_split): New insn to load up
constants with vspltisw and vupkhsw.

gcc/testsuite/
PR target/104124
* gcc.target/powerpc/pr104124.c: New.
gcc/config/rs6000/altivec.md
gcc/config/rs6000/predicates.md
gcc/config/rs6000/rs6000-protos.h
gcc/config/rs6000/rs6000.cc
gcc/config/rs6000/vsx.md
gcc/testsuite/gcc.target/powerpc/pr104124.c [new file with mode: 0644]
This page took 0.063396 seconds and 5 git commands to generate.