[PATCH] D108619: [DAGCombine] Allow FMA combine with both FMA and FMAD

Carl Ritson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 27 03:04:44 PDT 2021


critson marked 2 inline comments as done.
critson added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13107
+    SDValue CDE = DAG.getNode(FMA.getOpcode(), SL, VT, C, D, E);
+    return DAG.getNode(FMA.getOpcode(), SL, VT, A, B, CDE);
   }
----------------
foad wrote:
> On second thoughts, perhaps there's no point trying to preserve the original opcode for the `A*B+something` part, because the `something` is different, so it's impossible to retain the (fused vs unfused) rounding behaviour of the original opcode.
> 
> So perhaps your original approach of using `DAG.getNode(PreferredFusedOpcode, ...)` everywhere is the best we can do. Sorry for the noise.
No worries, I have spent a while thinking about it too.
I tested both versions so far on image output tests and could not detect and meaningful difference.
I also implemented the mixed preservation intended with your comment.
However, let's just go with the original.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108619/new/

https://reviews.llvm.org/D108619



More information about the llvm-commits mailing list