[PATCH, rs6000] VSX load/store rightmost element operations
authorWill Schmidt <will_schmidt@vnet.ibm.com>
Wed, 16 Sep 2020 14:43:31 +0000 (09:43 -0500)
committerWill Schmidt <will_schmidt@vnet.ibm.com>
Thu, 22 Oct 2020 14:46:23 +0000 (09:46 -0500)
commitb69c00612db1ccf7de77b0072c6b1b47090318f3
tree928b151aa655da239eff1df25927e17be0427654
parent8732511910e1dd23c56c01e876bbe235c360ac55
[PATCH, rs6000] VSX load/store rightmost element operations

Hi,
  This adds support for the VSX load/store rightmost element operations.
  This includes the instructions lxvrbx, lxvrhx, lxvrwx, lxvrdx,
  stxvrbx, stxvrhx, stxvrwx, stxvrdx; And the builtins
  vec_xl_sext() /* vector load sign extend */
  vec_xl_zext() /* vector load zero extend */
  vec_xst_trunc() /* vector store truncate */.

  Testcase results show that the instructions added with this patch show
  up at low/no optimization (-O0), with a number of those being replaced
  with other load and store instructions at higher optimization levels.
  For consistency I've left the tests at -O0.

  [v2] Refreshed per review comments.  Comments cleaned up, indentation
  corrected.

gcc/ChangeLog:
* config/rs6000/altivec.h (vec_xl_zext, vec_xl_sext, vec_xst_trunc):
New defines.
* config/rs6000/rs6000-builtin.def (BU_P10V_OVERLOAD_X): New builtin
macro.
(BU_P10V_AV_X): New builtin macro.
(se_lxvrhbx, se_lxrbhx, se_lxvrwx, se_lxvrdx): Define internal names
for load and sign extend vector element.
(ze_lxvrbx, ze_lxvrhx, ze_lxvrwx, ze_lxvrdx): Define internal names
for load and zero extend vector element.
(tr_stxvrbx, tr_stxvrhx, tr_stxvrwx, tr_stxvrdx): Define internal names
for truncate and store vector element.
(se_lxvrx, ze_lxvrx, tr_stxvrx): Define internal names for overloaded
load/store rightmost element.
* config/rs6000/rs6000-call.c (altivec_builtin_types): Define the
internal monomorphs P10_BUILTIN_SE_LXVRBX, P10_BUILTIN_SE_LXVRHX,
P10_BUILTIN_SE_LXVRWX, P10_BUILTIN_SE_LXVRDX,
P10_BUILTIN_ZE_LXVRBX, P10_BUILTIN_ZE_LXVRHX, P10_BUILTIN_ZE_LXVRWX,
P10_BUILTIN_ZE_LXVRDX,
P10_BUILTIN_TR_STXVRBX, P10_BUILTIN_TR_STXVRHX, P10_BUILTIN_TR_STXVRWX,
P10_BUILTIN_TR_STXVRDX,
(altivec_expand_lxvr_builtin): New expansion for load element builtins.
(altivec_expand_stv_builtin): Update to for truncate and store builtins.
(altivec_expand_builtin): Add clases for load/store rightmost builtins.
(altivec_init_builtins): Add def_builtin entries for
__builtin_altivec_se_lxvrbx, __builtin_altivec_se_lxvrhx,
__builtin_altivec_se_lxvrwx, __builtin_altivec_se_lxvrdx,
__builtin_altivec_ze_lxvrbx, __builtin_altivec_ze_lxvrhx,
__builtin_altivec_ze_lxvrwx, __builtin_altivec_ze_lxvrdx,
__builtin_altivec_tr_stxvrbx, __builtin_altivec_tr_stxvrhx,
__builtin_altivec_tr_stxvrwx, __builtin_altivec_tr_stxvrdx,
__builtin_vec_se_lxvrx, __builtin_vec_ze_lxvrx, __builtin_vec_tr_stxvrx.
* config/rs6000/vsx.md (vsx_lxvr<wd>x, vsx_stxvr<wd>x, vsx_stxvr<wd>x):
New define_insn entries.
* doc/extend.texi:  Add documentation for vsx_xl_sext, vsx_xl_zext,
and vec_xst_trunc.

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/vsx-load-element-extend-char.c: New test.
* gcc.target/powerpc/vsx-load-element-extend-int.c: New test.
* gcc.target/powerpc/vsx-load-element-extend-longlong.c: New test.
* gcc.target/powerpc/vsx-load-element-extend-short.c: New test.
* gcc.target/powerpc/vsx-store-element-truncate-char.c: New test.
* gcc.target/powerpc/vsx-store-element-truncate-int.c: New test.
* gcc.target/powerpc/vsx-store-element-truncate-longlong.c: New test.
* gcc.target/powerpc/vsx-store-element-truncate-short.c: New test.
13 files changed:
gcc/config/rs6000/altivec.h
gcc/config/rs6000/rs6000-builtin.def
gcc/config/rs6000/rs6000-call.c
gcc/config/rs6000/vsx.md
gcc/doc/extend.texi
gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-char.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-int.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-short.c [new file with mode: 0644]