[llvm] [RISCV] vfadd.vf + splat (fneg)-> vfsub.vf (PR #173589)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 29 06:06:19 PST 2025


================
@@ -21021,7 +21021,23 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
       return SDValue();
     return DAG.getNode(RISCVISD::FSGNJX, DL, VT, N1, N0->getOperand(1));
   }
-  case ISD::FADD:
+  case ISD::FADD: {
+    if (SDValue V = combineBinOpToReduce(N, DAG, Subtarget))
+      return V;
+    if (SDValue V = combineBinOpOfExtractToReduceTree(N, DAG, Subtarget))
+      return V;
+    SDValue N1 = N->getOperand(1);
+    if (N1.getOpcode() != ISD::SPLAT_VECTOR)
----------------
lukel97 wrote:

Could you use `DAG.getSplatValue` instead and make this agnostic over fixed/scalable vector types?

https://github.com/llvm/llvm-project/pull/173589


More information about the llvm-commits mailing list