diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -11400,8 +11400,6 @@ // multiply result and/or the accumulator. // NOTE: Only supports RVV operations with VL. static unsigned negateFMAOpcode(unsigned Opcode, bool NegMul, bool NegAcc) { - assert((NegMul || NegAcc) && "Not negating anything?"); - // Negating the multiply result changes ADD<->SUB and toggles 'N'. if (NegMul) { // clang-format off diff --git a/llvm/test/CodeGen/RISCV/rvv/vfma-vp.ll b/llvm/test/CodeGen/RISCV/rvv/vfma-vp.ll --- a/llvm/test/CodeGen/RISCV/rvv/vfma-vp.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vfma-vp.ll @@ -7708,3 +7708,16 @@ %v = call @llvm.vp.fma.nxv8f64( %negvb, %va, %vc, %m, i32 %evl) ret %v } + +define @vfma_vv_nxv1f16_double_neg( %a, %b, %c, %m, i32 zeroext %evl) { +; CHECK-LABEL: vfma_vv_nxv1f16_double_neg: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma +; CHECK-NEXT: vfmadd.vv v9, v8, v10, v0.t +; CHECK-NEXT: vmv1r.v v8, v9 +; CHECK-NEXT: ret + %nega = call @llvm.vp.fneg.nxv1f16( %a, %m, i32 %evl) + %negb = call @llvm.vp.fneg.nxv1f16( %b, %m, i32 %evl) + %v = call @llvm.vp.fma.nxv1f16( %nega, %negb, %c, %m, i32 %evl) + ret %v +}