https://gcc.gnu.org/bugzilla/show_bug.cgi?id=22326
--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #18)
> Why is it correct to convert the double x to single precision here?!
For
float foo(float f, float x, float y) {
return (fabs(f)*x+y);
}
it is not unless when using FMA intermediate _overflow_ is also "ignored"
(as opposed to just performing one rounding step and thus requiring one bit
more precision).
Note that the set of inputs where it is errorneous (producing +-Inf rather than
a finite number) is small and thus it might fall into the realms of
-funsafe-math-optimizations (even a 1 ulp change can make a big difference
when in the divisor for example).
These kind of FP "optimizations" are always tricky.