From 2202299c2aa69385ca5e7574914dabc84fb6a40a Mon Sep 17 00:00:00 2001 From: Kelvin Nilsen Date: Mon, 11 May 2020 16:16:15 -0500 Subject: rs6000: Add pdepd and pextd Add scalar instructions for parallel bit deposit and extract, with built-in function support. [gcc] 2020-05-11 Kelvin Nilsen * config/rs6000/rs6000-builtin.def (__builtin_pdepd): New built-in function. (__builtin_pextd): Likewise. * config/rs6000/rs6000.md (UNSPEC_PDEPD): New constant. (UNSPEC_PEXTD): Likewise. (pdepd): New insn. (pextd): Likewise. * doc/extend.texi (Basic PowerPC Built-in Functions Available for a Future Architecture): Add descriptions of __builtin_pdepd and __builtin_pextd functions. [gcc/testsuite] 2020-05-11 Kelvin Nilsen * gcc.target/powerpc/pdep-0.c: New. * gcc.target/powerpc/pdep-1.c: New. * gcc.target/powerpc/pextd-0.c: New. * gcc.target/powerpc/pextd-1.c: New. --- gcc/config/rs6000/rs6000-builtin.def | 2 ++ gcc/config/rs6000/rs6000.md | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'gcc/config') diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index 39e7da5fa50..4b06323a07f 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -2577,6 +2577,8 @@ BU_P9_OVERLOAD_2 (CMPEQB, "byte_in_set") BU_FUTURE_MISC_2 (CFUGED, "cfuged", CONST, cfuged) BU_FUTURE_MISC_2 (CNTLZDM, "cntlzdm", CONST, cntlzdm) BU_FUTURE_MISC_2 (CNTTZDM, "cnttzdm", CONST, cnttzdm) +BU_FUTURE_MISC_2 (PDEPD, "pdepd", CONST, pdepd) +BU_FUTURE_MISC_2 (PEXTD, "pextd", CONST, pextd) /* Future architecture vector built-ins. */ BU_FUTURE_V_2 (VCLRLB, "vclrlb", CONST, vclrlb) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 6c9bae934d1..4fcd6a94022 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -151,6 +151,8 @@ UNSPEC_CFUGED UNSPEC_CNTLZDM UNSPEC_CNTTZDM + UNSPEC_PDEPD + UNSPEC_PEXTD ]) ;; @@ -2483,6 +2485,24 @@ "cnttzdm %0,%1,%2" [(set_attr "type" "integer")]) +(define_insn "pdepd" + [(set (match_operand:DI 0 "register_operand" "=r") + (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "r") + (match_operand:DI 2 "gpc_reg_operand" "r")] + UNSPEC_PDEPD))] + "TARGET_FUTURE && TARGET_POWERPC64" + "pdepd %0,%1,%2" + [(set_attr "type" "integer")]) + +(define_insn "pextd" + [(set (match_operand:DI 0 "register_operand" "=r") + (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "r") + (match_operand:DI 2 "gpc_reg_operand" "r")] + UNSPEC_PEXTD))] + "TARGET_FUTURE && TARGET_POWERPC64" + "pextd %0,%1,%2" + [(set_attr "type" "integer")]) + (define_insn "cmpb3" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r") -- cgit v1.2.3