[PATCH] D108284: [DAGCombiner] Combine frem into fdiv+ftrunc+fma

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 25 02:25:47 PDT 2021


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14425
 
+  // (frem x, y) -> (fma (fneg (ftrunc (fdiv x, y))), y, x)
+  if (Flags.hasApproximateFuncs() &&
----------------
foad wrote:
> Is this always preferable, even on targets where FREM is legal?
I see you have added an isLegal check for FREM. But I don't understand why you are doing this as a combine in the first place, instead of changing the way FREM is legalized to do this as a lowering instead of calling a libcall.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108284



More information about the llvm-commits mailing list