[clang] [llvm] [RISCV][P-ext] Fold an add of a multiply-parts product into the accumulate form (PR #222748)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 13:01:36 PDT 2026
================
@@ -18510,6 +18551,30 @@ static SDValue combineAddMulh(SDNode *N, SelectionDAG &DAG,
return DAG.getNode(RISCVISD::MULHSU, DL, VT, X, Mulh.getOperand(1));
}
+// Fold an add of a multiply-parts product into the accumulating form.
+static SDValue combineAddMulParts(SDNode *N, SelectionDAG &DAG,
+ const RISCVSubtarget &Subtarget) {
+ if (!Subtarget.hasStdExtP())
+ return SDValue();
+
+ for (unsigned I = 0; I != 2; ++I) {
+ SDValue Mul = N->getOperand(I);
+ if (Mul.getOpcode() != ISD::INTRINSIC_WO_CHAIN || !Mul.hasOneUse())
+ continue;
+ Intrinsic::ID AccId =
+ getRVPMulPartsAccIntrinsic(Mul.getConstantOperandVal(0));
+ if (AccId == Intrinsic::not_intrinsic)
+ continue;
+
+ SDLoc DL(N);
+ return DAG.getNode(ISD::INTRINSIC_WO_CHAIN, DL, N->getValueType(0),
+ DAG.getTargetConstant(AccId, DL, MVT::i32),
----------------
sihuan wrote:
Fixed.
https://github.com/llvm/llvm-project/pull/222748
More information about the cfe-commits
mailing list