;; Vector-scalar Integer add: vadd.vx
;; Optimize the const vector that all elements
;; are 5-bit signed immediate value with
;; vadd.vi.
(define_insn "@vadd_xcal<mode>_vx_internal"
[(set (match_operand:VI 0 "register_operand" "=vd,vd,vd,vd, vr,vr,vr,vr")
(unspec:VI
[(unspec:VI
[(match_operand:<VM> 1 "vector_reg_or_const0_operand" "vm,vm,vm,vm, J,J,J,J")
(plus:VI
(match_operand:VI 3 "register_operand" "vr,vr,vr,vr, vr,vr,vr,vr")
(vec_duplicate:VI
(match_operand:<VSUB> 4 "reg_or_simm5_operand" "r,r,Ws5,Ws5, r,r,Ws5,Ws5")))
(match_operand:VI 2 "vector_reg_or_const0_operand" "0,J,0,J, 0,J,0,J")
] UNSPEC_SELECT)
(match_operand 5 "p_reg_or_const_csr_operand" "rK,rK,rK,rK, rK,rK,rK,rK")
(match_operand 6 "const_int_operand")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_RVV))
(clobber (match_operand 7 "pmode_register_operand" "=&r,&r,&r,&r,&r,&r,&r,&r"))]
"TARGET_VECTOR"
"@
vadd_xcal.vx\t%0,%3,%4,%1.t
vadd_xcal.vx\t%0,%3,%4,%1.t
vadd_xcal.vi\t%0,%3,%4,%1.t
vadd_xcal.vi\t%0,%3,%4,%1.t
vadd_xcal.vx\t%0,%3,%4
vadd_xcal.vx\t%0,%3,%4
vadd_xcal.vi\t%0,%3,%4
vadd_xcal.vi\t%0,%3,%4"
[(set_attr "type" "varith")
(set_attr "mode" "<MODE>")])
(define_insn "@vadd_xcal<mode>_vx_32bit"
[(set (match_operand:V64BITI 0 "register_operand" "=vd,vd,vd,vd,vr,vr,vr,vr")
(unspec:V64BITI
[(unspec:V64BITI
[(unspec:V64BITI
[(match_operand:<VM> 1 "vector_reg_or_const0_operand" "vm,vm,vm,vm,J,J,J,J")
(plus:V64BITI
(match_operand:V64BITI 3 "register_operand" "vr,vr,vr,vr,vr,vr,vr,vr")
(vec_duplicate:V64BITI
(sign_extend:<VSUB>
(match_operand:SI 4 "reg_or_simm5_operand" "r,Ws5,r,Ws5,r,Ws5,r,Ws5"))))
(match_operand:V64BITI 2 "vector_reg_or_const0_operand" "0,0,J,J,0,0,J,J")
] UNSPEC_SELECT)
(match_operand:SI 5 "csr_operand" "rK,rK,rK,rK,rK,rK,rK,rK")
(match_operand:SI 6 "const_int_operand")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_RVV))
(clobber (match_operand 7 "pmode_register_operand" "=&r,&r,&r,&r,&r,&r,&r,&r"))]
"TARGET_VECTOR"
"@
vadd_xcal.vx\t%0,%3,%4,%1.t
vadd_xcal.vi\t%0,%3,%4,%1.t
vadd_xcal.vx\t%0,%3,%4,%1.t
vadd_xcal.vi\t%0,%3,%4,%1.t
vadd_xcal.vx\t%0,%3,%4
vadd_xcal.vi\t%0,%3,%4
vadd_xcal.vx\t%0,%3,%4
vadd_xcal.vi\t%0,%3,%4"
[(set_attr "type" "varith")
(set_attr "mode" "<MODE>")])