Subject: bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?

From: Mattias Engdegård <[email-masked]>
Date: Sat, 4 Jul 2020 21:01:44 +0200

4 juli 2020 kl. 19.00 skrev Paul Eggert <[email-masked]>:

> Not as far as I know. GCC's -fexcess-precision=standard option tries to do that,
> by causing GCC to convert 80-bit results to 64-bit results after every 80-bit
> operation.

Not quite after every operation:

  y = x * a + b;

With -fexcess-precision=standard, the 80-bit result of the multiplication will be used in the addition. With -ffloat-store, a 64-bit store and reload will take place between the two operations, forcing excess fraction bits to be discarded.

Another option is to set the Precision Control field in the x87 control word to 53-bit precision; that pretty much eliminates double rounding, but still uses the extended exponent range (only matters in overflow and underflow cases). And it may confuse libc's carefully crafted floating-point functions.