Skip to content

Commit b419ede

Browse files
[RISCV][VLOPT] Add widening floating point multiply to isSupportedInstr
1 parent a484fa1 commit b419ede

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,9 @@ static bool isSupportedInstr(const MachineInstr &MI) {
10041004
case RISCV::VFDIV_VF:
10051005
case RISCV::VFDIV_VV:
10061006
case RISCV::VFRDIV_VF:
1007+
// Vector Widening Floating-Point Multiply
1008+
case RISCV::VFWMUL_VF:
1009+
case RISCV::VFWMUL_VV:
10071010
// Single-Width Floating-Point/Integer Type-Convert Instructions
10081011
case RISCV::VFCVT_XU_F_V:
10091012
case RISCV::VFCVT_X_F_V:

llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,3 +3293,45 @@ define <vscale x 4 x float> @vfrdiv_vf(<vscale x 4 x float> %a, float %b, iXLen
32933293
%2 = call <vscale x 4 x float> @llvm.riscv.vfadd.nxv4f32.nxv4f32(<vscale x 4 x float> poison, <vscale x 4 x float> %1, <vscale x 4 x float> %a, iXLen 7, iXLen %vl)
32943294
ret <vscale x 4 x float> %2
32953295
}
3296+
3297+
define <vscale x 4 x double> @vfwmul_vv(<vscale x 4 x float> %a, <vscale x 4 x float> %b, iXLen %vl) {
3298+
; NOVLOPT-LABEL: vfwmul_vv:
3299+
; NOVLOPT: # %bb.0:
3300+
; NOVLOPT-NEXT: vsetvli a1, zero, e32, m2, ta, ma
3301+
; NOVLOPT-NEXT: vfwmul.vv v12, v8, v10
3302+
; NOVLOPT-NEXT: vsetvli zero, a0, e64, m4, ta, ma
3303+
; NOVLOPT-NEXT: vfadd.vv v8, v12, v12
3304+
; NOVLOPT-NEXT: ret
3305+
;
3306+
; VLOPT-LABEL: vfwmul_vv:
3307+
; VLOPT: # %bb.0:
3308+
; VLOPT-NEXT: vsetvli zero, a0, e32, m2, ta, ma
3309+
; VLOPT-NEXT: vfwmul.vv v12, v8, v10
3310+
; VLOPT-NEXT: vsetvli zero, zero, e64, m4, ta, ma
3311+
; VLOPT-NEXT: vfadd.vv v8, v12, v12
3312+
; VLOPT-NEXT: ret
3313+
%1 = call <vscale x 4 x double> @llvm.riscv.vfwmul.nxv4f64.nxv4f32.nxv4f32(<vscale x 4 x double> poison, <vscale x 4 x float> %a, <vscale x 4 x float> %b, iXLen 7, iXLen -1)
3314+
%2 = call <vscale x 4 x double> @llvm.riscv.vfadd.nxv4f64.nxv4f64(<vscale x 4 x double> poison, <vscale x 4 x double> %1, <vscale x 4 x double> %1, iXLen 7, iXLen %vl)
3315+
ret <vscale x 4 x double> %2
3316+
}
3317+
3318+
define <vscale x 4 x double> @vfwmul_vf(<vscale x 4 x float> %a, float %b, iXLen %vl) {
3319+
; NOVLOPT-LABEL: vfwmul_vf:
3320+
; NOVLOPT: # %bb.0:
3321+
; NOVLOPT-NEXT: vsetvli a1, zero, e32, m2, ta, ma
3322+
; NOVLOPT-NEXT: vfwmul.vf v12, v8, fa0
3323+
; NOVLOPT-NEXT: vsetvli zero, a0, e64, m4, ta, ma
3324+
; NOVLOPT-NEXT: vfadd.vv v8, v12, v12
3325+
; NOVLOPT-NEXT: ret
3326+
;
3327+
; VLOPT-LABEL: vfwmul_vf:
3328+
; VLOPT: # %bb.0:
3329+
; VLOPT-NEXT: vsetvli zero, a0, e32, m2, ta, ma
3330+
; VLOPT-NEXT: vfwmul.vf v12, v8, fa0
3331+
; VLOPT-NEXT: vsetvli zero, zero, e64, m4, ta, ma
3332+
; VLOPT-NEXT: vfadd.vv v8, v12, v12
3333+
; VLOPT-NEXT: ret
3334+
%1 = call <vscale x 4 x double> @llvm.riscv.vfwmul.nxv4f64.nxv4f32.f32(<vscale x 4 x double> poison, <vscale x 4 x float> %a, float %b, iXLen 7, iXLen -1)
3335+
%2 = call <vscale x 4 x double> @llvm.riscv.vfadd.nxv4f64.nxv4f64(<vscale x 4 x double> poison, <vscale x 4 x double> %1, <vscale x 4 x double> %1, iXLen 7, iXLen %vl)
3336+
ret <vscale x 4 x double> %2
3337+
}

0 commit comments

Comments
 (0)