[PATCH] D154805: [DAGCombiner] Fold IEEE `fmul`/`fdiv` by Pow2 to `add`/`sub` of exp
    Noah Goldstein via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Aug 16 00:02:18 PDT 2023
    
    
  
goldstein.w.n marked an inline comment as done.
goldstein.w.n added inline comments.
================
Comment at: llvm/include/llvm/CodeGen/TargetLowering.h:822-823
+                                                   SDValue IntPow2) const {
+    // Default to avoiding fdiv which is often very expensive.
+    return N->getOpcode() == ISD::FDIV;
+  }
----------------
arsenm wrote:
> I think the fdiv by power of 2 should be generally converted to fmul by inverse power of 2 in the first place
Maybe although you still need recipricol which is still division. But would rather make that tradeoff a seperate patch either way.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154805/new/
https://reviews.llvm.org/D154805
    
    
More information about the llvm-commits
mailing list