rs6000: Add vector count under mask
authorKelvin Nilsen <kelvin@gcc.gnu.org>
Mon, 11 May 2020 14:35:01 +0000 (09:35 -0500)
committerBill Schmidt <wschmidt@linux.ibm.com>
Mon, 11 May 2020 14:54:33 +0000 (09:54 -0500)
commita1821a249d998894dd38b14d5298647e8d7b5dc8
treeb6844aca9b9c6ec6dff0c370ffbfae78d0ee717f
parentb6ff3ddecfa93d53867afaaa078f85fc848abbbd
rs6000: Add vector count under mask

Add support for new vclzdm and vctzdm vector instructions that
count leading and trailing zeros under control of a mask.

[gcc]

2020-05-11  Kelvin Nilsen  <kelvin@gcc.gnu.org>
    Bill Schmidt  <wschmidt@linux.ibm.com>

* config/rs6000/altivec.h (vec_clzm): New macro.
(vec_ctzm): Likewise.
* config/rs6000/altivec.md (UNSPEC_VCLZDM): New constant.
(UNSPEC_VCTZDM): Likewise.
(vclzdm): New insn.
(vctzdm): Likewise.
* config/rs6000/rs6000-builtin.def (BU_FUTURE_V_0): New macro.
(BU_FUTURE_V_1): Likewise.
(BU_FUTURE_V_2): Likewise.
(BU_FUTURE_V_3): Likewise.
(__builtin_altivec_vclzdm): New builtin definition.
(__builtin_altivec_vctzdm): Likewise.
* config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Cause
_ARCH_PWR_FUTURE macro to be defined if OPTION_MASK_FUTURE flag is
set.
* config/rs6000/rs6000-call.c (builtin_function_type): Set return
value and parameter types to be unsigned for VCLZDM and VCTZDM.
* config/rs6000/rs6000.c (rs6000_builtin_mask_calculate): Add
support for TARGET_FUTURE flag.
* config/rs6000/rs6000.h (RS6000_BTM_FUTURE): New macro constant.
* doc/extend.texi (PowerPC Altivec Built-in Functions Available
for a Future Architecture): New subsubsection.

[gcc/testsuite]

2020-05-11  Kelvin Nilsen  <kelvin@gcc.gnu.org>

* gcc.target/powerpc/vec-clzm-0.c: New test.
* gcc.target/powerpc/vec-clzm-1.c: New test.
* gcc.target/powerpc/vec-ctzm-0.c: New test.
* gcc.target/powerpc/vec-ctzm-1.c: New test.
14 files changed:
gcc/ChangeLog
gcc/config/rs6000/altivec.h
gcc/config/rs6000/altivec.md
gcc/config/rs6000/rs6000-builtin.def
gcc/config/rs6000/rs6000-c.c
gcc/config/rs6000/rs6000-call.c
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.h
gcc/doc/extend.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/vec-clzm-0.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vec-clzm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vec-ctzm-0.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vec-ctzm-1.c [new file with mode: 0644]