From 7eeadf67b7b46ef0c814e4769d5dd301ad8401b8 Mon Sep 17 00:00:00 2001 From: Lin Sinan Date: Thu, 28 Apr 2022 07:16:23 +0800 Subject: [PATCH] rvp: update to spec 0.9.11 0. update impl according to the change in 0.9.11 1. fix add/sub crash in rv32g 2. use standard name for saturation insn, e.g. kaddw and kaddh --- gcc/config/riscv/riscv-builtins-rvp.def | 114 +++++++++++----------- gcc/config/riscv/riscv-builtins.c | 3 +- gcc/config/riscv/riscv-ftypes.def | 3 + gcc/config/riscv/riscv.md | 25 +++-- gcc/config/riscv/rvp.md | 118 +++++++---------------- gcc/config/riscv/rvp_intrinsic.h | 120 ++++++++++++------------ 6 files changed, 177 insertions(+), 206 deletions(-) diff --git a/gcc/config/riscv/riscv-builtins-rvp.def b/gcc/config/riscv/riscv-builtins-rvp.def index ec2c0e1d5718..59e14d707a81 100644 --- a/gcc/config/riscv/riscv-builtins-rvp.def +++ b/gcc/config/riscv/riscv-builtins-rvp.def @@ -101,7 +101,7 @@ DIRECT_BUILTIN_NO_PREFIX (kaddv2hi3, kadd16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, z DIRECT_BUILTIN_NO_PREFIX (kaddv2hi3, v_kadd16, RISCV_V2HI_FTYPE_V2HI_V2HI, zpn32), DIRECT_BUILTIN_NO_PREFIX (kaddv4hi3, kadd16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kaddv4hi3, v64_kadd16, RISCV_V4HI_FTYPE_V4HI_V4HI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kaddh, kaddh, RISCV_SI_FTYPE_SI_SI, zpn), +DIRECT_BUILTIN_NO_PREFIX (ssaddhi3, kaddh, RISCV_HI_FTYPE_HI_HI, zpn), DIRECT_BUILTIN_NO_PREFIX (kcrasv2hi, kcras16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn32), DIRECT_BUILTIN_NO_PREFIX (kcrasv2hi, v_kcras16, RISCV_V2HI_FTYPE_V2HI_V2HI, zpn32), DIRECT_BUILTIN_NO_PREFIX (kcras16_64, kcras16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), @@ -297,8 +297,8 @@ DIRECT_BUILTIN_NO_PREFIX (ksubv2hi3, ksub16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, z DIRECT_BUILTIN_NO_PREFIX (ksubv2hi3, v_ksub16, RISCV_V2HI_FTYPE_V2HI_V2HI, zpn32), DIRECT_BUILTIN_NO_PREFIX (ksubv4hi3, ksub16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (ksubv4hi3, v64_ksub16, RISCV_V4HI_FTYPE_V4HI_V4HI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (ksubh, ksubh, RISCV_SI_FTYPE_SI_SI, zpn), -DIRECT_BUILTIN_NO_PREFIX (ksubw, ksubw, RISCV_SI_FTYPE_SI_SI, zpn), +DIRECT_BUILTIN_NO_PREFIX (sssubhi3, ksubh, RISCV_HI_FTYPE_HI_HI, zpn), +DIRECT_BUILTIN_NO_PREFIX (sssubsi3, ksubw, RISCV_SI_FTYPE_SI_SI, zpn), DIRECT_BUILTIN_NO_PREFIX (kwmmul, kwmmul, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn32), DIRECT_BUILTIN_NO_PREFIX (kwmmul_round, kwmmul_u, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn32), DIRECT_BUILTIN_NO_PREFIX (kwmmul_64, kwmmul, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), @@ -589,9 +589,9 @@ DIRECT_BUILTIN_NO_PREFIX (ukaddv2hi3, ukadd16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, DIRECT_BUILTIN_NO_PREFIX (ukaddv2hi3, v_ukadd16, RISCV_UV2HI_FTYPE_UV2HI_UV2HI, zpn32), DIRECT_BUILTIN_NO_PREFIX (ukaddv4hi3, ukadd16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (ukaddv4hi3, v64_ukadd16, RISCV_UV4HI_FTYPE_UV4HI_UV4HI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (ukaddh, ukaddh, RISCV_USI_FTYPE_USI_USI, zpn), -DIRECT_BUILTIN_NO_PREFIX (ukaddw, ukaddw, RISCV_USI_FTYPE_USI_USI, zpn), -DIRECT_BUILTIN_NO_PREFIX (kaddw, kaddw, RISCV_SI_FTYPE_SI_SI, zpn), +DIRECT_BUILTIN_NO_PREFIX (usaddhi3, ukaddh, RISCV_UHI_FTYPE_UHI_UHI, zpn), +DIRECT_BUILTIN_NO_PREFIX (usaddsi3, ukaddw, RISCV_USI_FTYPE_USI_USI, zpn), +DIRECT_BUILTIN_NO_PREFIX (ssaddsi3, kaddw, RISCV_SI_FTYPE_SI_SI, zpn), DIRECT_BUILTIN_NO_PREFIX (ukcrasv2hi, ukcras16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn32), DIRECT_BUILTIN_NO_PREFIX (ukcrasv2hi, v_ukcras16, RISCV_UV2HI_FTYPE_UV2HI_UV2HI, zpn32), DIRECT_BUILTIN_NO_PREFIX (ukcras16_64, ukcras16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), @@ -616,8 +616,8 @@ DIRECT_BUILTIN_NO_PREFIX (uksubv2hi3, uksub16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, DIRECT_BUILTIN_NO_PREFIX (uksubv2hi3, v_uksub16, RISCV_UV2HI_FTYPE_UV2HI_UV2HI, zpn32), DIRECT_BUILTIN_NO_PREFIX (uksubv4hi3, uksub16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (uksubv4hi3, v64_uksub16, RISCV_UV4HI_FTYPE_UV4HI_UV4HI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (uksubh, uksubh, RISCV_USI_FTYPE_USI_USI, zpn), -DIRECT_BUILTIN_NO_PREFIX (uksubw, uksubw, RISCV_USI_FTYPE_USI_USI, zpn), +DIRECT_BUILTIN_NO_PREFIX (ussubhi3, uksubh, RISCV_UHI_FTYPE_UHI_UHI, zpn), +DIRECT_BUILTIN_NO_PREFIX (ussubsi3, uksubw, RISCV_USI_FTYPE_USI_USI, zpn), DIRECT_BUILTIN_NO_PREFIX (umaqa, umaqa, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN_UIXLEN, zpn32), DIRECT_BUILTIN_NO_PREFIX (umaqa, v_umaqa, RISCV_USI_FTYPE_USI_UV4QI_UV4QI, zpn32), DIRECT_BUILTIN_NO_PREFIX (umaqa64, umaqa, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN_UIXLEN, zpn64), @@ -701,20 +701,20 @@ DIRECT_BUILTIN_NO_PREFIX (crasv2si, v_scras32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64 DIRECT_BUILTIN_NO_PREFIX (crsav2si, crsa32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (crsav2si, v_ucrsa32, RISCV_UV2SI_FTYPE_UV2SI_UV2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (crsav2si, v_scrsa32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kabsv2si2, kabs32, RISCV_UIXLEN_FTYPE_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kabsv2si2, kabs32, RISCV_DI_FTYPE_DI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kabsv2si2, v_kabs32, RISCV_V2SI_FTYPE_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kaddv2si3, kadd32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kaddv2si3, kadd32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kaddv2si3, v_kadd32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kcrasv2si, kcras32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kcrasv2si, kcras32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kcrasv2si, v_kcras32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kcrsav2si, kcrsa32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kcrsav2si, kcrsa32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kcrsav2si, v_kcrsa32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (khmbb16, khmbb16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (khmbt16, khmbt16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (khmtt16, khmtt16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kdmbb16, kdmbb16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kdmbt16, kdmbt16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kdmtt16, kdmtt16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (khmbb16, khmbb16, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (khmbt16, khmbt16, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (khmtt16, khmtt16, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kdmbb16, kdmbb16, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kdmbt16, kdmbt16, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kdmtt16, kdmtt16, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kdmabb16, kdmabb16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN_UIXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kdmabt16, kdmabt16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN_UIXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kdmatt16, kdmatt16, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN_UIXLEN, zpn64), @@ -727,39 +727,39 @@ DIRECT_BUILTIN_NO_PREFIX (kdmtt16, v_kdmtt16, RISCV_V2SI_FTYPE_V4HI_V4HI, zpn64) DIRECT_BUILTIN_NO_PREFIX (kdmabb16, v_kdmabb16, RISCV_V2SI_FTYPE_V2SI_V4HI_V4HI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kdmabt16, v_kdmabt16, RISCV_V2SI_FTYPE_V2SI_V4HI_V4HI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kdmatt16, v_kdmatt16, RISCV_V2SI_FTYPE_V2SI_V4HI_V4HI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmabb32, kmabb32, RISCV_IXLEN_FTYPE_IXLEN_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmabt32, kmabt32, RISCV_IXLEN_FTYPE_IXLEN_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmatt32, kmatt32, RISCV_IXLEN_FTYPE_IXLEN_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmabb32, kmabb32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmabt32, kmabt32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmatt32, kmatt32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmabb32, v_kmabb32, RISCV_IXLEN_FTYPE_IXLEN_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmabt32, v_kmabt32, RISCV_IXLEN_FTYPE_IXLEN_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmatt32, v_kmatt32, RISCV_IXLEN_FTYPE_IXLEN_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmaxda32, kmaxda32, RISCV_IXLEN_FTYPE_IXLEN_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmaxda32, kmaxda32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmaxda32, v_kmaxda32, RISCV_IXLEN_FTYPE_IXLEN_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmda32, kmda32, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmxda32, kmxda32, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmda32, kmda32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmxda32, kmxda32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmda32, v_kmda32, RISCV_IXLEN_FTYPE_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmxda32, v_kmxda32, RISCV_IXLEN_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmads32, kmads32, RISCV_IXLEN_FTYPE_IXLEN_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmadrs32, kmadrs32, RISCV_IXLEN_FTYPE_IXLEN_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmaxds32, kmaxds32, RISCV_IXLEN_FTYPE_IXLEN_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmads32, kmads32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmadrs32, kmadrs32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmaxds32, kmaxds32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmads32, v_kmads32, RISCV_IXLEN_FTYPE_IXLEN_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmadrs32, v_kmadrs32, RISCV_IXLEN_FTYPE_IXLEN_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmaxds32, v_kmaxds32, RISCV_IXLEN_FTYPE_IXLEN_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmsda32, kmsda32, RISCV_IXLEN_FTYPE_IXLEN_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kmsxda32, kmsxda32, RISCV_IXLEN_FTYPE_IXLEN_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmsda32, kmsda32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kmsxda32, kmsxda32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmsda32, v_kmsda32, RISCV_IXLEN_FTYPE_IXLEN_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kmsxda32, v_kmsxda32, RISCV_IXLEN_FTYPE_IXLEN_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (ksll32, ksll32, RISCV_UIXLEN_FTYPE_UIXLEN_USI, zpn64), +DIRECT_BUILTIN_NO_PREFIX (ksll32, ksll32, RISCV_IXLEN_FTYPE_IXLEN_USI, zpn64), DIRECT_BUILTIN_NO_PREFIX (ksll32, v_ksll32, RISCV_V2SI_FTYPE_V2SI_USI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kslrav2si, kslra32, RISCV_UIXLEN_FTYPE_UIXLEN_SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kslrav2si_round, kslra32_u, RISCV_UIXLEN_FTYPE_UIXLEN_SI, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kslrav2si, kslra32, RISCV_DI_FTYPE_DI_SI, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kslrav2si_round, kslra32_u, RISCV_DI_FTYPE_DI_SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kslrav2si, v_kslra32, RISCV_V2SI_FTYPE_V2SI_SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kslrav2si_round, v_kslra32_u, RISCV_V2SI_FTYPE_V2SI_SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (kstasv2si, kstas32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kstasv2si, v_kstas32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (kstsav2si, kstsa32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (kstsav2si, kstsa32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (kstsav2si, v_kstsa32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (ksubv2si3, ksub32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (ksubv2si3, ksub32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (ksubv2si3, v_ksub32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (pkbbv2si, pkbb32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (pkbtv2si, pkbt32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), @@ -769,40 +769,40 @@ DIRECT_BUILTIN_NO_PREFIX (pkbbv2si, v_pkbb32, RISCV_UV2SI_FTYPE_UV2SI_UV2SI, zpn DIRECT_BUILTIN_NO_PREFIX (pkbtv2si, v_pkbt32, RISCV_UV2SI_FTYPE_UV2SI_UV2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (pktbv2si, v_pktb32, RISCV_UV2SI_FTYPE_UV2SI_UV2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (pkttv2si, v_pktt32, RISCV_UV2SI_FTYPE_UV2SI_UV2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (raddv2si3, radd32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (raddv2si3, radd32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (raddv2si3, v_radd32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (rcrasv2si, rcras32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (rcrasv2si, rcras32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (rcrasv2si, v_rcras32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (rcrsav2si, v_rcrsa32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (rcrsav2si, rcrsa32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (rstasv2si, rstas32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (rcrsav2si, rcrsa32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (rstasv2si, rstas32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (rstasv2si, v_rstas32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (rstsav2si, rstsa32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (rstsav2si, rstsa32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (rstsav2si, v_rstsa32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (rsubv2si3, rsub32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (rsubv2si3, rsub32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (rsubv2si3, v_rsub32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (ashlv2si3, sll32, RISCV_UIXLEN_FTYPE_UIXLEN_USI, zpn64), DIRECT_BUILTIN_NO_PREFIX (ashlv2si3, v_sll32, RISCV_UV2SI_FTYPE_UV2SI_USI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (smaxv2si3, smax32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (smaxv2si3, smax32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (smaxv2si3, v_smax32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (smbb32, smbb32, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (smbt32, smbt32, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (smtt32, smtt32, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (smbb32, smbb32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (smbt32, smbt32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (smtt32, smtt32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (smbb32, v_smbb32, RISCV_IXLEN_FTYPE_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (smbt32, v_smbt32, RISCV_IXLEN_FTYPE_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (smtt32, v_smtt32, RISCV_IXLEN_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (smds32, smds32, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (smdrs32, smdrs32, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), -DIRECT_BUILTIN_NO_PREFIX (smxds32, smxds32, RISCV_IXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (smds32, smds32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (smdrs32, smdrs32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (smxds32, smxds32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (smds32, v_smds32, RISCV_IXLEN_FTYPE_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (smdrs32, v_smdrs32, RISCV_IXLEN_FTYPE_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (smxds32, v_smxds32, RISCV_IXLEN_FTYPE_V2SI_V2SI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (sminv2si3, smin32, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN, zpn64), +DIRECT_BUILTIN_NO_PREFIX (sminv2si3, smin32, RISCV_IXLEN_FTYPE_IXLEN_IXLEN, zpn64), DIRECT_BUILTIN_NO_PREFIX (sminv2si3, v_smin32, RISCV_V2SI_FTYPE_V2SI_V2SI, zpn64), DIRECT_BUILTIN_NO_PREFIX (ashrv2si3, v_sra32, RISCV_V2SI_FTYPE_V2SI_USI, zpn64), DIRECT_BUILTIN_NO_PREFIX (sra32_round, v_sra32_u, RISCV_V2SI_FTYPE_V2SI_USI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (ashrv2si3, sra32, RISCV_UIXLEN_FTYPE_UIXLEN_USI, zpn64), -DIRECT_BUILTIN_NO_PREFIX (sra32_round, sra32_u, RISCV_UIXLEN_FTYPE_UIXLEN_USI, zpn64), +DIRECT_BUILTIN_NO_PREFIX (ashrv2si3, sra32, RISCV_IXLEN_FTYPE_IXLEN_USI, zpn64), +DIRECT_BUILTIN_NO_PREFIX (sra32_round, sra32_u, RISCV_IXLEN_FTYPE_IXLEN_USI, zpn64), DIRECT_BUILTIN_NO_PREFIX (sraiw_u, sraw_u, RISCV_SI_FTYPE_SI_USI, zpn64), DIRECT_BUILTIN_NO_PREFIX (lshrv2si3, srl32, RISCV_UIXLEN_FTYPE_UIXLEN_USI, zpn64), DIRECT_BUILTIN_NO_PREFIX (srl32_round, srl32_u, RISCV_UIXLEN_FTYPE_UIXLEN_USI, zpn64), @@ -945,12 +945,12 @@ DIRECT_BUILTIN_NO_PREFIX (smul8, smul8, RISCV_UDI_FTYPE_USI_USI, zpsf), DIRECT_BUILTIN_NO_PREFIX (smul8, v_smul8, RISCV_V4HI_FTYPE_V4QI_V4QI, zpsf), DIRECT_BUILTIN_NO_PREFIX (smulx8, smulx8, RISCV_UDI_FTYPE_USI_USI, zpsf), DIRECT_BUILTIN_NO_PREFIX (smulx8, v_smulx8, RISCV_V4HI_FTYPE_V4QI_V4QI, zpsf), -DIRECT_BUILTIN_NO_PREFIX (smul16, smul16, RISCV_UDI_FTYPE_USI_USI, zpsf32), -DIRECT_BUILTIN_NO_PREFIX (smul16_64, smul16, RISCV_UDI_FTYPE_USI_USI, zpsf64), +DIRECT_BUILTIN_NO_PREFIX (smul16, smul16, RISCV_DI_FTYPE_USI_USI, zpsf32), +DIRECT_BUILTIN_NO_PREFIX (smul16_64, smul16, RISCV_DI_FTYPE_USI_USI, zpsf64), DIRECT_BUILTIN_NO_PREFIX (smul16, v_smul16, RISCV_V2SI_FTYPE_V2HI_V2HI, zpsf32), DIRECT_BUILTIN_NO_PREFIX (smul16_64, v64_smul16, RISCV_V2SI_FTYPE_V2HI_V2HI, zpsf64), -DIRECT_BUILTIN_NO_PREFIX (smulx16, smulx16, RISCV_UDI_FTYPE_USI_USI, zpsf32), -DIRECT_BUILTIN_NO_PREFIX (smulx16_64, smulx16, RISCV_UDI_FTYPE_USI_USI, zpsf64), +DIRECT_BUILTIN_NO_PREFIX (smulx16, smulx16, RISCV_DI_FTYPE_USI_USI, zpsf32), +DIRECT_BUILTIN_NO_PREFIX (smulx16_64, smulx16, RISCV_DI_FTYPE_USI_USI, zpsf64), DIRECT_BUILTIN_NO_PREFIX (smulx16, v_smulx16, RISCV_V2SI_FTYPE_V2HI_V2HI, zpsf32), DIRECT_BUILTIN_NO_PREFIX (smulx16_64, v_smulx16, RISCV_V2SI_FTYPE_V2HI_V2HI, zpsf64), DIRECT_BUILTIN_NO_PREFIX (wext, wext, RISCV_IXLEN_FTYPE_UDI_USI, zpsf32), @@ -961,5 +961,7 @@ DIRECT_BUILTIN_NO_PREFIX (fsrw, fsrw, RISCV_USI_FTYPE_USI_USI_USI, zbpbo64), DIRECT_BUILTIN_NO_PREFIX (fsr, fsr, RISCV_USI_FTYPE_USI_USI_USI, zbpbo32), DIRECT_BUILTIN_NO_PREFIX (cmixsi, cmix, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN_UIXLEN, zbpbo32), DIRECT_BUILTIN_NO_PREFIX (cmixdi, cmix, RISCV_UIXLEN_FTYPE_UIXLEN_UIXLEN_UIXLEN, zbpbo64), -DIRECT_BUILTIN_NO_PREFIX (smaxsi3, max, RISCV_SI_FTYPE_SI_SI, zbpbo), -DIRECT_BUILTIN_NO_PREFIX (sminsi3, min, RISCV_SI_FTYPE_SI_SI, zbpbo), +DIRECT_BUILTIN_NO_PREFIX (smaxsi3, max, RISCV_SI_FTYPE_SI_SI, zbpbo32), +DIRECT_BUILTIN_NO_PREFIX (sminsi3, min, RISCV_SI_FTYPE_SI_SI, zbpbo32), +DIRECT_BUILTIN_NO_PREFIX (smaxdi3, max, RISCV_DI_FTYPE_DI_DI, zbpbo64), +DIRECT_BUILTIN_NO_PREFIX (smindi3, min, RISCV_DI_FTYPE_DI_DI, zbpbo64), diff --git a/gcc/config/riscv/riscv-builtins.c b/gcc/config/riscv/riscv-builtins.c index 64691928c0ac..0fe69e607462 100644 --- a/gcc/config/riscv/riscv-builtins.c +++ b/gcc/config/riscv/riscv-builtins.c @@ -124,7 +124,6 @@ AVAIL (zpsf, TARGET_ZPSF) AVAIL (zpsf32, TARGET_ZPSF && !TARGET_64BIT) AVAIL (zpsf64, TARGET_ZPSF && TARGET_64BIT) -AVAIL (zbpbo, TARGET_ZBPBO) AVAIL (zbpbo32, TARGET_ZBPBO && !TARGET_64BIT) AVAIL (zbpbo64, TARGET_ZBPBO && TARGET_64BIT) @@ -177,6 +176,8 @@ tree int_xlen_node; /* Argument types. */ #define RISCV_ATYPE_VOID void_type_node +#define RISCV_ATYPE_UHI unsigned_intHI_type_node +#define RISCV_ATYPE_HI intHI_type_node #define RISCV_ATYPE_USI unsigned_intSI_type_node #define RISCV_ATYPE_SI intSI_type_node #define RISCV_ATYPE_DI intDI_type_node diff --git a/gcc/config/riscv/riscv-ftypes.def b/gcc/config/riscv/riscv-ftypes.def index dc21551b2380..5dcb89e5ad6f 100644 --- a/gcc/config/riscv/riscv-ftypes.def +++ b/gcc/config/riscv/riscv-ftypes.def @@ -61,6 +61,7 @@ DEF_RISCV_FTYPE (2, (DI, DI, UIXLEN)) DEF_RISCV_FTYPE (2, (DI, DI, USI)) DEF_RISCV_FTYPE (2, (DI, DI, V2HI)) DEF_RISCV_FTYPE (2, (DI, DI, V4HI)) +DEF_RISCV_FTYPE (2, (DI, USI, USI)) DEF_RISCV_FTYPE (2, (DI, SI, SI)) DEF_RISCV_FTYPE (2, (IXLEN, IXLEN, IXLEN)) DEF_RISCV_FTYPE (2, (IXLEN, IXLEN, UIXLEN)) @@ -125,6 +126,8 @@ DEF_RISCV_FTYPE (2, (V4QI, V4QI, V4QI)) DEF_RISCV_FTYPE (2, (V8QI, V8QI, SI)) DEF_RISCV_FTYPE (2, (V8QI, V8QI, USI)) DEF_RISCV_FTYPE (2, (V8QI, V8QI, V8QI)) +DEF_RISCV_FTYPE (2, (HI, HI, HI)) +DEF_RISCV_FTYPE (2, (UHI, UHI, UHI)) DEF_RISCV_FTYPE (3, (DI, DI, IXLEN, IXLEN)) DEF_RISCV_FTYPE (3, (DI, DI, UIXLEN, UIXLEN)) DEF_RISCV_FTYPE (3, (DI, DI, V2HI, V2HI)) diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index 0771ef020fed..d97f08cfa385 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -359,9 +359,9 @@ ;; Iterator for floating-point modes that can be loaded into X registers. (define_mode_iterator SOFTF [SF (DF "TARGET_64BIT")]) -;; This attribute gives the length suffix for a sign- or zero-extension -;; instruction. -(define_mode_attr size [(QI "b") (HI "h")]) +;; This attribute gives the length suffix for a sign-, zero-extension +;; ,ksub- or kadd- instruction in RVP. +(define_mode_attr size [(QI "b") (HI "h") (SI "w")]) ;; Mode attributes for loads. (define_mode_attr load [(QI "lb") (HI "lh") (SI "lw") (DI "ld") (SF "flw") (DF "fld")]) @@ -516,11 +516,18 @@ (set_attr "mode" "SI")]) (define_expand "adddi3" - [(set (match_operand:DI 0 "register_operand") - (plus:DI (match_operand:DI 1 "register_operand") - (match_operand:DI 2 "arith_operand" )))]) + [(set (match_operand:DI 0 "register_operand" "=r,r") + (plus:DI (match_operand:DI 1 "register_operand" " r,r") + (match_operand:DI 2 "arith_operand" " r,I")))] + "TARGET_64BIT || TARGET_ZPSF" + { + if (!TARGET_64BIT) + operands[2] = force_reg (DImode, operands[2]); + } + [(set_attr "type" "arith") + (set_attr "mode" "DI")]) -(define_insn "*adddi3_riscv" +(define_insn "*adddi_rv64" [(set (match_operand:DI 0 "register_operand" "=r,r") (plus:DI (match_operand:DI 1 "register_operand" " r,r") (match_operand:DI 2 "arith_operand" " r,I")))] @@ -571,8 +578,8 @@ [(set (match_operand:DI 0 "register_operand" "= r") (minus:DI (match_operand:DI 1 "reg_or_0_operand" " rJ") (match_operand:DI 2 "register_operand" " r")))] - "TARGET_64BIT" - "sub\t%0,%z1,%2" + "TARGET_64BIT || TARGET_ZPSF" + { return TARGET_64BIT ? "sub\t%0,%z1,%2" : "sub64\t%0,%z1,%2"; } [(set_attr "type" "arith") (set_attr "mode" "DI")]) diff --git a/gcc/config/riscv/rvp.md b/gcc/config/riscv/rvp.md index eaf1a1800cb3..0b552f9bb141 100644 --- a/gcc/config/riscv/rvp.md +++ b/gcc/config/riscv/rvp.md @@ -117,45 +117,6 @@ [(set_attr "type" "simd") (set_attr "mode" "")]) -;; sub/adddi spn -(define_insn "*subdi3_rvp" - [(set (match_operand:DI 0 "register_operand" "=r") - (minus:DI (match_operand:DI 1 "register_operand" " r") - (match_operand:DI 2 "arith_operand" " r")))] - "TARGET_ZPSF && !TARGET_64BIT" -{ - HOST_WIDE_INT tmp; - if (CONST_INT_P (operands[2])) - { - tmp = INTVAL (operands[2]); - operands[2] = gen_reg_rtx (DImode); - riscv_move_integer (operands[2], operands[2], tmp, - DImode, FALSE); - } - return "sub64 %0, %1, %2"; -} - [(set_attr "type" "dsp64") - (set_attr "mode" "DI")]) - -(define_insn "*adddi3_rvp" - [(set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (match_operand:DI 1 "register_operand" " r") - (match_operand:DI 2 "arith_operand" " r")))] - "TARGET_ZPSF && !TARGET_64BIT" -{ - HOST_WIDE_INT tmp; - if (CONST_INT_P (operands[2])) - { - tmp = INTVAL (operands[2]); - operands[2] = gen_reg_rtx (DImode); - riscv_move_integer (operands[2], operands[2], tmp, - DImode, FALSE); - } - return "add64 %0, %1, %2"; -} - [(set_attr "type" "dsp64") - (set_attr "mode" "DI")]) - ;; k|(uk)|? add (define_insn "add3" [(set (match_operand:VECI 0 "register_operand" "=r") @@ -166,6 +127,16 @@ [(set_attr "type" "simd") (set_attr "mode" "")]) +;; add64/sub64 +(define_insn "*add64_rvp" + [(set (match_operand:DI 0 "register_operand" "=r") + (plus:DI (match_operand:DI 1 "register_operand" " r") + (match_operand:DI 2 "register_operand" " r")))] + "!TARGET_64BIT && TARGET_ZPSF" + "add64\t%0,%1,%2" + [(set_attr "type" "arith") + (set_attr "mode" "DI")]) + ;; rv64 (define_insn "rvp_adddi3" [(set (match_operand:DI 0 "register_operand" "=r") @@ -197,34 +168,17 @@ (set_attr "mode" "DI")]) ;; uk|k add|sub w|h -(define_int_attr karth_insn - [(UNSPEC_KADDW "kaddw") - (UNSPEC_UKADDW "ukaddw") - (UNSPEC_KSUBW "ksubw") - (UNSPEC_UKSUBW "uksubw") - (UNSPEC_KADDH "kaddh") - (UNSPEC_UKADDH "ukaddh") - (UNSPEC_KSUBH "ksubh") - (UNSPEC_UKSUBH "uksubh")]) - -(define_int_iterator UNSPEC_KARTH [ - UNSPEC_KADDW - UNSPEC_UKADDW - UNSPEC_KSUBW - UNSPEC_UKSUBW - UNSPEC_KADDH - UNSPEC_UKADDH - UNSPEC_KSUBH - UNSPEC_UKSUBH]) - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r") - (unspec:SI [(match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "register_operand" "r")] UNSPEC_KARTH))] +(define_code_iterator sat_op [ss_plus us_plus ss_minus us_minus]) +(define_code_attr us [(ss_plus "s") (us_plus "u") (ss_minus "s") (us_minus "u")]) + +(define_insn "s3" + [(set (match_operand:HISI 0 "register_operand" "=r") + (sat_op:HISI (match_operand:HISI 1 "register_operand" " r") + (match_operand:HISI 2 "register_operand" " r")))] "TARGET_ZPN" - "\t%0, %1, %2" + "\t%0, %1, %2" [(set_attr "type" "dsp") - (set_attr "mode" "SI")]) + (set_attr "mode" "")]) ;; ave (define_insn "ave" @@ -3062,39 +3016,39 @@ (set_attr "mode" "DI")]) ;; MAX, MIN -(define_insn "smaxsi3" - [(set (match_operand:SI 0 "register_operand" "=r") - (smax:SI (match_operand:SI 1 "register_operand" " r") - (match_operand:SI 2 "register_operand" " r")))] +(define_insn "smax3" + [(set (match_operand:X 0 "register_operand" "=r") + (smax:X (match_operand:X 1 "register_operand" " r") + (match_operand:X 2 "register_operand" " r")))] "TARGET_ZBPBO" "max\t%0, %1, %2" [(set_attr "type" "dsp") - (set_attr "mode" "SI")]) + (set_attr "mode" "")]) -(define_insn "sminsi3" - [(set (match_operand:SI 0 "register_operand" "=r") - (smin:SI (match_operand:SI 1 "register_operand" " r") - (match_operand:SI 2 "register_operand" " r")))] +(define_insn "smin3" + [(set (match_operand:X 0 "register_operand" "=r") + (smin:X (match_operand:X 1 "register_operand" " r") + (match_operand:X 2 "register_operand" " r")))] "TARGET_ZBPBO" "min\t%0, %1, %2" [(set_attr "type" "dsp") - (set_attr "mode" "SI")]) + (set_attr "mode" "")]) ;; PBSAD, PBSADA (define_insn "pbsad" - [(set (match_operand:GPR 0 "register_operand" "=r") - (unspec:GPR [(match_operand:GPR 1 "register_operand" "r") - (match_operand:GPR 2 "register_operand" "r")] UNSPEC_PBSAD))] + [(set (match_operand:X 0 "register_operand" "=r") + (unspec:X [(match_operand:X 1 "register_operand" " r") + (match_operand:X 2 "register_operand" " r")] UNSPEC_PBSAD))] "TARGET_ZPN" "pbsad\t%0, %1, %2" [(set_attr "type" "dsp") (set_attr "mode" "")]) (define_insn "pbsada" - [(set (match_operand:GPR 0 "register_operand" "=r") - (unspec:GPR [(match_operand:GPR 1 "register_operand" "0") - (match_operand:GPR 2 "register_operand" "r") - (match_operand:GPR 3 "register_operand" "r")] UNSPEC_PBSADA))] + [(set (match_operand:X 0 "register_operand" "=r") + (unspec:X [(match_operand:X 1 "register_operand" " 0") + (match_operand:X 2 "register_operand" " r") + (match_operand:X 3 "register_operand" " r")] UNSPEC_PBSADA))] "TARGET_ZPN" "pbsada\t%0, %2, %3" [(set_attr "type" "dsp") diff --git a/gcc/config/riscv/rvp_intrinsic.h b/gcc/config/riscv/rvp_intrinsic.h index 75be99dc9f96..09369f60abab 100644 --- a/gcc/config/riscv/rvp_intrinsic.h +++ b/gcc/config/riscv/rvp_intrinsic.h @@ -57,6 +57,9 @@ typedef uint8x8_t uint8xN_t; typedef int8x8_t int8xN_t; #endif +#define RVP_INTRINSIC_PREFIX __rv_ +#define RVP_INTRINSIC_VECTOR_PREFIX __rv_v_ + #define RVP_ARGUMENT_LIST(_0, _1, _2, _3, _4, _5, ...) _5 #define RVP_N_ARG(...) RVP_ARGUMENT_LIST(_, ## __VA_ARGS__, 4, 3, 2, 1, 0) @@ -93,12 +96,13 @@ typedef int8x8_t int8xN_t; /* RVP_N_ARG() expands to 0 in c89 */ #define CREATE_RVP_INTRINSIC_EMPTY_ARGS(return_type, name, ...)\ - DIRECT_CREATE_RVP_INTRINSIC (return_type, name, name, __rv_, __builtin_riscv_, \ - RVP_ARG0, RVP_VAR0, __VA_ARGS__) + DIRECT_CREATE_RVP_INTRINSIC (return_type, name, name, \ + RVP_INTRINSIC_PREFIX, __builtin_riscv_, RVP_ARG0, RVP_VAR0, __VA_ARGS__) #define CREATE_RVP_INTRINSIC_VECTOR(return_type, name, ...)\ - DIRECT_CREATE_RVP_INTRINSIC (return_type, name, name, __rv_v_, RVP_VECTOR_BUILTIN_PREFIX,\ - RVP_EXPAND_ARGS, RVP_EXPAND_VARS, __VA_ARGS__) + DIRECT_CREATE_RVP_INTRINSIC (return_type, name, name, \ + RVP_INTRINSIC_VECTOR_PREFIX, RVP_VECTOR_BUILTIN_PREFIX, \ + RVP_EXPAND_ARGS, RVP_EXPAND_VARS, __VA_ARGS__) #define DIRECT_CREATE_RVP_INTRINSIC(return_type, name, internal_name, intrisic_prefix,\ builtin_prefix, arg_expand_macro, var_expand_macro, ...)\ @@ -129,7 +133,7 @@ CREATE_RVP_INTRINSIC (uintXLEN_t, kabs16, uintXLEN_t) CREATE_RVP_INTRINSIC (int32_t, kabsw, int32_t) CREATE_RVP_INTRINSIC (uintXLEN_t, kadd8, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, kadd16, uintXLEN_t, uintXLEN_t) -CREATE_RVP_INTRINSIC (int32_t, kaddh, int32_t, int32_t) +CREATE_RVP_INTRINSIC (int32_t, kaddh, int16_t, int16_t) CREATE_RVP_INTRINSIC (uintXLEN_t, kcras16, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, kcrsa16, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (int32_t, kdmbb, uint32_t, uint32_t) @@ -192,7 +196,7 @@ CREATE_RVP_INTRINSIC (uintXLEN_t, kstas16, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, kstsa16, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, ksub8, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, ksub16, uintXLEN_t, uintXLEN_t) -CREATE_RVP_INTRINSIC (int32_t, ksubh, int32_t, int32_t) +CREATE_RVP_INTRINSIC (int32_t, ksubh, int16_t, int16_t) CREATE_RVP_INTRINSIC (int32_t, ksubw, int32_t, int32_t) CREATE_RVP_INTRINSIC (intXLEN_t, kwmmul, intXLEN_t, intXLEN_t) CREATE_RVP_INTRINSIC (intXLEN_t, kwmmul_u, intXLEN_t, intXLEN_t) @@ -270,7 +274,7 @@ CREATE_RVP_INTRINSIC (uintXLEN_t, ucmplt16, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, ucmple16, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, ukadd8, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, ukadd16, uintXLEN_t, uintXLEN_t) -CREATE_RVP_INTRINSIC (uint32_t, ukaddh, uint32_t, uint32_t) +CREATE_RVP_INTRINSIC (uint32_t, ukaddh, uint16_t, uint16_t) CREATE_RVP_INTRINSIC (uint32_t, ukaddw, uint32_t, uint32_t) CREATE_RVP_INTRINSIC (int32_t, kaddw, int32_t, int32_t) CREATE_RVP_INTRINSIC (uintXLEN_t, ukcras16, uintXLEN_t, uintXLEN_t) @@ -279,7 +283,7 @@ CREATE_RVP_INTRINSIC (uintXLEN_t, ukstas16, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, ukstsa16, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, uksub8, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, uksub16, uintXLEN_t, uintXLEN_t) -CREATE_RVP_INTRINSIC (uint32_t, uksubh, uint32_t, uint32_t) +CREATE_RVP_INTRINSIC (uint32_t, uksubh, uint16_t, uint16_t) CREATE_RVP_INTRINSIC (uint32_t, uksubw, uint32_t, uint32_t) CREATE_RVP_INTRINSIC (uintXLEN_t, umaqa, uintXLEN_t, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, umax8, uintXLEN_t, uintXLEN_t) @@ -513,26 +517,26 @@ CREATE_RVP_INTRINSIC (int32x2_t, v_sra32_u, int32x2_t, const uint32_t) CREATE_RVP_INTRINSIC (int32x2_t, v_sstas32, int32x2_t, int32x2_t) CREATE_RVP_INTRINSIC (int32x2_t, v_sstsa32, int32x2_t, int32x2_t) CREATE_RVP_INTRINSIC (int32x2_t, v_ssub32, int32x2_t, int32x2_t) -CREATE_RVP_INTRINSIC (uint64_t, khmbb16, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, khmbt16, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, khmtt16, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmabb32, int64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmabt32, int64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmadrs32, int64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmads32, int64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmatt32, int64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmaxda32, int64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmaxds32, int64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmda32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmsda32, int64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmsxda32, int64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, kmxda32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, smbb32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, smbt32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, smdrs32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, smds32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, smtt32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (int64_t, smxds32, uint64_t, uint64_t) +CREATE_RVP_INTRINSIC (int64_t, khmbb16, uint64_t, uint64_t) +CREATE_RVP_INTRINSIC (int64_t, khmbt16, uint64_t, uint64_t) +CREATE_RVP_INTRINSIC (int64_t, khmtt16, uint64_t, uint64_t) +CREATE_RVP_INTRINSIC (int64_t, kmabb32, int64_t, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kmabt32, int64_t, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kmatt32, int64_t, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kmadrs32, int64_t, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kmads32, int64_t, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kmaxda32, int64_t, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kmaxds32, int64_t, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kmda32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kmsda32, int64_t, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kmsxda32, int64_t, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kmxda32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, smbb32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, smbt32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, smtt32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, smdrs32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, smds32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, smxds32, int64_t, int64_t) CREATE_RVP_INTRINSIC (int64_t, v_kmabb32, int64_t, int32x2_t, int32x2_t) CREATE_RVP_INTRINSIC (int64_t, v_kmabt32, int64_t, int32x2_t, int32x2_t) CREATE_RVP_INTRINSIC (int64_t, v_kmadrs32, int64_t, int32x2_t, int32x2_t) @@ -583,39 +587,39 @@ CREATE_RVP_INTRINSIC (uint32x2_t, v_usub32, uint32x2_t, uint32x2_t) CREATE_RVP_INTRINSIC (uint64_t, add32, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, cras32, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, crsa32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, kabs32, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, kadd32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, kcras32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, kcrsa32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, kdmabb16, uint64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, kdmabt16, uint64_t, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, kdmatt16, uint64_t, uint64_t, uint64_t) +CREATE_RVP_INTRINSIC (int64_t, kabs32, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kadd32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kcras32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kcrsa32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kdmabb16, int64_t, uint64_t, uint64_t) +CREATE_RVP_INTRINSIC (int64_t, kdmabt16, int64_t, uint64_t, uint64_t) +CREATE_RVP_INTRINSIC (int64_t, kdmatt16, int64_t, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, kdmbb16, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, kdmbt16, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, kdmtt16, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, ksll32, uint64_t, const uint32_t) -CREATE_RVP_INTRINSIC (uint64_t, kslra32, uint64_t, int32_t) -CREATE_RVP_INTRINSIC (uint64_t, kslra32_u, uint64_t, int32_t) -CREATE_RVP_INTRINSIC (uint64_t, kstas32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, kstsa32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, ksub32, uint64_t, uint64_t) +CREATE_RVP_INTRINSIC (int64_t, ksll32, int64_t, const uint32_t) +CREATE_RVP_INTRINSIC (int64_t, kslra32, int64_t, int32_t) +CREATE_RVP_INTRINSIC (int64_t, kslra32_u, int64_t, int32_t) +CREATE_RVP_INTRINSIC (int64_t, kstas32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, kstsa32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, ksub32, int64_t, int64_t) CREATE_RVP_INTRINSIC (uint64_t, pkbb32, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, pkbt32, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, pktb32, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, pktt32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, radd32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, rcras32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, rcrsa32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, rstas32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, rstsa32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, rsub32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, sll32, uint64_t, const uint32_t) -CREATE_RVP_INTRINSIC (uint64_t, smax32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, smin32, uint64_t, uint64_t) -CREATE_RVP_INTRINSIC (uint64_t, sra32, uint64_t, const uint32_t) -CREATE_RVP_INTRINSIC (uint64_t, sra32_u, uint64_t, const uint32_t) -CREATE_RVP_INTRINSIC (uint64_t, srl32, uint64_t, const uint32_t) -CREATE_RVP_INTRINSIC (uint64_t, srl32_u, uint64_t, const uint32_t) +CREATE_RVP_INTRINSIC (int64_t, radd32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, rcras32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, rcrsa32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, rstas32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, rstsa32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, rsub32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, sll32, int64_t, const uint32_t) +CREATE_RVP_INTRINSIC (int64_t, smax32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, smin32, int64_t, int64_t) +CREATE_RVP_INTRINSIC (int64_t, sra32, int64_t, const uint32_t) +CREATE_RVP_INTRINSIC (int64_t, sra32_u, int64_t, const uint32_t) +CREATE_RVP_INTRINSIC (int64_t, srl32, int64_t, const uint32_t) +CREATE_RVP_INTRINSIC (int64_t, srl32_u, int64_t, const uint32_t) CREATE_RVP_INTRINSIC (uint64_t, stas32, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, stsa32, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, sub32, uint64_t, uint64_t) @@ -670,9 +674,9 @@ CREATE_RVP_INTRINSIC (uint16x4_t, v_umulx8, uint8x4_t, uint8x4_t) CREATE_RVP_INTRINSIC (uint32x2_t, v_umul16, uint16x2_t, uint16x2_t) CREATE_RVP_INTRINSIC (uint32x2_t, v_umulx16, uint16x2_t, uint16x2_t) CREATE_RVP_INTRINSIC (uint64_t, mulr64, uint32_t, uint32_t) -CREATE_RVP_INTRINSIC (uint64_t, smul16, uint32_t, uint32_t) +CREATE_RVP_INTRINSIC (int64_t, smul16, uint32_t, uint32_t) CREATE_RVP_INTRINSIC (uint64_t, smul8, uint32_t, uint32_t) -CREATE_RVP_INTRINSIC (uint64_t, smulx16, uint32_t, uint32_t) +CREATE_RVP_INTRINSIC (int64_t, smulx16, uint32_t, uint32_t) CREATE_RVP_INTRINSIC (uint64_t, smulx8, uint32_t, uint32_t) CREATE_RVP_INTRINSIC (uint64_t, ukadd64, uint64_t, uint64_t) CREATE_RVP_INTRINSIC (uint64_t, ukmar64, uint64_t, uintXLEN_t, uintXLEN_t) @@ -719,8 +723,8 @@ CREATE_RVP_INTRINSIC_ALIAS (int64_t, v_kmada32, v_kmar64, int64_t, int32x2_t, in #if defined(__riscv_zbpbo) CREATE_RVP_INTRINSIC (uintXLEN_t, rev, uintXLEN_t) -CREATE_RVP_INTRINSIC (int32_t, max, int32_t, int32_t) -CREATE_RVP_INTRINSIC (int32_t, min, int32_t, int32_t) +CREATE_RVP_INTRINSIC (intXLEN_t, max, intXLEN_t, intXLEN_t) +CREATE_RVP_INTRINSIC (intXLEN_t, min, intXLEN_t, intXLEN_t) CREATE_RVP_INTRINSIC (uintXLEN_t, cmix, uintXLEN_t, uintXLEN_t, uintXLEN_t) CREATE_RVP_INTRINSIC_ALIAS (uintXLEN_t, rev8h, swap8, uintXLEN_t) __extension__ extern __inline __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))