Support VLS floating-point FMA/FNMA/FMS patterns.
Regression no difference after this patch, Committed.
gcc/ChangeLog:
* config/riscv/autovec.md: Extend VLS floating-point modes.
* config/riscv/vector.md: Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/vls/def.h: Add FMS tests.
* gcc.target/riscv/rvv/autovec/vls/fma-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fma-6.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fma-7.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fms-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fms-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fms-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnma-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnma-6.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnma-7.c: New test.
;; -------------------------------------------------------------------------
(define_insn_and_split "fma<mode>4"
- [(set (match_operand:VF 0 "register_operand")
- (plus:VF
- (mult:VF
- (match_operand:VF 1 "register_operand")
- (match_operand:VF 2 "register_operand"))
- (match_operand:VF 3 "register_operand")))]
+ [(set (match_operand:V_VLSF 0 "register_operand")
+ (plus:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 1 "register_operand")
+ (match_operand:V_VLSF 2 "register_operand"))
+ (match_operand:V_VLSF 3 "register_operand")))]
"TARGET_VECTOR && can_create_pseudo_p ()"
"#"
"&& 1"
;; -------------------------------------------------------------------------
(define_insn_and_split "fnma<mode>4"
- [(set (match_operand:VF 0 "register_operand")
- (minus:VF
- (match_operand:VF 3 "register_operand")
- (mult:VF
- (match_operand:VF 1 "register_operand")
- (match_operand:VF 2 "register_operand"))))]
+ [(set (match_operand:V_VLSF 0 "register_operand")
+ (minus:V_VLSF
+ (match_operand:V_VLSF 3 "register_operand")
+ (mult:V_VLSF
+ (match_operand:V_VLSF 1 "register_operand")
+ (match_operand:V_VLSF 2 "register_operand"))))]
"TARGET_VECTOR && can_create_pseudo_p ()"
"#"
"&& 1"
;; -------------------------------------------------------------------------
(define_insn_and_split "fms<mode>4"
- [(set (match_operand:VF 0 "register_operand")
- (minus:VF
- (mult:VF
- (match_operand:VF 1 "register_operand")
- (match_operand:VF 2 "register_operand"))
- (match_operand:VF 3 "register_operand")))]
+ [(set (match_operand:V_VLSF 0 "register_operand")
+ (minus:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 1 "register_operand")
+ (match_operand:V_VLSF 2 "register_operand"))
+ (match_operand:V_VLSF 3 "register_operand")))]
"TARGET_VECTOR && can_create_pseudo_p ()"
"#"
"&& 1"
;; -------------------------------------------------------------------------
(define_insn_and_split "fnms<mode>4"
- [(set (match_operand:VF 0 "register_operand")
- (minus:VF
- (neg:VF
- (mult:VF
- (match_operand:VF 1 "register_operand")
- (match_operand:VF 2 "register_operand")))
- (match_operand:VF 3 "register_operand")))]
+ [(set (match_operand:V_VLSF 0 "register_operand")
+ (minus:V_VLSF
+ (neg:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 1 "register_operand")
+ (match_operand:V_VLSF 2 "register_operand")))
+ (match_operand:V_VLSF 3 "register_operand")))]
"TARGET_VECTOR && can_create_pseudo_p ()"
"#"
"&& 1"
;; -------------------------------------------------------------------------------
(define_expand "@pred_mul_<optab><mode>"
- [(set (match_operand:VF 0 "register_operand")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand")
(match_operand 6 "vector_length_operand")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (mult:VF
- (match_operand:VF 2 "register_operand")
- (match_operand:VF 3 "register_operand"))
- (match_operand:VF 4 "register_operand"))
- (match_operand:VF 5 "vector_merge_operand")))]
+ (plus_minus:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 2 "register_operand")
+ (match_operand:V_VLSF 3 "register_operand"))
+ (match_operand:V_VLSF 4 "register_operand"))
+ (match_operand:V_VLSF 5 "vector_merge_operand")))]
"TARGET_VECTOR"
{
riscv_vector::prepare_ternary_operands (operands);
})
(define_insn "*pred_mul_<optab><mode>_undef"
- [(set (match_operand:VF 0 "register_operand" "=vd,vd,?&vd, vr, vr,?&vr")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd,vd,?&vd, vr, vr,?&vr")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm,vm, vm,Wc1,Wc1, Wc1")
(match_operand 6 "vector_length_operand" " rK,rK, rK, rK, rK, rK")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (mult:VF
- (match_operand:VF 3 "register_operand" " 0,vr, vr, 0, vr, vr")
- (match_operand:VF 4 "register_operand" " vr,vr, vr, vr, vr, vr"))
- (match_operand:VF 5 "register_operand" " vr, 0, vr, vr, 0, vr"))
- (match_operand:VF 2 "vector_undef_operand")))]
+ (plus_minus:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 3 "register_operand" " 0,vr, vr, 0, vr, vr")
+ (match_operand:V_VLSF 4 "register_operand" " vr,vr, vr, vr, vr, vr"))
+ (match_operand:V_VLSF 5 "register_operand" " vr, 0, vr, vr, 0, vr"))
+ (match_operand:V_VLSF 2 "vector_undef_operand")))]
"TARGET_VECTOR"
"@
vf<madd_msub>.vv\t%0,%4,%5%p1
(symbol_ref "riscv_vector::get_frm_mode (operands[10])"))])
(define_insn "*pred_<madd_msub><mode>"
- [(set (match_operand:VF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
(match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (mult:VF
- (match_operand:VF 2 "register_operand" " 0, vr, 0, vr")
- (match_operand:VF 3 "register_operand" " vr, vr, vr, vr"))
- (match_operand:VF 4 "register_operand" " vr, vr, vr, vr"))
+ (plus_minus:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 2 "register_operand" " 0, vr, 0, vr")
+ (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr"))
+ (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr"))
(match_dup 2)))]
"TARGET_VECTOR"
"@
(symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
(define_insn "*pred_<macc_msac><mode>"
- [(set (match_operand:VF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
(match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (mult:VF
- (match_operand:VF 2 "register_operand" " vr, vr, vr, vr")
- (match_operand:VF 3 "register_operand" " vr, vr, vr, vr"))
- (match_operand:VF 4 "register_operand" " 0, vr, 0, vr"))
+ (plus_minus:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 2 "register_operand" " vr, vr, vr, vr")
+ (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr"))
+ (match_operand:V_VLSF 4 "register_operand" " 0, vr, 0, vr"))
(match_dup 4)))]
"TARGET_VECTOR"
"@
(symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
(define_expand "@pred_mul_<optab><mode>_scalar"
- [(set (match_operand:VF 0 "register_operand")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand")
(match_operand 6 "vector_length_operand")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (mult:VF
- (vec_duplicate:VF
+ (plus_minus:V_VLSF
+ (mult:V_VLSF
+ (vec_duplicate:V_VLSF
(match_operand:<VEL> 2 "register_operand"))
- (match_operand:VF 3 "register_operand"))
- (match_operand:VF 4 "register_operand"))
- (match_operand:VF 5 "register_operand")))]
+ (match_operand:V_VLSF 3 "register_operand"))
+ (match_operand:V_VLSF 4 "register_operand"))
+ (match_operand:V_VLSF 5 "register_operand")))]
"TARGET_VECTOR"
{})
(define_insn "*pred_<madd_msub><mode>_scalar"
- [(set (match_operand:VF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
(match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (mult:VF
- (vec_duplicate:VF
+ (plus_minus:V_VLSF
+ (mult:V_VLSF
+ (vec_duplicate:V_VLSF
(match_operand:<VEL> 2 "register_operand" " f, f, f, f"))
- (match_operand:VF 3 "register_operand" " 0, vr, 0, vr"))
- (match_operand:VF 4 "register_operand" " vr, vr, vr, vr"))
+ (match_operand:V_VLSF 3 "register_operand" " 0, vr, 0, vr"))
+ (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr"))
(match_dup 3)))]
"TARGET_VECTOR"
"@
(symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
(define_insn "*pred_<macc_msac><mode>_scalar"
- [(set (match_operand:VF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
(match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (mult:VF
- (vec_duplicate:VF
+ (plus_minus:V_VLSF
+ (mult:V_VLSF
+ (vec_duplicate:V_VLSF
(match_operand:<VEL> 2 "register_operand" " f, f, f, f"))
- (match_operand:VF 3 "register_operand" " vr, vr, vr, vr"))
- (match_operand:VF 4 "register_operand" " 0, vr, 0, vr"))
+ (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr"))
+ (match_operand:V_VLSF 4 "register_operand" " 0, vr, 0, vr"))
(match_dup 4)))]
"TARGET_VECTOR"
"@
(symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
(define_expand "@pred_mul_neg_<optab><mode>"
- [(set (match_operand:VF 0 "register_operand")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand")
(match_operand 6 "vector_length_operand")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (neg:VF
- (mult:VF
- (match_operand:VF 2 "register_operand")
- (match_operand:VF 3 "register_operand")))
- (match_operand:VF 4 "register_operand"))
- (match_operand:VF 5 "vector_merge_operand")))]
+ (plus_minus:V_VLSF
+ (neg:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 2 "register_operand")
+ (match_operand:V_VLSF 3 "register_operand")))
+ (match_operand:V_VLSF 4 "register_operand"))
+ (match_operand:V_VLSF 5 "vector_merge_operand")))]
"TARGET_VECTOR"
{
riscv_vector::prepare_ternary_operands (operands);
})
(define_insn "*pred_mul_neg_<optab><mode>_undef"
- [(set (match_operand:VF 0 "register_operand" "=vd,vd,?&vd, vr, vr,?&vr")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd,vd,?&vd, vr, vr,?&vr")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm,vm, vm,Wc1,Wc1, Wc1")
(match_operand 6 "vector_length_operand" " rK,rK, rK, rK, rK, rK")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (neg:VF
- (mult:VF
- (match_operand:VF 3 "register_operand" " 0,vr, vr, 0, vr, vr")
- (match_operand:VF 4 "register_operand" " vr,vr, vr, vr, vr, vr")))
- (match_operand:VF 5 "register_operand" " vr, 0, vr, vr, 0, vr"))
- (match_operand:VF 2 "vector_undef_operand")))]
+ (plus_minus:V_VLSF
+ (neg:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 3 "register_operand" " 0,vr, vr, 0, vr, vr")
+ (match_operand:V_VLSF 4 "register_operand" " vr,vr, vr, vr, vr, vr")))
+ (match_operand:V_VLSF 5 "register_operand" " vr, 0, vr, vr, 0, vr"))
+ (match_operand:V_VLSF 2 "vector_undef_operand")))]
"TARGET_VECTOR"
"@
vf<nmsub_nmadd>.vv\t%0,%4,%5%p1
(symbol_ref "riscv_vector::get_frm_mode (operands[10])"))])
(define_insn "*pred_<nmsub_nmadd><mode>"
- [(set (match_operand:VF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
(match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (neg:VF
- (mult:VF
- (match_operand:VF 2 "register_operand" " 0, vr, 0, vr")
- (match_operand:VF 3 "register_operand" " vr, vr, vr, vr")))
- (match_operand:VF 4 "register_operand" " vr, vr, vr, vr"))
+ (plus_minus:V_VLSF
+ (neg:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 2 "register_operand" " 0, vr, 0, vr")
+ (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")))
+ (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr"))
(match_dup 2)))]
"TARGET_VECTOR"
"@
(symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
(define_insn "*pred_<nmsac_nmacc><mode>"
- [(set (match_operand:VF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
(match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (neg:VF
- (mult:VF
- (match_operand:VF 2 "register_operand" " vr, vr, vr, vr")
- (match_operand:VF 3 "register_operand" " vr, vr, vr, vr")))
- (match_operand:VF 4 "register_operand" " 0, vr, 0, vr"))
+ (plus_minus:V_VLSF
+ (neg:V_VLSF
+ (mult:V_VLSF
+ (match_operand:V_VLSF 2 "register_operand" " vr, vr, vr, vr")
+ (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")))
+ (match_operand:V_VLSF 4 "register_operand" " 0, vr, 0, vr"))
(match_dup 4)))]
"TARGET_VECTOR"
"@
(symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
(define_expand "@pred_mul_neg_<optab><mode>_scalar"
- [(set (match_operand:VF 0 "register_operand")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand")
(match_operand 6 "vector_length_operand")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (neg:VF
- (mult:VF
- (vec_duplicate:VF
+ (plus_minus:V_VLSF
+ (neg:V_VLSF
+ (mult:V_VLSF
+ (vec_duplicate:V_VLSF
(match_operand:<VEL> 2 "register_operand"))
- (match_operand:VF 3 "register_operand")))
- (match_operand:VF 4 "register_operand"))
- (match_operand:VF 5 "register_operand")))]
+ (match_operand:V_VLSF 3 "register_operand")))
+ (match_operand:V_VLSF 4 "register_operand"))
+ (match_operand:V_VLSF 5 "register_operand")))]
"TARGET_VECTOR"
{})
(define_insn "*pred_<nmsub_nmadd><mode>_scalar"
- [(set (match_operand:VF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
(match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (neg:VF
- (mult:VF
- (vec_duplicate:VF
+ (plus_minus:V_VLSF
+ (neg:V_VLSF
+ (mult:V_VLSF
+ (vec_duplicate:V_VLSF
(match_operand:<VEL> 2 "register_operand" " f, f, f, f"))
- (match_operand:VF 3 "register_operand" " 0, vr, 0, vr")))
- (match_operand:VF 4 "register_operand" " vr, vr, vr, vr"))
+ (match_operand:V_VLSF 3 "register_operand" " 0, vr, 0, vr")))
+ (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr"))
(match_dup 3)))]
"TARGET_VECTOR"
"@
(symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
(define_insn "*pred_<nmsac_nmacc><mode>_scalar"
- [(set (match_operand:VF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
- (if_then_else:VF
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
+ (if_then_else:V_VLSF
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
(match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)
(reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
- (plus_minus:VF
- (neg:VF
- (mult:VF
- (vec_duplicate:VF
+ (plus_minus:V_VLSF
+ (neg:V_VLSF
+ (mult:V_VLSF
+ (vec_duplicate:V_VLSF
(match_operand:<VEL> 2 "register_operand" " f, f, f, f"))
- (match_operand:VF 3 "register_operand" " vr, vr, vr, vr")))
- (match_operand:VF 4 "register_operand" " 0, vr, 0, vr"))
+ (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")))
+ (match_operand:V_VLSF 4 "register_operand" " 0, vr, 0, vr"))
(match_dup 4)))]
"TARGET_VECTOR"
"@
for (int i = 0; i < NUM; ++i) \
a[i] = d[i] - b[i] * c[i]; \
}
+
+#define DEF_FMS_VV(PREFIX, NUM, TYPE) \
+ void __attribute__ ((noinline, noclone)) \
+ PREFIX##_##TYPE##NUM (TYPE *restrict a, TYPE *restrict b, TYPE *restrict c, \
+ TYPE *restrict d) \
+ { \
+ for (int i = 0; i < NUM; ++i) \
+ a[i] = b[i] * c[i] - d[i]; \
+ }
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FMA_VV (fma, 2, _Float16)
+DEF_FMA_VV (fma, 4, _Float16)
+DEF_FMA_VV (fma, 8, _Float16)
+DEF_FMA_VV (fma, 16, _Float16)
+DEF_FMA_VV (fma, 32, _Float16)
+DEF_FMA_VV (fma, 64, _Float16)
+DEF_FMA_VV (fma, 128, _Float16)
+DEF_FMA_VV (fma, 256, _Float16)
+DEF_FMA_VV (fma, 512, _Float16)
+DEF_FMA_VV (fma, 1024, _Float16)
+DEF_FMA_VV (fma, 2048, _Float16)
+
+/* { dg-final { scan-assembler-times {vfma[c-d][c-d]\.vv} 11 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FMA_VV (fma, 2, float)
+DEF_FMA_VV (fma, 4, float)
+DEF_FMA_VV (fma, 8, float)
+DEF_FMA_VV (fma, 16, float)
+DEF_FMA_VV (fma, 32, float)
+DEF_FMA_VV (fma, 64, float)
+DEF_FMA_VV (fma, 128, float)
+DEF_FMA_VV (fma, 256, float)
+DEF_FMA_VV (fma, 512, float)
+DEF_FMA_VV (fma, 1024, float)
+
+/* { dg-final { scan-assembler-times {vfma[c-d][c-d]\.vv} 10 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FMA_VV (fma, 2, double)
+DEF_FMA_VV (fma, 4, double)
+DEF_FMA_VV (fma, 8, double)
+DEF_FMA_VV (fma, 16, double)
+DEF_FMA_VV (fma, 32, double)
+DEF_FMA_VV (fma, 64, double)
+DEF_FMA_VV (fma, 128, double)
+DEF_FMA_VV (fma, 256, double)
+DEF_FMA_VV (fma, 512, double)
+
+/* { dg-final { scan-assembler-times {vfma[c-d][c-d]\.vv} 9 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FMS_VV (fms, 2, _Float16)
+DEF_FMS_VV (fms, 4, _Float16)
+DEF_FMS_VV (fms, 8, _Float16)
+DEF_FMS_VV (fms, 16, _Float16)
+DEF_FMS_VV (fms, 32, _Float16)
+DEF_FMS_VV (fms, 64, _Float16)
+DEF_FMS_VV (fms, 128, _Float16)
+DEF_FMS_VV (fms, 256, _Float16)
+DEF_FMS_VV (fms, 512, _Float16)
+DEF_FMS_VV (fms, 1024, _Float16)
+DEF_FMS_VV (fms, 2048, _Float16)
+
+/* { dg-final { scan-assembler-times {vfms[a-u][b-c]\.vv} 11 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FMS_VV (fms, 2, float)
+DEF_FMS_VV (fms, 4, float)
+DEF_FMS_VV (fms, 8, float)
+DEF_FMS_VV (fms, 16, float)
+DEF_FMS_VV (fms, 32, float)
+DEF_FMS_VV (fms, 64, float)
+DEF_FMS_VV (fms, 128, float)
+DEF_FMS_VV (fms, 256, float)
+DEF_FMS_VV (fms, 512, float)
+DEF_FMS_VV (fms, 1024, float)
+
+/* { dg-final { scan-assembler-times {vfms[a-u][b-c]\.vv} 10 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FMS_VV (fms, 2, double)
+DEF_FMS_VV (fms, 4, double)
+DEF_FMS_VV (fms, 8, double)
+DEF_FMS_VV (fms, 16, double)
+DEF_FMS_VV (fms, 32, double)
+DEF_FMS_VV (fms, 64, double)
+DEF_FMS_VV (fms, 128, double)
+DEF_FMS_VV (fms, 256, double)
+DEF_FMS_VV (fms, 512, double)
+
+/* { dg-final { scan-assembler-times {vfms[a-u][b-c]\.vv} 9 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FNMA_VV (fnma, 2, _Float16)
+DEF_FNMA_VV (fnma, 4, _Float16)
+DEF_FNMA_VV (fnma, 8, _Float16)
+DEF_FNMA_VV (fnma, 16, _Float16)
+DEF_FNMA_VV (fnma, 32, _Float16)
+DEF_FNMA_VV (fnma, 64, _Float16)
+DEF_FNMA_VV (fnma, 128, _Float16)
+DEF_FNMA_VV (fnma, 256, _Float16)
+DEF_FNMA_VV (fnma, 512, _Float16)
+DEF_FNMA_VV (fnma, 1024, _Float16)
+DEF_FNMA_VV (fnma, 2048, _Float16)
+
+/* { dg-final { scan-assembler-times {vfnms[a-u][b-c]\.vv} 11 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FNMA_VV (fnma, 2, float)
+DEF_FNMA_VV (fnma, 4, float)
+DEF_FNMA_VV (fnma, 8, float)
+DEF_FNMA_VV (fnma, 16, float)
+DEF_FNMA_VV (fnma, 32, float)
+DEF_FNMA_VV (fnma, 64, float)
+DEF_FNMA_VV (fnma, 128, float)
+DEF_FNMA_VV (fnma, 256, float)
+DEF_FNMA_VV (fnma, 512, float)
+DEF_FNMA_VV (fnma, 1024, float)
+
+/* { dg-final { scan-assembler-times {vfnms[a-u][b-c]\.vv} 10 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FNMA_VV (fnma, 2, double)
+DEF_FNMA_VV (fnma, 4, double)
+DEF_FNMA_VV (fnma, 8, double)
+DEF_FNMA_VV (fnma, 16, double)
+DEF_FNMA_VV (fnma, 32, double)
+DEF_FNMA_VV (fnma, 64, double)
+DEF_FNMA_VV (fnma, 128, double)
+DEF_FNMA_VV (fnma, 256, double)
+DEF_FNMA_VV (fnma, 512, double)
+
+/* { dg-final { scan-assembler-times {vfnms[a-u][b-c]\.vv} 9 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */