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

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 27 01:50:19 PDT 2021


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13107
     SDValue CDE = DAG.getNode(PreferredFusedOpcode, SL, VT, C, D, E);
     return DAG.getNode(PreferredFusedOpcode, SL, VT, A, B, CDE);
   }
----------------
foad wrote:
> Could use `FMA.getOpcode()` instead of `PreferredFusedOpcode` here, to try to preserve the original opcode  of the `A*B+something` part of the expression. But that's getting pretty subtle and I'm not sure if it will make any practical difference.
> 
> The same goes for any other parts of combines which preserve an fma(d) instead of creating a new one from scratch.
What I meant was, use `FMA.getOpcode()` for `A*B+something` because it's preserving an existing fma(d) from the input, but still use `PreferredFusedOpcode` for `C*D+something` because it is a new fma(d) that we are creating by fusing an fmul and and fadd from the input.

I realise this is pretty subtle and I'm not sure it will make any practical difference.


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