[llvm] [DAG] Constant fold FMAD (PR #69324)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 17 05:20:16 PDT 2023
================
@@ -16752,6 +16755,22 @@ template <class MatchContextClass> SDValue DAGCombiner::visitFMA(SDNode *N) {
return SDValue();
}
+SDValue DAGCombiner::visitFMAD(SDNode *N) {
+ SDValue N0 = N->getOperand(0);
+ SDValue N1 = N->getOperand(1);
+ SDValue N2 = N->getOperand(2);
+ EVT VT = N->getValueType(0);
+ SDLoc DL(N);
+
+ // Constant fold FMAD.
+ if (isa<ConstantFPSDNode>(N0) && isa<ConstantFPSDNode>(N1) &&
+ isa<ConstantFPSDNode>(N2)) {
+ return DAG.getNode(ISD::FMAD, DL, VT, N0, N1, N2);
----------------
jayfoad wrote:
Don't need braces around a single line.
https://github.com/llvm/llvm-project/pull/69324
More information about the llvm-commits
mailing list