[PATCH] D39282: DAG: Fold fma (fneg x), K, y -> fma x, -K, y

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 07:34:50 PDT 2017


arsenm added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:10128
+    // fma (fneg x), K, y -> fma x -K, y
+    if (N0.getOpcode() == ISD::FNEG) {
+      return DAG.getNode(ISD::FMA, DL, VT, N0.getOperand(0),
----------------
RKSimon wrote:
> arsenm wrote:
> > RKSimon wrote:
> > > Do we need a OneUse test on FNEG(N0)?
> > I don't think so because this eliminates a use of fneg.
> >> Do we need a OneUse test on FNEG(N0)?
> > I don't think so because this eliminates a use of fneg.
> 
> OK - what about permitting negations of FpImmLegal constants if the negated value is FpImmLegal too?
> 
> 
> 
> 
As far as I can tell no target does anything that would allow the negated value to become legal, so it doesn't seem worth the effort


https://reviews.llvm.org/D39282





More information about the llvm-commits mailing list