[PATCH] Allow FMAs in safe math mode in some cases when one operand of the fmul is either exactly 0.0 or exactly 1.0.

Stephen Lin swlin at post.harvard.edu
Tue Jul 9 23:36:53 PDT 2013


On Tue, Jul 9, 2013 at 11:30 PM, Joerg Sonnenberger
<joerg at britannica.bec.de> wrote:
> On Tue, Jul 09, 2013 at 04:45:47PM -0500, Hal Finkel wrote:
>> I'm thinking of something like this: autovectorize this:
>> for (...) {
>>   a[i] = 1.0 + b[i]*c[i];
>> }
>> and you'll get a uniform vector of 1.0. I think that this is not uncommon.
>
> This can trigger the rounding difference though?
>
> Joerg

Yes, I think Hal mistyped what he meant. The above case is not what is
being handled (in scalar form) by this patch; this patch only applies
when on of the operands of the multiply is known to be either 0.0
(positive or negative) or 1.0 exactly, in which case I do not believe
there is any possibility of rounding on the multiply step.

Stephen



More information about the llvm-commits mailing list