[llvm] [X86] Fold FMSUBADD + FADD into VFCMADDC for fp16 (PR #222896)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 14 02:29:14 PDT 2026
================
@@ -56066,6 +56066,54 @@ static SDValue combineFMulcFCMulc(SDNode *N, SelectionDAG &DAG,
return Res;
}
+// We try to match the following pattern from FMSUBADD(X, A, M) to lower it
+// into complex conjugate fmadd for fp16 (#216290).
+// for vector of the complex form v <v0r, v0i, v1r, v1i, ...>
+// and 2 complex vectors a, b,
+// X = duplicate real (b) : <b0r, b0r, b1r, b1r, ...>
+// A = a
+// M = FMUL (P, Q)
+// P = adjacent pair swapped (a) : <a0i, a0r, a1i, a1r, ...>
+// Q = duplicate imaginary (b) : <b0i, b0i, b1i, b1i, ...>
+static bool isCFMulFromFMSUBADD(SDValue N, SelectionDAG &DAG, SDValue &A,
+ SDValue &B) {
+ SDValue Op0 = N.getOperand(0);
+ SDValue Op1 = N.getOperand(1);
+ SDValue Op2 = N.getOperand(2);
+ SmallVector<SDValue, 2> Inputs;
----------------
RKSimon wrote:
Passing Inputs by reference like this through multiple lambdas looks like a potential footgun - can you clean it up at all? Maybe have matchShufflePattern return SDValue Inputs[0] on success instead of a bool?
https://github.com/llvm/llvm-project/pull/222896
More information about the llvm-commits
mailing list