[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
Wed Jul 10 00:38:40 PDT 2013


On Wed, Jul 10, 2013 at 12:37 AM, Stephen Lin <swlin at post.harvard.edu> wrote:
>> What is the behavior of FMA if the intermediate result overflows?
>> E.g. what does 2 * __DBL_MAX__ - __DBL_MAX__ give as FMA?
>>
>> Joerg
>
> I could be wrong but I don't think it even makes sense to ask about
> the intermediate result overflowing; I think the operation is defined
> as given whatever value would be obtained via an infinite-precision
> real number calculation, rounded at the end to the nearest
> representable double at the end, so there's no intermediate register
> to overflow. Presumably the result would be __DBL_MAX__ in the case
> you give.

(nearest representable double assuming the final result does not
overflow, of course...)



More information about the llvm-commits mailing list