diff options
author | Kelvin Nilsen <kelvin@gcc.gnu.org> | 2020-05-11 09:35:01 -0500 |
---|---|---|
committer | Bill Schmidt <wschmidt@linux.ibm.com> | 2020-05-11 09:54:33 -0500 |
commit | a1821a249d998894dd38b14d5298647e8d7b5dc8 (patch) | |
tree | b6844aca9b9c6ec6dff0c370ffbfae78d0ee717f /gcc/config/rs6000/altivec.md | |
parent | b6ff3ddecfa93d53867afaaa078f85fc848abbbd (diff) | |
download | gcc-a1821a249d998894dd38b14d5298647e8d7b5dc8.zip gcc-a1821a249d998894dd38b14d5298647e8d7b5dc8.tar.gz gcc-a1821a249d998894dd38b14d5298647e8d7b5dc8.tar.bz2 |
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.
Diffstat (limited to 'gcc/config/rs6000/altivec.md')
-rw-r--r-- | gcc/config/rs6000/altivec.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index 6b1d987..5ef4889 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -160,6 +160,8 @@ UNSPEC_BCD_OVERFLOW UNSPEC_VRLMI UNSPEC_VRLNM + UNSPEC_VCLZDM + UNSPEC_VCTZDM ]) (define_c_enum "unspecv" @@ -4096,6 +4098,25 @@ "bcd<bcd_add_sub>. %0,%1,%2,%3" [(set_attr "type" "vecsimple")]) +(define_insn "vclzdm" + [(set (match_operand:V2DI 0 "altivec_register_operand" "=v") + (unspec:V2DI [(match_operand:V2DI 1 "altivec_register_operand" "v") + (match_operand:V2DI 2 "altivec_register_operand" "v")] + UNSPEC_VCLZDM))] + "TARGET_FUTURE" + "vclzdm %0,%1,%2" + [(set_attr "type" "vecsimple")]) + +(define_insn "vctzdm" + [(set (match_operand:V2DI 0 "altivec_register_operand" "=v") + (unspec:V2DI [(match_operand:V2DI 1 "altivec_register_operand" "v") + (match_operand:V2DI 2 "altivec_register_operand" "v")] + UNSPEC_VCTZDM))] + "TARGET_FUTURE" + "vctzdm %0,%1,%2" + [(set_attr "type" "vecsimple")]) + + (define_expand "bcd<bcd_add_sub>_<code>" [(parallel [(set (reg:CCFP CR6_REGNO) (compare:CCFP |