[llvm-commits] [llvm] r171793 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombine.h lib/Transforms/InstCombine/InstCombineMulDivRem.cpp test/Transforms/InstCombine/fast-math.ll
Stephen Canon
scanon at apple.com
Mon Jan 7 13:54:07 PST 2013
On Jan 7, 2013, at 4:39 PM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:
> Author: shuxin_yang
> Date: Mon Jan 7 15:39:23 2013
> New Revision: 171793
>
> URL: http://llvm.org/viewvc/llvm-project?rev=171793&view=rev
> Log:
> This change is to implement following rules:
>
> o. X/C1 * C2 => X * (C2/C1) (if C2/C1 is neither special FP nor denormal)
> o. X/C1 * C2 -> X/(C1/C2) (if C2/C1 is either specical FP or denormal, but C1/C2 is a normal Fp)
We should be able to avoid the divide by instead transforming this to (X * (SCALE^-1 * C2/C1)) * SCALE, where SCALE is a constant of the form 2^n chosen such that (SCALE^-1 * C2/C1) is a normal FP number. On nearly all modern architectures two multiplies are cheaper than a divide, and this will cover a much larger set of cases for which C2/C1 is not representable.
- Steve
More information about the llvm-commits
mailing list