[llvm-commits] [PATCH][Fastmath, Instcombine] Enhancement of Fdiv

dag at cray.com dag at cray.com
Fri Jan 11 15:02:02 PST 2013


Shuxin Yang <shuxin.llvm at gmail.com> writes:

>> Is this rule controlled by strict fp or other options?  Users should be
>> able to disable it for precision.

> Sorry, I forget to mention, it is enabled only if the instruction is
> flagged with "allow reciprocal".
> For all rest rules, they must be marked as "fast-math".

Eli also made that clear.  Thanks!

>>>        2.1). (X/C1) / C2 => X * (1/(C2*C1))

>> Why not do (X/C1) / C2 => X / (C1 * C2) (under switch control) and let
>> 1.1 clean it up if allowed by the previously-explained user switch?

> You are absolutely right!
> Actually, I want to try all the other rules in the form of (....)/C
> before the reciprocal rule.
> i.e the reciprocal rule is the last resort.  But, I have to separate
> the reciprocal rule and
> rest rules to make reviewers happy -- I guess  reviewers might ask me
> to separate the change
> since the reciprocal has negative impact to the precision.

I would like to see this changed to produce X / (C1 * C2) precisely
because of the reciprocal.  X / (C1 * C2) may still be acceptable even
when the reciprocal is not.  In our compiler, for example, we have
multiple levels of fp math safety and users can pick what they want.  It
would be nice to map those to LLVM's optimizations when possible.

                                    -David



More information about the llvm-commits mailing list