Concerns regarding the -ffp-contract=fast default
Joseph Myers
joseph@codesourcery.com
Mon Sep 18 17:39:54 GMT 2023
On Mon, 18 Sep 2023, Alexander Monakov wrote:
>
> On Mon, 18 Sep 2023, Florian Weimer wrote:
>
> > Okay, you meant “changing the result” as in “changing the result in a
> > permitted way”. Sorry, was confused. So this is a bad example all
> > around. Are there better ones (that don't involve FMA)?
>
> If you're looking for something similar to your original example, I can
> suggest 'x + x + x + x' -> '4 * x' under -frounding-math (i.e. not assuming
> default rounding mode) or 'x + x + x + x + x + x' -> '6 * x' for default
> rounding.
>
> I don't have a "somewhat practical" example off-hand, since apart from FMA
> fused operations are rarely available in instruction sets.
Apart from FMA, there are the formatOf operations such as fadd (add two
doubles, rounding the result just once to float). Fewer instruction sets
have those than have FMA, however (ia64 did; newer versions of Power
support such operations as well to some extent, though with limitations
when underflow or overflow occur).
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc
mailing list