[PATCH] D154678: [InstCombine] Fold IEEE `fmul`/`fdiv` by Pow2 to `add`/`sub` of exp

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 11:26:14 PDT 2023


arsenm added a comment.

In D154678#4486199 <https://reviews.llvm.org/D154678#4486199>, @goldstein.w.n wrote:

> So you mean handle `fdiv` only and do the following:
>
>   (fdiv C, (uitofp Pow2))
>       -> (fmul C, (bitcast_to_FP (sub (FP_One), Log2(Pow2) << mantissa)))

Yes. It seems InstCombine already turns fdiv by constant power of 2 to fmul, but not the unknown-but-known-to-be-pow2 case here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154678



More information about the llvm-commits mailing list