;; Machine description for the RISC-V Vector Crypto extensions.
;; Copyright (C) 2024 Free Software Foundation, Inc.
;; This file is part of GCC.
;; GCC is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GCC is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3. If not see
;; .
(define_c_enum "unspec" [
;; Zvbb unspecs
UNSPEC_VBREV
UNSPEC_VBREV8
UNSPEC_VREV8
UNSPEC_VCLMUL
UNSPEC_VCLMULH
UNSPEC_VGHSH
UNSPEC_VGMUL
UNSPEC_VAESEF
UNSPEC_VAESEFVV
UNSPEC_VAESEFVS
UNSPEC_VAESEM
UNSPEC_VAESEMVV
UNSPEC_VAESEMVS
UNSPEC_VAESDF
UNSPEC_VAESDFVV
UNSPEC_VAESDFVS
UNSPEC_VAESDM
UNSPEC_VAESDMVV
UNSPEC_VAESDMVS
UNSPEC_VAESZ
UNSPEC_VAESZVVNULL
UNSPEC_VAESZVS
UNSPEC_VAESKF1
UNSPEC_VAESKF2
UNSPEC_VSHA2MS
UNSPEC_VSHA2CH
UNSPEC_VSHA2CL
UNSPEC_VSM4K
UNSPEC_VSM4R
UNSPEC_VSM4RVV
UNSPEC_VSM4RVS
UNSPEC_VSM3ME
UNSPEC_VSM3C
])
(define_int_attr rev [(UNSPEC_VBREV "brev") (UNSPEC_VBREV8 "brev8") (UNSPEC_VREV8 "rev8")])
(define_int_attr h [(UNSPEC_VCLMUL "") (UNSPEC_VCLMULH "h")])
(define_int_attr vv_ins_name [(UNSPEC_VGMUL "gmul" ) (UNSPEC_VAESEFVV "aesef")
(UNSPEC_VAESEMVV "aesem") (UNSPEC_VAESDFVV "aesdf")
(UNSPEC_VAESDMVV "aesdm") (UNSPEC_VAESEFVS "aesef")
(UNSPEC_VAESEMVS "aesem") (UNSPEC_VAESDFVS "aesdf")
(UNSPEC_VAESDMVS "aesdm") (UNSPEC_VAESZVS "aesz" )
(UNSPEC_VSM4RVV "sm4r" ) (UNSPEC_VSM4RVS "sm4r" )])
(define_int_attr vv_ins1_name [(UNSPEC_VGHSH "ghsh") (UNSPEC_VSHA2MS "sha2ms")
(UNSPEC_VSHA2CH "sha2ch") (UNSPEC_VSHA2CL "sha2cl")])
(define_int_attr vi_ins_name [(UNSPEC_VAESKF1 "aeskf1") (UNSPEC_VSM4K "sm4k")])
(define_int_attr vi_ins1_name [(UNSPEC_VAESKF2 "aeskf2") (UNSPEC_VSM3C "sm3c")])
(define_int_attr ins_type [(UNSPEC_VGMUL "vv") (UNSPEC_VAESEFVV "vv")
(UNSPEC_VAESEMVV "vv") (UNSPEC_VAESDFVV "vv")
(UNSPEC_VAESDMVV "vv") (UNSPEC_VAESEFVS "vs")
(UNSPEC_VAESEMVS "vs") (UNSPEC_VAESDFVS "vs")
(UNSPEC_VAESDMVS "vs") (UNSPEC_VAESZVS "vs")
(UNSPEC_VSM4RVV "vv") (UNSPEC_VSM4RVS "vs")])
(define_int_iterator UNSPEC_VRBB8 [UNSPEC_VBREV UNSPEC_VBREV8 UNSPEC_VREV8])
(define_int_iterator UNSPEC_CLMUL_VC [UNSPEC_VCLMUL UNSPEC_VCLMULH])
(define_int_iterator UNSPEC_CRYPTO_VV [UNSPEC_VGMUL UNSPEC_VAESEFVV UNSPEC_VAESEMVV
UNSPEC_VAESDFVV UNSPEC_VAESDMVV UNSPEC_VAESEFVS
UNSPEC_VAESEMVS UNSPEC_VAESDFVS UNSPEC_VAESDMVS
UNSPEC_VAESZVS UNSPEC_VSM4RVV UNSPEC_VSM4RVS])
(define_int_iterator UNSPEC_VGNHAB [UNSPEC_VGHSH UNSPEC_VSHA2MS UNSPEC_VSHA2CH UNSPEC_VSHA2CL])
(define_int_iterator UNSPEC_CRYPTO_VI [UNSPEC_VAESKF1 UNSPEC_VSM4K])
(define_int_iterator UNSPEC_CRYPTO_VI1 [UNSPEC_VAESKF2 UNSPEC_VSM3C])
;; zvbb instructions patterns.
;; vandn.vv vandn.vx vrol.vv vrol.vx
;; vror.vv vror.vx vror.vi
;; vwsll.vv vwsll.vx vwsll.vi
(define_insn "@pred_vandn"
[(set (match_operand:V_VLSI 0 "register_operand" "=vd, vr, vd, vr")
(if_then_else:V_VLSI
(unspec:
[(match_operand: 1 "vector_mask_operand" "vm,Wc1, vm,Wc1")
(match_operand 5 "vector_length_operand" "rK, rK, rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(and:V_VLSI
(not:V_VLSI
(match_operand:V_VLSI 4 "register_operand" "vr, vr, vr, vr"))
(match_operand:V_VLSI 3 "register_operand" "vr, vr, vr, vr"))
(match_operand:V_VLSI 2 "vector_merge_operand" "vu, vu, 0, 0")))]
"TARGET_ZVBB || TARGET_ZVKB"
"vandn.vv\t%0,%3,%4%p1"
[(set_attr "type" "vandn")
(set_attr "mode" "")])
(define_insn "@pred_vandn_scalar"
[(set (match_operand:V_VLSI_QHS 0 "register_operand" "=vd, vr,vd, vr")
(if_then_else:V_VLSI_QHS
(unspec:
[(match_operand: 1 "vector_mask_operand" " vm,Wc1,vm,Wc1")
(match_operand 5 "vector_length_operand" " rK, rK,rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(and:V_VLSI_QHS
(not:V_VLSI_QHS
(vec_duplicate:V_VLSI_QHS
(match_operand: 4 "register_operand" " r, r, r, r")))
(match_operand:V_VLSI_QHS 3 "register_operand" "vr, vr,vr, vr"))
(match_operand:V_VLSI_QHS 2 "vector_merge_operand" "vu, vu, 0, 0")))]
"TARGET_ZVBB || TARGET_ZVKB"
"vandn.vx\t%0,%3,%4%p1"
[(set_attr "type" "vandn")
(set_attr "mode" "")])
;; Handle GET_MODE_INNER (mode) = DImode. We need to split them since
;; we need to deal with SEW = 64 in RV32 system.
(define_expand "@pred_vandn_scalar"
[(set (match_operand:V_VLSI_D 0 "register_operand")
(if_then_else:V_VLSI_D
(unspec:
[(match_operand: 1 "vector_mask_operand")
(match_operand 5 "vector_length_operand")
(match_operand 6 "const_int_operand")
(match_operand 7 "const_int_operand")
(match_operand 8 "const_int_operand")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(and:V_VLSI_D
(not:V_VLSI_D
(vec_duplicate:V_VLSI_D
(match_operand: 4 "reg_or_int_operand")))
(match_operand:V_VLSI_D 3 "register_operand"))
(match_operand:V_VLSI_D 2 "vector_merge_operand")))]
"TARGET_ZVBB || TARGET_ZVKB"
{
if (riscv_vector::sew64_scalar_helper (
operands,
/* scalar op */&operands[4],
/* vl */operands[5],
mode,
false,
[] (rtx *operands, rtx broadcast_scalar) {
emit_insn (gen_pred_vandn (operands[0], operands[1],
operands[2], operands[3], broadcast_scalar, operands[5],
operands[6], operands[7], operands[8]));
},
(riscv_vector::avl_type) INTVAL (operands[8])))
DONE;
})
(define_insn "*pred_vandn_scalar"
[(set (match_operand:V_VLSI_D 0 "register_operand" "=vd, vr,vd, vr")
(if_then_else:V_VLSI_D
(unspec:
[(match_operand: 1 "vector_mask_operand" " vm,Wc1,vm,Wc1")
(match_operand 5 "vector_length_operand" " rK, rK,rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(and:V_VLSI_D
(not:V_VLSI_D
(vec_duplicate:V_VLSI_D
(match_operand: 4 "reg_or_0_operand" " rJ, rJ,rJ, rJ")))
(match_operand:V_VLSI_D 3 "register_operand" " vr, vr,vr, vr"))
(match_operand:V_VLSI_D 2 "vector_merge_operand" " vu, vu, 0, 0")))]
"TARGET_ZVBB || TARGET_ZVKB"
"vandn.vx\t%0,%3,%z4%p1"
[(set_attr "type" "vandn")
(set_attr "mode" "")])
(define_insn "*pred_vandn_extended_scalar"
[(set (match_operand:V_VLSI_D 0 "register_operand" "=vd, vr,vd, vr")
(if_then_else:V_VLSI_D
(unspec:
[(match_operand: 1 "vector_mask_operand" " vm,Wc1,vm,Wc1")
(match_operand 5 "vector_length_operand" " rK, rK,rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(and:V_VLSI_D
(not:V_VLSI_D
(vec_duplicate:V_VLSI_D
(sign_extend:
(match_operand: 4 "reg_or_0_operand" " rJ, rJ,rJ, rJ"))))
(match_operand:V_VLSI_D 3 "register_operand" " vr, vr,vr, vr"))
(match_operand:V_VLSI_D 2 "vector_merge_operand" " vu, vu, 0, 0")))]
"TARGET_ZVBB || TARGET_ZVKB"
"vandn.vx\t%0,%3,%z4%p1"
[(set_attr "type" "vandn")
(set_attr "mode" "")])
(define_insn "@pred_v"
[(set (match_operand:VI 0 "register_operand" "=vd,vd, vr, vr")
(if_then_else:VI
(unspec:
[(match_operand: 1 "vector_mask_operand" " vm,vm,Wc1,Wc1")
(match_operand 5 "vector_length_operand" " rK,rK, rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(bitmanip_rotate:VI
(match_operand:VI 3 "register_operand" " vr,vr, vr, vr")
(match_operand:VI 4 "register_operand" " vr,vr, vr, vr"))
(match_operand:VI 2 "vector_merge_operand" " vu, 0, vu, 0")))]
"TARGET_ZVBB || TARGET_ZVKB"
"v.vv\t%0,%3,%4%p1"
[(set_attr "type" "v")
(set_attr "mode" "")])
(define_insn "@pred_v_scalar"
[(set (match_operand:VI 0 "register_operand" "=vd,vd, vr, vr")
(if_then_else:VI
(unspec:
[(match_operand: 1 "vector_mask_operand" " vm,vm,Wc1,Wc1")
(match_operand 5 "vector_length_operand" " rK,rK, rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(bitmanip_rotate:VI
(match_operand:VI 3 "register_operand" " vr,vr, vr, vr")
(match_operand 4 "pmode_register_operand" " r, r, r, r"))
(match_operand:VI 2 "vector_merge_operand" " vu, 0, vu, 0")))]
"TARGET_ZVBB || TARGET_ZVKB"
"v.vx\t%0,%3,%4%p1"
[(set_attr "type" "v")
(set_attr "mode" "")])
(define_insn "*pred_vror_scalar"
[(set (match_operand:VI 0 "register_operand" "=vd,vd, vr,vr")
(if_then_else:VI
(unspec:
[(match_operand: 1 "vector_mask_operand" " vm,vm,Wc1,Wc1")
(match_operand 5 "vector_length_operand" " rK,rK, rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(rotatert:VI
(match_operand:VI 3 "register_operand" " vr,vr, vr, vr")
(match_operand 4 "const_csr_operand" " K, K, K, K"))
(match_operand:VI 2 "vector_merge_operand" " vu, 0, vu, 0")))]
"TARGET_ZVBB || TARGET_ZVKB"
"vror.vi\t%0,%3,%4%p1"
[(set_attr "type" "vror")
(set_attr "mode" "")])
(define_insn "@pred_vwsll"
[(set (match_operand:VWEXTI 0 "register_operand" "=&vr")
(if_then_else:VWEXTI
(unspec:
[(match_operand: 1 "vector_mask_operand" "vmWc1")
(match_operand 5 "vector_length_operand" " rK")
(match_operand 6 "const_int_operand" " i")
(match_operand 7 "const_int_operand" " i")
(match_operand 8 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(ashift:VWEXTI
(zero_extend:VWEXTI
(match_operand: 3 "register_operand" "vr"))
(match_operand: 4 "vector_shift_operand" "vrvk"))
(match_operand:VWEXTI 2 "vector_merge_operand" "0vu")))]
"TARGET_ZVBB"
"vwsll.v%o4\t%0,%3,%4%p1"
[(set_attr "type" "vwsll")
(set_attr "mode" "")])
(define_insn "@pred_vwsll_scalar"
[(set (match_operand:VWEXTI 0 "register_operand" "=&vr, &vr")
(if_then_else:VWEXTI
(unspec:
[(match_operand: 1 "vector_mask_operand" "vmWc1, vmWc1")
(match_operand 5 "vector_length_operand" " rK, rK")
(match_operand 6 "const_int_operand" " i, i")
(match_operand 7 "const_int_operand" " i, i")
(match_operand 8 "const_int_operand" " i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(ashift:VWEXTI
(zero_extend:VWEXTI
(match_operand: 3 "register_operand" " vr, vr"))
(match_operand 4 "pmode_reg_or_uimm5_operand" " rK, rK"))
(match_operand:VWEXTI 2 "vector_merge_operand" " vu, 0")))]
"TARGET_ZVBB"
"vwsll.v%o4\t%0,%3,%4%p1"
[(set_attr "type" "vwsll")
(set_attr "mode" "")])
;; vbrev.v vbrev8.v vrev8.v
(define_insn "@pred_v"
[(set (match_operand:V_VLSI 0 "register_operand" "=vd,vr,vd,vr")
(if_then_else:V_VLSI
(unspec:
[(match_operand: 1 "vector_mask_operand" "vm,Wc1,vm,Wc1")
(match_operand 4 "vector_length_operand" "rK,rK, rK, rK")
(match_operand 5 "const_int_operand" "i, i, i, i")
(match_operand 6 "const_int_operand" "i, i, i, i")
(match_operand 7 "const_int_operand" "i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:V_VLSI
[(match_operand:V_VLSI 3 "register_operand" "vr,vr, vr, vr")]UNSPEC_VRBB8)
(match_operand:V_VLSI 2 "vector_merge_operand" "vu,vu, 0, 0")))]
"TARGET_ZVBB || TARGET_ZVKB"
"v.v\t%0,%3%p1"
[(set_attr "type" "v")
(set_attr "mode" "")])
;; vclz.v vctz.v vcpop.v
(define_insn "@pred_v"
[(set (match_operand:V_VLSI 0 "register_operand" "=vd, vr")
(clz_ctz_pcnt:V_VLSI
(parallel
[(match_operand:V_VLSI 2 "register_operand" " vr, vr")
(unspec:
[(match_operand: 1 "vector_mask_operand" " vm,Wc1")
(match_operand 3 "vector_length_operand" " rK, rK")
(match_operand 4 "const_int_operand" " i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)])))]
"TARGET_ZVBB"
"v.v\t%0,%2%p1"
[(set_attr "type" "v")
(set_attr "mode" "")])
;; zvbc instructions patterns.
;; vclmul.vv vclmul.vx
;; vclmulh.vv vclmulh.vx
(define_insn "@pred_vclmul"
[(set (match_operand:VI_D 0 "register_operand" "=vd,vr,vd, vr")
(if_then_else:VI_D
(unspec:
[(match_operand: 1 "vector_mask_operand" "vm,Wc1,vm,Wc1")
(match_operand 5 "vector_length_operand" "rK, rK,rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:VI_D
[(match_operand:VI_D 3 "register_operand" "vr, vr,vr, vr")
(match_operand:VI_D 4 "register_operand" "vr, vr,vr, vr")] UNSPEC_CLMUL_VC)
(match_operand:VI_D 2 "vector_merge_operand" "vu, vu, 0, 0")))]
"TARGET_ZVBC"
"vclmul.vv\t%0,%3,%4%p1"
[(set_attr "type" "vclmul")
(set_attr "mode" "")])
;; Deal with SEW = 64 in RV32 system.
(define_expand "@pred_vclmul_scalar"
[(set (match_operand:VI_D 0 "register_operand")
(if_then_else:VI_D
(unspec:
[(match_operand: 1 "vector_mask_operand")
(match_operand 5 "vector_length_operand")
(match_operand 6 "const_int_operand")
(match_operand 7 "const_int_operand")
(match_operand 8 "const_int_operand")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:VI_D
[(vec_duplicate:VI_D
(match_operand: 4 "register_operand"))
(match_operand:VI_D 3 "register_operand")] UNSPEC_CLMUL_VC)
(match_operand:VI_D 2 "vector_merge_operand")))]
"TARGET_ZVBC"
{
if (riscv_vector::sew64_scalar_helper (
operands,
/* scalar op */&operands[4],
/* vl */operands[5],
mode,
false,
[] (rtx *operands, rtx broadcast_scalar) {
emit_insn (gen_pred_vclmul (operands[0], operands[1],
operands[2], operands[3], broadcast_scalar, operands[5],
operands[6], operands[7], operands[8]));
},
(riscv_vector::avl_type) INTVAL (operands[8])))
DONE;
})
(define_insn "*pred_vclmul_scalar"
[(set (match_operand:VI_D 0 "register_operand" "=vd,vr,vd, vr")
(if_then_else:VI_D
(unspec:
[(match_operand: 1 "vector_mask_operand" "vm,Wc1,vm,Wc1")
(match_operand 5 "vector_length_operand" "rK, rK,rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:VI_D
[(vec_duplicate:VI_D
(match_operand: 4 "reg_or_0_operand" "rJ, rJ,rJ, rJ"))
(match_operand:VI_D 3 "register_operand" "vr, vr,vr, vr")] UNSPEC_CLMUL_VC)
(match_operand:VI_D 2 "vector_merge_operand" "vu, vu, 0, 0")))]
"TARGET_ZVBC"
"vclmul.vx\t%0,%3,%4%p1"
[(set_attr "type" "vclmul")
(set_attr "mode" "")])
(define_insn "*pred_vclmul_extend_scalar"
[(set (match_operand:VI_D 0 "register_operand" "=vd,vr,vd, vr")
(if_then_else:VI_D
(unspec:
[(match_operand: 1 "vector_mask_operand" "vm,Wc1,vm,Wc1")
(match_operand 5 "vector_length_operand" "rK, rK,rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:VI_D
[(vec_duplicate:VI_D
(sign_extend:
(match_operand: 4 "reg_or_0_operand" " rJ, rJ,rJ, rJ")))
(match_operand:VI_D 3 "register_operand" "vr, vr,vr, vr")] UNSPEC_CLMUL_VC)
(match_operand:VI_D 2 "vector_merge_operand" "vu, vu, 0, 0")))]
"TARGET_ZVBC"
"vclmul.vx\t%0,%3,%4%p1"
[(set_attr "type" "vclmul")
(set_attr "mode" "")])
;; zvknh[ab] and zvkg instructions patterns.
;; vsha2ms.vv vsha2ch.vv vsha2cl.vv vghsh.vv
(define_insn "@pred_v"
[(set (match_operand:VQEXTI 0 "register_operand" "=vr")
(if_then_else:VQEXTI
(unspec:
[(match_operand 4 "vector_length_operand" "rK")
(match_operand 5 "const_int_operand" " i")
(match_operand 6 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:VQEXTI
[(match_operand:VQEXTI 1 "register_operand" " 0")
(match_operand:VQEXTI 2 "register_operand" "vr")
(match_operand:VQEXTI 3 "register_operand" "vr")] UNSPEC_VGNHAB)
(match_dup 1)))]
"TARGET_ZVKNHA || TARGET_ZVKNHB || TARGET_ZVKG"
"v.vv\t%0,%2,%3"
[(set_attr "type" "v")
(set_attr "mode" "")])
;; zvkned and zvksed amd zvkg instructions patterns.
;; vgmul.vv vaesz.vs
;; vaesef.[vv,vs] vaesem.[vv,vs] vaesdf.[vv,vs] vaesdm.[vv,vs]
;; vsm4r.[vv,vs]
(define_insn "@pred_crypto_vv"
[(set (match_operand:VSI 0 "register_operand" "=vr")
(if_then_else:VSI
(unspec:
[(match_operand 3 "vector_length_operand" " rK")
(match_operand 4 "const_int_operand" " i")
(match_operand 5 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:VSI
[(match_operand:VSI 1 "register_operand" " 0")
(match_operand:VSI 2 "register_operand" "vr")] UNSPEC_CRYPTO_VV)
(match_dup 1)))]
"TARGET_ZVKNED || TARGET_ZVKSED || TARGET_ZVKG"
"v.\t%0,%2"
[(set_attr "type" "v")
(set_attr "mode" "")])
(define_insn "@pred_crypto_vvx1_scalar"
[(set (match_operand:VSI 0 "register_operand" "=&vr")
(if_then_else:VSI
(unspec:
[(match_operand 3 "vector_length_operand" " rK")
(match_operand 4 "const_int_operand" " i")
(match_operand 5 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:VSI
[(match_operand:VSI 1 "register_operand" " 0")
(match_operand:VSI 2 "register_operand" "vr")] UNSPEC_CRYPTO_VV)
(match_dup 1)))]
"TARGET_ZVKNED || TARGET_ZVKSED"
"v.\t%0,%2"
[(set_attr "type" "v")
(set_attr "mode" "")])
(define_insn "@pred_crypto_vvx2_scalar"
[(set (match_operand: 0 "register_operand" "=&vr")
(if_then_else:
(unspec:
[(match_operand 3 "vector_length_operand" "rK")
(match_operand 4 "const_int_operand" " i")
(match_operand 5 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:
[(match_operand: 1 "register_operand" " 0")
(match_operand:VLMULX2_SI 2 "register_operand" "vr")] UNSPEC_CRYPTO_VV)
(match_dup 1)))]
"TARGET_ZVKNED || TARGET_ZVKSED"
"v.\t%0,%2"
[(set_attr "type" "v")
(set_attr "mode" "")])
(define_insn "@pred_crypto_vvx4_scalar"
[(set (match_operand: 0 "register_operand" "=&vr")
(if_then_else:
(unspec:
[(match_operand 3 "vector_length_operand" " rK")
(match_operand 4 "const_int_operand" " i")
(match_operand 5 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:
[(match_operand: 1 "register_operand" " 0")
(match_operand:VLMULX4_SI 2 "register_operand" "vr")] UNSPEC_CRYPTO_VV)
(match_dup 1)))]
"TARGET_ZVKNED || TARGET_ZVKSED"
"v.\t%0,%2"
[(set_attr "type" "v")
(set_attr "mode" "")])
(define_insn "@pred_crypto_vvx8_scalar"
[(set (match_operand: 0 "register_operand" "=&vr")
(if_then_else:
(unspec:
[(match_operand 3 "vector_length_operand" " rK")
(match_operand 4 "const_int_operand" " i")
(match_operand 5 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:
[(match_operand: 1 "register_operand" " 0")
(match_operand:VLMULX8_SI 2 "register_operand" " vr")] UNSPEC_CRYPTO_VV)
(match_dup 1)))]
"TARGET_ZVKNED || TARGET_ZVKSED"
"v.\t%0,%2"
[(set_attr "type" "v")
(set_attr "mode" "")])
(define_insn "@pred_crypto_vvx16_scalar"
[(set (match_operand: 0 "register_operand" "=&vr")
(if_then_else:
(unspec:
[(match_operand 3 "vector_length_operand" " rK")
(match_operand 4 "const_int_operand" " i")
(match_operand 5 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:
[(match_operand: 1 "register_operand" " 0")
(match_operand:VLMULX16_SI 2 "register_operand" " vr")] UNSPEC_CRYPTO_VV)
(match_dup 1)))]
"TARGET_ZVKNED || TARGET_ZVKSED"
"v.\t%0,%2"
[(set_attr "type" "v")
(set_attr "mode" "")])
;; vaeskf1.vi vsm4k.vi
(define_insn "@pred_crypto_vi_scalar"
[(set (match_operand:VSI 0 "register_operand" "=vr, vr")
(if_then_else:VSI
(unspec:
[(match_operand 4 "vector_length_operand" "rK, rK")
(match_operand 5 "const_int_operand" " i, i")
(match_operand 6 "const_int_operand" " i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:VSI
[(match_operand:VSI 2 "register_operand" "vr, vr")
(match_operand 3 "const_int_operand" " i, i")] UNSPEC_CRYPTO_VI)
(match_operand:VSI 1 "vector_merge_operand" "vu, 0")))]
"TARGET_ZVKNED || TARGET_ZVKSED"
"v.vi\t%0,%2,%3"
[(set_attr "type" "v")
(set_attr "mode" "")])
;; vaeskf2.vi vsm3c.vi
(define_insn "@pred_vi_nomaskedoff_scalar"
[(set (match_operand:VSI 0 "register_operand" "=vr")
(if_then_else:VSI
(unspec:
[(match_operand 4 "vector_length_operand" "rK")
(match_operand 5 "const_int_operand" " i")
(match_operand 6 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:VSI
[(match_operand:VSI 1 "register_operand" " 0")
(match_operand:VSI 2 "register_operand" "vr")
(match_operand 3 "const_int_operand" " i")] UNSPEC_CRYPTO_VI1)
(match_dup 1)))]
"TARGET_ZVKNED || TARGET_ZVKSH"
"v.vi\t%0,%2,%3"
[(set_attr "type" "v")
(set_attr "mode" "")])
;; zvksh instructions patterns.
;; vsm3me.vv
(define_insn "@pred_vsm3me"
[(set (match_operand:VSI 0 "register_operand" "=vr, vr")
(if_then_else:VSI
(unspec:
[(match_operand 4 "vector_length_operand" " rK, rK")
(match_operand 5 "const_int_operand" " i, i")
(match_operand 6 "const_int_operand" " i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(unspec:VSI
[(match_operand:VSI 2 "register_operand" " vr, vr")
(match_operand:VSI 3 "register_operand" " vr, vr")] UNSPEC_VSM3ME)
(match_operand:VSI 1 "vector_merge_operand" " vu, 0")))]
"TARGET_ZVKSH"
"vsm3me.vv\t%0,%2,%3"
[(set_attr "type" "vsm3me")
(set_attr "mode" "")])