From: Craig Topper Date: Thu, 10 Mar 2022 17:37:03 +0000 (-0800) Subject: [RISCV] Add isel patterns for masked RISCVISD::FMA_VL with RISCVISD::FNEG_VL. X-Git-Tag: upstream/15.0.7~14015 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e0e8edf82327ca16eceead3e5c22fb7a78d9998d;p=platform%2Fupstream%2Fllvm.git [RISCV] Add isel patterns for masked RISCVISD::FMA_VL with RISCVISD::FNEG_VL. This helps us form vfnmsub, vfnmadd, and vfmusb from masked VP intrinsics. I've used "srcvalue" for the mask parameter in the fneg nodes. We can't match "V0" because that doesn't ensure the mask the is the same. Instead it matches two different nodes and generates two copies to V0 of those separate values. Reviewed By: rogfer01 Differential Revision: https://reviews.llvm.org/D120287 --- diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td index 8e5549b..07f83e9 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td @@ -1165,22 +1165,43 @@ foreach vti = AllFloatVectors in { (!cast("PseudoVFMSUB_VV_"# suffix) vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(vti.Vector (riscv_fma_vl vti.RegClass:$rs1, vti.RegClass:$rd, + (riscv_fneg_vl vti.RegClass:$rs2, + (vti.Mask srcvalue), + VLOpFrag), + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVFMSUB_VV_"# suffix #"_MASK") + vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; def : Pat<(vti.Vector (riscv_fma_vl (riscv_fneg_vl vti.RegClass:$rs1, - (vti.Mask true_mask), + (vti.Mask srcvalue), VLOpFrag), vti.RegClass:$rd, (riscv_fneg_vl vti.RegClass:$rs2, - (vti.Mask true_mask), + (vti.Mask srcvalue), VLOpFrag), (vti.Mask true_mask), VLOpFrag)), (!cast("PseudoVFNMADD_VV_"# suffix) vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(vti.Vector (riscv_fma_vl (riscv_fneg_vl vti.RegClass:$rs1, + (vti.Mask srcvalue), + VLOpFrag), + vti.RegClass:$rd, + (riscv_fneg_vl vti.RegClass:$rs2, + (vti.Mask srcvalue), + VLOpFrag), + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVFNMADD_VV_"# suffix #"_MASK") + vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; def : Pat<(vti.Vector (riscv_fma_vl (riscv_fneg_vl vti.RegClass:$rs1, - (vti.Mask true_mask), + (vti.Mask srcvalue), VLOpFrag), vti.RegClass:$rd, vti.RegClass:$rs2, (vti.Mask true_mask), @@ -1188,6 +1209,15 @@ foreach vti = AllFloatVectors in { (!cast("PseudoVFNMSUB_VV_"# suffix) vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(vti.Vector (riscv_fma_vl (riscv_fneg_vl vti.RegClass:$rs1, + (vti.Mask srcvalue), + VLOpFrag), + vti.RegClass:$rd, vti.RegClass:$rs2, + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVFNMSUB_VV_"# suffix #"_MASK") + vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; // The choice of VFMADD here is arbitrary, vfmadd.vf and vfmacc.vf are equally // commutable. @@ -1209,7 +1239,7 @@ foreach vti = AllFloatVectors in { def : Pat<(vti.Vector (riscv_fma_vl (SplatFPOp vti.ScalarRegClass:$rs1), vti.RegClass:$rd, (riscv_fneg_vl vti.RegClass:$rs2, - (vti.Mask true_mask), + (vti.Mask srcvalue), VLOpFrag), (vti.Mask true_mask), VLOpFrag)), @@ -1217,11 +1247,22 @@ foreach vti = AllFloatVectors in { vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; def : Pat<(vti.Vector (riscv_fma_vl (SplatFPOp vti.ScalarRegClass:$rs1), + vti.RegClass:$rd, + (riscv_fneg_vl vti.RegClass:$rs2, + (vti.Mask srcvalue), + VLOpFrag), + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVFMSUB_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + + def : Pat<(vti.Vector (riscv_fma_vl (SplatFPOp vti.ScalarRegClass:$rs1), (riscv_fneg_vl vti.RegClass:$rd, - (vti.Mask true_mask), + (vti.Mask srcvalue), VLOpFrag), (riscv_fneg_vl vti.RegClass:$rs2, - (vti.Mask true_mask), + (vti.Mask srcvalue), VLOpFrag), (vti.Mask true_mask), VLOpFrag)), @@ -1230,7 +1271,20 @@ foreach vti = AllFloatVectors in { GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; def : Pat<(vti.Vector (riscv_fma_vl (SplatFPOp vti.ScalarRegClass:$rs1), (riscv_fneg_vl vti.RegClass:$rd, - (vti.Mask true_mask), + (vti.Mask srcvalue), + VLOpFrag), + (riscv_fneg_vl vti.RegClass:$rs2, + (vti.Mask srcvalue), + VLOpFrag), + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVFNMADD_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + + def : Pat<(vti.Vector (riscv_fma_vl (SplatFPOp vti.ScalarRegClass:$rs1), + (riscv_fneg_vl vti.RegClass:$rd, + (vti.Mask srcvalue), VLOpFrag), vti.RegClass:$rs2, (vti.Mask true_mask), @@ -1238,14 +1292,24 @@ foreach vti = AllFloatVectors in { (!cast("PseudoVFNMSUB_V" # vti.ScalarSuffix # "_" # suffix) vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(vti.Vector (riscv_fma_vl (SplatFPOp vti.ScalarRegClass:$rs1), + (riscv_fneg_vl vti.RegClass:$rd, + (vti.Mask srcvalue), + VLOpFrag), + vti.RegClass:$rs2, + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVFNMSUB_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; // The splat might be negated. def : Pat<(vti.Vector (riscv_fma_vl (riscv_fneg_vl (SplatFPOp vti.ScalarRegClass:$rs1), - (vti.Mask true_mask), + (vti.Mask srcvalue), VLOpFrag), vti.RegClass:$rd, (riscv_fneg_vl vti.RegClass:$rs2, - (vti.Mask true_mask), + (vti.Mask srcvalue), VLOpFrag), (vti.Mask true_mask), VLOpFrag)), @@ -1253,7 +1317,20 @@ foreach vti = AllFloatVectors in { vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; def : Pat<(vti.Vector (riscv_fma_vl (riscv_fneg_vl (SplatFPOp vti.ScalarRegClass:$rs1), - (vti.Mask true_mask), + (vti.Mask srcvalue), + VLOpFrag), + vti.RegClass:$rd, + (riscv_fneg_vl vti.RegClass:$rs2, + (vti.Mask srcvalue), + VLOpFrag), + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVFNMADD_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + + def : Pat<(vti.Vector (riscv_fma_vl (riscv_fneg_vl (SplatFPOp vti.ScalarRegClass:$rs1), + (vti.Mask srcvalue), VLOpFrag), vti.RegClass:$rd, vti.RegClass:$rs2, (vti.Mask true_mask), @@ -1261,6 +1338,15 @@ foreach vti = AllFloatVectors in { (!cast("PseudoVFNMSUB_V" # vti.ScalarSuffix # "_" # suffix) vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(vti.Vector (riscv_fma_vl (riscv_fneg_vl (SplatFPOp vti.ScalarRegClass:$rs1), + (vti.Mask srcvalue), + VLOpFrag), + vti.RegClass:$rd, vti.RegClass:$rs2, + (vti.Mask V0), + VLOpFrag)), + (!cast("PseudoVFNMSUB_V" # vti.ScalarSuffix # "_" # suffix # "_MASK") + vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + (vti.Mask V0), GPR:$vl, vti.Log2SEW, TAIL_AGNOSTIC)>; } // 14.11. Vector Floating-Point MIN/MAX Instructions diff --git a/llvm/test/CodeGen/RISCV/rvv/vfma-vp.ll b/llvm/test/CodeGen/RISCV/rvv/vfma-vp.ll index 5e99cff..b4cf150 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vfma-vp.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vfma-vp.ll @@ -1379,3 +1379,6317 @@ define @vfma_vv_nxv16f64_unmasked( ret %v } +declare @llvm.vp.fneg.nxv1f16(, , i32) + +define @vfmsub_vv_nxv1f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfmsub.vv v9, v8, v10, v0.t +; CHECK-NEXT: vmv1r.v v8, v9 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv1f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv1f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv1f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv1f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv2f16(, , i32) + +define @vfmsub_vv_nxv2f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfmsub.vv v9, v8, v10, v0.t +; CHECK-NEXT: vmv1r.v v8, v9 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv2f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv2f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv2f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv2f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv4f16(, , i32) + +define @vfmsub_vv_nxv4f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfmsub.vv v9, v8, v10, v0.t +; CHECK-NEXT: vmv.v.v v8, v9 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv4f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv4f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv4f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv4f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv8f16(, , i32) + +define @vfmsub_vv_nxv8f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfmsub.vv v10, v8, v12, v0.t +; CHECK-NEXT: vmv.v.v v8, v10 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv8f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv8f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv8f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv8f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv16f16(, , i32) + +define @vfmsub_vv_nxv16f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfmsub.vv v12, v8, v16, v0.t +; CHECK-NEXT: vmv.v.v v8, v12 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv16f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv16f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv16f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv16f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv16f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv16f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv16f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv16f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv16f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv16f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv16f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv16f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv16f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv16f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv16f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv16f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv16f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv16f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv16f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv16f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv16f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv16f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv16f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv16f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv16f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv16f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv16f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv16f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv16f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv16f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv16f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv16f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv16f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv32f16(, , i32) + +define @vfmsub_vv_nxv32f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vfmsub.vv v16, v8, v24, v0.t +; CHECK-NEXT: vmv.v.v v8, v16 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv32f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv32f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv32f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv32f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv32f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv32f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv32f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv32f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv32f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv32f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv32f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv32f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv32f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv32f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv32f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv32f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv32f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv32f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv32f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv32f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv32f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv32f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv32f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv32f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv32f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv32f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv32f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv32f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv32f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv32f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv32f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv32f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv32f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv32f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv32f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv32f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv32f16( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv32f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv32f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv32f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv32f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv32f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv32f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv32f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv32f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv32f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv32f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv32f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv32f16( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv32f16( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv32f16( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv32f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv32f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv32f16_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv32f16_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv32f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv32f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv32f16_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv32f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv32f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv32f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv32f16_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv32f16_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv32f16( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv32f16( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv32f16( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv32f16: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv32f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv32f16_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv32f16_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv32f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv32f16_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv32f16_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv32f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv32f16_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv32f16_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv32f16( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv32f16_neg_splat( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv32f16_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv32f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv32f16_neg_splat_commute( %va, half %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv32f16_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv32f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv32f16_neg_splat_unmasked( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv32f16_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv32f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv32f16_neg_splat_unmasked_commute( %va, half %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv32f16_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, half %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv32f16( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv32f16( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv1f32(, , i32) + +define @vfmsub_vv_nxv1f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfmsub.vv v9, v8, v10, v0.t +; CHECK-NEXT: vmv1r.v v8, v9 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv1f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv1f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv1f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv1f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f32_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f32_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f32_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f32_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f32_neg_splat( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f32_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f32_neg_splat_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f32_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f32_neg_splat_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f32_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f32_neg_splat_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f32_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f32_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f32_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f32_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f32_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f32_neg_splat( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f32_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f32_neg_splat_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f32_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f32_neg_splat_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f32_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f32_neg_splat_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f32_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f32( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv2f32(, , i32) + +define @vfmsub_vv_nxv2f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfmsub.vv v9, v8, v10, v0.t +; CHECK-NEXT: vmv.v.v v8, v9 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv2f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv2f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv2f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv2f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f32_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f32_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f32_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f32_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f32_neg_splat( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f32_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f32_neg_splat_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f32_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f32_neg_splat_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f32_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f32_neg_splat_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f32_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f32_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f32_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f32_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f32_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f32_neg_splat( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f32_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f32_neg_splat_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f32_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f32_neg_splat_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f32_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f32_neg_splat_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f32_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f32( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv4f32(, , i32) + +define @vfmsub_vv_nxv4f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfmsub.vv v10, v8, v12, v0.t +; CHECK-NEXT: vmv.v.v v8, v10 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv4f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv4f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv4f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv4f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f32_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f32_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f32_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f32_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f32_neg_splat( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f32_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f32_neg_splat_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f32_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f32_neg_splat_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f32_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f32_neg_splat_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f32_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f32_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f32_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f32_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f32_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f32_neg_splat( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f32_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f32_neg_splat_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f32_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f32_neg_splat_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f32_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f32_neg_splat_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f32_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f32( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv8f32(, , i32) + +define @vfmsub_vv_nxv8f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfmsub.vv v12, v8, v16, v0.t +; CHECK-NEXT: vmv.v.v v8, v12 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv8f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv8f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv8f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv8f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f32_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f32_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f32_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f32_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f32_neg_splat( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f32_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f32_neg_splat_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f32_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f32_neg_splat_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f32_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f32_neg_splat_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f32_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f32_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f32_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f32_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f32_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f32_neg_splat( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f32_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f32_neg_splat_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f32_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f32_neg_splat_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f32_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f32_neg_splat_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f32_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f32( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv16f32(, , i32) + +define @vfmsub_vv_nxv16f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vfmsub.vv v16, v8, v24, v0.t +; CHECK-NEXT: vmv.v.v v8, v16 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv16f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv16f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv16f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv16f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv16f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv16f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv16f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv16f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv16f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv16f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv16f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv16f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv16f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv16f32_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv16f32_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv16f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv16f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv16f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv16f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv16f32_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv16f32_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv16f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f32( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f32_neg_splat( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f32_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f32_neg_splat_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f32_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f32_neg_splat_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f32_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv16f32_neg_splat_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv16f32_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f32( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv16f32( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv16f32( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv16f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv16f32_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv16f32_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv16f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv16f32_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv16f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv16f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv16f32_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv16f32_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv16f32( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv16f32( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f32( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f32_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f32_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f32_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f32_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f32_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f32_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv16f32( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f32_neg_splat( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f32_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f32_neg_splat_commute( %va, float %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f32_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f32_neg_splat_unmasked( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f32_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv16f32_neg_splat_unmasked_commute( %va, float %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv16f32_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, float %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv16f32( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv16f32( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv1f64(, , i32) + +define @vfmsub_vv_nxv1f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfmsub.vv v9, v8, v10, v0.t +; CHECK-NEXT: vmv.v.v v8, v9 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv1f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv1f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv1f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv1f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv1f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv1f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f64_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f64_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv1f64_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv1f64_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f64_neg_splat( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f64_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f64_neg_splat_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f64_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f64_neg_splat_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f64_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv1f64_neg_splat_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv1f64_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv1f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f64_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f64_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv1f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv1f64_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv1f64_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v9, v10 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv1f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv1f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv1f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f64_neg_splat( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f64_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f64_neg_splat_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f64_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f64_neg_splat_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f64_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv1f64_neg_splat_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv1f64_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v9 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv1f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f64( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv2f64(, , i32) + +define @vfmsub_vv_nxv2f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfmsub.vv v10, v8, v12, v0.t +; CHECK-NEXT: vmv.v.v v8, v10 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv2f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv2f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv2f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv2f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv2f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv2f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f64_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f64_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv2f64_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv2f64_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f64_neg_splat( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f64_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f64_neg_splat_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f64_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f64_neg_splat_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f64_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv2f64_neg_splat_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv2f64_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv2f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f64_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f64_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv2f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv2f64_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv2f64_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v10, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv2f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv2f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv2f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f64_neg_splat( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f64_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f64_neg_splat_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f64_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f64_neg_splat_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f64_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv2f64_neg_splat_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv2f64_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v10 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv2f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv2f64( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv4f64(, , i32) + +define @vfmsub_vv_nxv4f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfmsub.vv v12, v8, v16, v0.t +; CHECK-NEXT: vmv.v.v v8, v12 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv4f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv4f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv4f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv4f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv4f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv4f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f64_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f64_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv4f64_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv4f64_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f64_neg_splat( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f64_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f64_neg_splat_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f64_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f64_neg_splat_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f64_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv4f64_neg_splat_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv4f64_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv4f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f64_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f64_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv4f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv4f64_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv4f64_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv4f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv4f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv4f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f64_neg_splat( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f64_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f64_neg_splat_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f64_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f64_neg_splat_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f64_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv4f64_neg_splat_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv4f64_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v12 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv4f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv4f64( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +declare @llvm.vp.fneg.nxv8f64(, , i32) + +define @vfmsub_vv_nxv8f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vfmsub.vv v16, v8, v24, v0.t +; CHECK-NEXT: vmv.v.v v8, v16 +; CHECK-NEXT: ret + %negc = call @llvm.vp.fneg.nxv8f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vv_nxv8f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vv_nxv8f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vfmsub.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negc = call @llvm.vp.fneg.nxv8f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %b, %negc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfmsub_vf_nxv8f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfmsub_vf_nxv8f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %vb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f64_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f64_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vv_nxv8f64_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vv_nxv8f64_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negva, %vb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f64( %va, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %vb, %negva, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f64_neg_splat( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f64_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f64_neg_splat_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f64_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f64_neg_splat_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f64_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %negvb, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmadd_vf_nxv8f64_neg_splat_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmadd_vf_nxv8f64_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f64( %vb, %m, i32 %evl) + %negvc = call @llvm.vp.fneg.nxv8f64( %vc, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negvb, %va, %negvc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f64( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f64_commuted( %va, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f64_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret + %negb = call @llvm.vp.fneg.nxv8f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f64_unmasked( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %negb, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vv_nxv8f64_unmasked_commuted( %va, %b, %c, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vv_nxv8f64_unmasked_commuted: +; CHECK: # %bb.0: +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vfnmadd.vv v8, v16, v24 +; CHECK-NEXT: ret + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negb = call @llvm.vp.fneg.nxv8f64( %b, %m, i32 %evl) + %negc = call @llvm.vp.fneg.nxv8f64( %c, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negb, %va, %negc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f64( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f64: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f64_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f64_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f64_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f64_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negva, %vb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f64_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f64_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negva = call @llvm.vp.fneg.nxv8f64( %va, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %vb, %negva, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f64_neg_splat( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f64_neg_splat: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f64_neg_splat_commute( %va, double %b, %vc, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f64_neg_splat_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16, v0.t +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negvb, %va, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f64_neg_splat_unmasked( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f64_neg_splat_unmasked: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %va, %negvb, %vc, %m, i32 %evl) + ret %v +} + +define @vfnmsub_vf_nxv8f64_neg_splat_unmasked_commute( %va, double %b, %vc, i32 zeroext %evl) { +; CHECK-LABEL: vfnmsub_vf_nxv8f64_neg_splat_unmasked_commute: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vfnmsub.vf v8, fa0, v16 +; CHECK-NEXT: ret + %elt.head = insertelement poison, double %b, i32 0 + %vb = shufflevector %elt.head, poison, zeroinitializer + %head = insertelement poison, i1 true, i32 0 + %m = shufflevector %head, poison, zeroinitializer + %negvb = call @llvm.vp.fneg.nxv8f64( %vb, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv8f64( %negvb, %va, %vc, %m, i32 %evl) + ret %v +}