diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td @@ -132,6 +132,46 @@ } } +class VPatBinarySDNode_VF : + Pat<(result_type (vop (vop_type vop_reg_class:$rs1), + (vop_type (splat_vector xop_kind:$rs2)))), + (!cast(instruction_name#"_VF_"#vlmul.MX) + vop_reg_class:$rs1, + ToFPR32.ret, + VLMax, sew)>; + +multiclass VPatBinaryFPSDNode_VV_VF { + foreach vti = AllFloatVectors in { + def : VPatBinarySDNode_VV; + def : VPatBinarySDNode_VF; + } +} + +multiclass VPatBinaryFPSDNode_R_VF { + foreach fvti = AllFloatVectors in + def : Pat<(fvti.Vector (vop (fvti.Vector (splat_vector fvti.Scalar:$rs2)), + (fvti.Vector fvti.RegClass:$rs1))), + (!cast(instruction_name#"_VF_"#fvti.LMul.MX) + fvti.RegClass:$rs1, + ToFPR32.ret, + VLMax, fvti.SEW)>; +} + multiclass VPatIntegerSetCCSDNode_VV { @@ -340,6 +380,16 @@ let Predicates = [HasStdExtV, HasStdExtF] in { +// 14.2. Vector Single-Width Floating-Point Add/Subtract Instructions +defm "" : VPatBinaryFPSDNode_VV_VF; +defm "" : VPatBinaryFPSDNode_VV_VF; +defm "" : VPatBinaryFPSDNode_R_VF; + +// 14.4. Vector Single-Width Floating-Point Multiply/Divide Instructions +defm "" : VPatBinaryFPSDNode_VV_VF; +defm "" : VPatBinaryFPSDNode_VV_VF; +defm "" : VPatBinaryFPSDNode_R_VF; + // 14.11. Vector Floating-Point Compare Instructions defm "" : VPatFPSetCCSDNode_VV_VF_FV; defm "" : VPatFPSetCCSDNode_VV_VF_FV; diff --git a/llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode-rv32.ll b/llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode-rv32.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode-rv32.ll @@ -0,0 +1,380 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv32 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=ilp32d \ +; RUN: -verify-machineinstrs < %s | FileCheck %s + +define @vfadd_vv_nxv1f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv1f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv2f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv2f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv4f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv4f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv8f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_fv_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfadd_fv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %splat, %va + ret %vc +} + +define @vfadd_vv_nxv16f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv16f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv32f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu +; CHECK-NEXT: vle16.v v8, (a0) +; CHECK-NEXT: vfadd.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv32f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv1f32( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv1f32( %va, float %b) { +; CHECK-LABEL: vfadd_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv2f32( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv2f32( %va, float %b) { +; CHECK-LABEL: vfadd_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv4f32( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv4f32( %va, float %b) { +; CHECK-LABEL: vfadd_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv8f32( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfadd_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_fv_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfadd_fv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %splat, %va + ret %vc +} + +define @vfadd_vv_nxv16f32( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu +; CHECK-NEXT: vle32.v v8, (a0) +; CHECK-NEXT: vfadd.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv16f32( %va, float %b) { +; CHECK-LABEL: vfadd_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv1f64( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv1f64( %va, double %b) { +; CHECK-LABEL: vfadd_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv2f64( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv2f64( %va, double %b) { +; CHECK-LABEL: vfadd_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv4f64( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv4f64( %va, double %b) { +; CHECK-LABEL: vfadd_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv8f64( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e64,m8,ta,mu +; CHECK-NEXT: vle64.v v8, (a0) +; CHECK-NEXT: vfadd.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfadd_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_fv_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfadd_fv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %splat, %va + ret %vc +} + diff --git a/llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode-rv64.ll b/llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode-rv64.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode-rv64.ll @@ -0,0 +1,380 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv64 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=lp64d \ +; RUN: -verify-machineinstrs < %s | FileCheck %s + +define @vfadd_vv_nxv1f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv1f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv2f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv2f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv4f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv4f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv8f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_fv_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfadd_fv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %splat, %va + ret %vc +} + +define @vfadd_vv_nxv16f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv16f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv32f16( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu +; CHECK-NEXT: vle16.v v8, (a0) +; CHECK-NEXT: vfadd.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv32f16( %va, half %b) { +; CHECK-LABEL: vfadd_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv1f32( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv1f32( %va, float %b) { +; CHECK-LABEL: vfadd_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv2f32( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv2f32( %va, float %b) { +; CHECK-LABEL: vfadd_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv4f32( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv4f32( %va, float %b) { +; CHECK-LABEL: vfadd_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv8f32( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfadd_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_fv_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfadd_fv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %splat, %va + ret %vc +} + +define @vfadd_vv_nxv16f32( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu +; CHECK-NEXT: vle32.v v8, (a0) +; CHECK-NEXT: vfadd.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv16f32( %va, float %b) { +; CHECK-LABEL: vfadd_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv1f64( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv1f64( %va, double %b) { +; CHECK-LABEL: vfadd_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv2f64( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv2f64( %va, double %b) { +; CHECK-LABEL: vfadd_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv4f64( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfadd.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv4f64( %va, double %b) { +; CHECK-LABEL: vfadd_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_vv_nxv8f64( %va, %vb) { +; CHECK-LABEL: vfadd_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e64,m8,ta,mu +; CHECK-NEXT: vle64.v v8, (a0) +; CHECK-NEXT: vfadd.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fadd %va, %vb + ret %vc +} + +define @vfadd_vf_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfadd_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %va, %splat + ret %vc +} + +define @vfadd_fv_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfadd_fv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfadd.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fadd %splat, %va + ret %vc +} + diff --git a/llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode-rv32.ll b/llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode-rv32.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode-rv32.ll @@ -0,0 +1,380 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv32 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=ilp32d \ +; RUN: -verify-machineinstrs < %s | FileCheck %s + +define @vfdiv_vv_nxv1f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv1f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv2f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv2f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv4f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv4f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv8f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_fv_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfdiv_fv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfrdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %splat, %va + ret %vc +} + +define @vfdiv_vv_nxv16f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv16f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv32f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu +; CHECK-NEXT: vle16.v v8, (a0) +; CHECK-NEXT: vfdiv.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv32f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv1f32( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv1f32( %va, float %b) { +; CHECK-LABEL: vfdiv_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv2f32( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv2f32( %va, float %b) { +; CHECK-LABEL: vfdiv_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv4f32( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv4f32( %va, float %b) { +; CHECK-LABEL: vfdiv_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv8f32( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfdiv_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_fv_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfdiv_fv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfrdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %splat, %va + ret %vc +} + +define @vfdiv_vv_nxv16f32( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu +; CHECK-NEXT: vle32.v v8, (a0) +; CHECK-NEXT: vfdiv.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv16f32( %va, float %b) { +; CHECK-LABEL: vfdiv_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv1f64( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv1f64( %va, double %b) { +; CHECK-LABEL: vfdiv_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv2f64( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv2f64( %va, double %b) { +; CHECK-LABEL: vfdiv_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv4f64( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv4f64( %va, double %b) { +; CHECK-LABEL: vfdiv_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv8f64( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e64,m8,ta,mu +; CHECK-NEXT: vle64.v v8, (a0) +; CHECK-NEXT: vfdiv.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfdiv_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_fv_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfdiv_fv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfrdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %splat, %va + ret %vc +} + diff --git a/llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode-rv64.ll b/llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode-rv64.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode-rv64.ll @@ -0,0 +1,380 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv64 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=lp64d \ +; RUN: -verify-machineinstrs < %s | FileCheck %s + +define @vfdiv_vv_nxv1f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv1f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv2f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv2f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv4f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv4f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv8f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_fv_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfdiv_fv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfrdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %splat, %va + ret %vc +} + +define @vfdiv_vv_nxv16f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv16f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv32f16( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu +; CHECK-NEXT: vle16.v v8, (a0) +; CHECK-NEXT: vfdiv.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv32f16( %va, half %b) { +; CHECK-LABEL: vfdiv_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv1f32( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv1f32( %va, float %b) { +; CHECK-LABEL: vfdiv_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv2f32( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv2f32( %va, float %b) { +; CHECK-LABEL: vfdiv_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv4f32( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv4f32( %va, float %b) { +; CHECK-LABEL: vfdiv_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv8f32( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfdiv_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_fv_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfdiv_fv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfrdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %splat, %va + ret %vc +} + +define @vfdiv_vv_nxv16f32( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu +; CHECK-NEXT: vle32.v v8, (a0) +; CHECK-NEXT: vfdiv.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv16f32( %va, float %b) { +; CHECK-LABEL: vfdiv_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv1f64( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv1f64( %va, double %b) { +; CHECK-LABEL: vfdiv_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv2f64( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv2f64( %va, double %b) { +; CHECK-LABEL: vfdiv_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv4f64( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfdiv.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv4f64( %va, double %b) { +; CHECK-LABEL: vfdiv_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_vv_nxv8f64( %va, %vb) { +; CHECK-LABEL: vfdiv_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e64,m8,ta,mu +; CHECK-NEXT: vle64.v v8, (a0) +; CHECK-NEXT: vfdiv.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fdiv %va, %vb + ret %vc +} + +define @vfdiv_vf_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfdiv_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %va, %splat + ret %vc +} + +define @vfdiv_fv_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfdiv_fv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfrdiv.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fdiv %splat, %va + ret %vc +} + diff --git a/llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode-rv32.ll b/llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode-rv32.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode-rv32.ll @@ -0,0 +1,380 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv32 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=ilp32d \ +; RUN: -verify-machineinstrs < %s | FileCheck %s + +define @vfmul_vv_nxv1f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv1f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv2f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv2f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv4f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv4f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv8f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_fv_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfmul_fv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %splat, %va + ret %vc +} + +define @vfmul_vv_nxv16f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv16f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv32f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu +; CHECK-NEXT: vle16.v v8, (a0) +; CHECK-NEXT: vfmul.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv32f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv1f32( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv1f32( %va, float %b) { +; CHECK-LABEL: vfmul_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv2f32( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv2f32( %va, float %b) { +; CHECK-LABEL: vfmul_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv4f32( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv4f32( %va, float %b) { +; CHECK-LABEL: vfmul_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv8f32( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfmul_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_fv_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfmul_fv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %splat, %va + ret %vc +} + +define @vfmul_vv_nxv16f32( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu +; CHECK-NEXT: vle32.v v8, (a0) +; CHECK-NEXT: vfmul.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv16f32( %va, float %b) { +; CHECK-LABEL: vfmul_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv1f64( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv1f64( %va, double %b) { +; CHECK-LABEL: vfmul_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv2f64( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv2f64( %va, double %b) { +; CHECK-LABEL: vfmul_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv4f64( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv4f64( %va, double %b) { +; CHECK-LABEL: vfmul_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv8f64( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e64,m8,ta,mu +; CHECK-NEXT: vle64.v v8, (a0) +; CHECK-NEXT: vfmul.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfmul_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_fv_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfmul_fv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %splat, %va + ret %vc +} + diff --git a/llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode-rv64.ll b/llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode-rv64.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode-rv64.ll @@ -0,0 +1,380 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv64 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=lp64d \ +; RUN: -verify-machineinstrs < %s | FileCheck %s + +define @vfmul_vv_nxv1f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv1f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv2f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv2f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv4f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv4f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv8f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_fv_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfmul_fv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %splat, %va + ret %vc +} + +define @vfmul_vv_nxv16f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv16f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv32f16( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu +; CHECK-NEXT: vle16.v v8, (a0) +; CHECK-NEXT: vfmul.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv32f16( %va, half %b) { +; CHECK-LABEL: vfmul_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv1f32( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv1f32( %va, float %b) { +; CHECK-LABEL: vfmul_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv2f32( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv2f32( %va, float %b) { +; CHECK-LABEL: vfmul_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv4f32( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv4f32( %va, float %b) { +; CHECK-LABEL: vfmul_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv8f32( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfmul_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_fv_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfmul_fv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %splat, %va + ret %vc +} + +define @vfmul_vv_nxv16f32( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu +; CHECK-NEXT: vle32.v v8, (a0) +; CHECK-NEXT: vfmul.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv16f32( %va, float %b) { +; CHECK-LABEL: vfmul_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv1f64( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv1f64( %va, double %b) { +; CHECK-LABEL: vfmul_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv2f64( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv2f64( %va, double %b) { +; CHECK-LABEL: vfmul_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv4f64( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfmul.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv4f64( %va, double %b) { +; CHECK-LABEL: vfmul_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_vv_nxv8f64( %va, %vb) { +; CHECK-LABEL: vfmul_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e64,m8,ta,mu +; CHECK-NEXT: vle64.v v8, (a0) +; CHECK-NEXT: vfmul.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fmul %va, %vb + ret %vc +} + +define @vfmul_vf_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfmul_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %va, %splat + ret %vc +} + +define @vfmul_fv_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfmul_fv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfmul.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fmul %splat, %va + ret %vc +} + diff --git a/llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode-rv32.ll b/llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode-rv32.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode-rv32.ll @@ -0,0 +1,380 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv32 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=ilp32d \ +; RUN: -verify-machineinstrs < %s | FileCheck %s + +define @vfsub_vv_nxv1f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv1f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv2f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv2f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv4f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv4f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv8f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_fv_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfsub_fv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfrsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %splat, %va + ret %vc +} + +define @vfsub_vv_nxv16f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv16f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv32f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu +; CHECK-NEXT: vle16.v v8, (a0) +; CHECK-NEXT: vfsub.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv32f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv1f32( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv1f32( %va, float %b) { +; CHECK-LABEL: vfsub_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv2f32( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv2f32( %va, float %b) { +; CHECK-LABEL: vfsub_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv4f32( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv4f32( %va, float %b) { +; CHECK-LABEL: vfsub_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv8f32( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfsub_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_fv_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfsub_fv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfrsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %splat, %va + ret %vc +} + +define @vfsub_vv_nxv16f32( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu +; CHECK-NEXT: vle32.v v8, (a0) +; CHECK-NEXT: vfsub.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv16f32( %va, float %b) { +; CHECK-LABEL: vfsub_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv1f64( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv1f64( %va, double %b) { +; CHECK-LABEL: vfsub_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv2f64( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv2f64( %va, double %b) { +; CHECK-LABEL: vfsub_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv4f64( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv4f64( %va, double %b) { +; CHECK-LABEL: vfsub_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv8f64( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e64,m8,ta,mu +; CHECK-NEXT: vle64.v v8, (a0) +; CHECK-NEXT: vfsub.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfsub_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_fv_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfsub_fv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfrsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %splat, %va + ret %vc +} + diff --git a/llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode-rv64.ll b/llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode-rv64.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode-rv64.ll @@ -0,0 +1,380 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv64 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=lp64d \ +; RUN: -verify-machineinstrs < %s | FileCheck %s + +define @vfsub_vv_nxv1f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv1f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv2f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv2f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv4f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv4f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv8f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_fv_nxv8f16( %va, half %b) { +; CHECK-LABEL: vfsub_fv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu +; CHECK-NEXT: vfrsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %splat, %va + ret %vc +} + +define @vfsub_vv_nxv16f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv16f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv32f16( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu +; CHECK-NEXT: vle16.v v8, (a0) +; CHECK-NEXT: vfsub.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv32f16( %va, half %b) { +; CHECK-LABEL: vfsub_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f10_h killed $f10_h def $f10_f +; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, half %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv1f32( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv1f32( %va, float %b) { +; CHECK-LABEL: vfsub_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv2f32( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv2f32( %va, float %b) { +; CHECK-LABEL: vfsub_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv4f32( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv4f32( %va, float %b) { +; CHECK-LABEL: vfsub_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv8f32( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfsub_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_fv_nxv8f32( %va, float %b) { +; CHECK-LABEL: vfsub_fv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu +; CHECK-NEXT: vfrsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %splat, %va + ret %vc +} + +define @vfsub_vv_nxv16f32( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu +; CHECK-NEXT: vle32.v v8, (a0) +; CHECK-NEXT: vfsub.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv16f32( %va, float %b) { +; CHECK-LABEL: vfsub_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, float %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv1f64( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v17 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv1f64( %va, double %b) { +; CHECK-LABEL: vfsub_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m1,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv2f64( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v18 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv2f64( %va, double %b) { +; CHECK-LABEL: vfsub_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m2,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv4f64( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfsub.vv v16, v16, v20 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv4f64( %va, double %b) { +; CHECK-LABEL: vfsub_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m4,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_vv_nxv8f64( %va, %vb) { +; CHECK-LABEL: vfsub_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e64,m8,ta,mu +; CHECK-NEXT: vle64.v v8, (a0) +; CHECK-NEXT: vfsub.vv v16, v16, v8 +; CHECK-NEXT: ret + %vc = fsub %va, %vb + ret %vc +} + +define @vfsub_vf_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfsub_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %va, %splat + ret %vc +} + +define @vfsub_fv_nxv8f64( %va, double %b) { +; CHECK-LABEL: vfsub_fv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64,m8,ta,mu +; CHECK-NEXT: vfrsub.vf v16, v16, fa0 +; CHECK-NEXT: ret + %head = insertelement undef, double %b, i32 0 + %splat = shufflevector %head, undef, zeroinitializer + %vc = fsub %splat, %va + ret %vc +} +