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

Shuxin Yang shuxin.llvm at gmail.com
Fri Jan 11 15:15:39 PST 2013


>> 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
We don't have flags to control this. This xform is controlled by 
"fast-math", which implies
"unsafe algebra" which is the highest relax level. Maybe we should 
introduce more flags to control
the precision? Michael?

BTW,  I realized my previous response to this issue is not quite 
to-the-point.
I didn't divide X/C1/C2 => X * 1/(C1*C2) in two steps:
    X/ (C1*C2) and optionally X * 1/(C1*C2)
due to the structure of the my code.  It is more convenient to fold 
these two steps in one shot.

I guess the reciprocal problem bug you as well. I will discuss with my 
coworker Michale soliciting his insight
about how to do it right.

Thanks
Shuxin



More information about the llvm-commits mailing list