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

From: Pip Cet <[email-masked]>
Date: Sat, 4 Jul 2020 22:25:55 +0000

On Sat, Jul 4, 2020 at 9:05 PM Stefan Monnier <[email-masked]> wrote:
> > So it's a GCC bug? Wouldn't it be better to fix that?
>
> Not really, no: the x87 hardware makes it difficult to get the exact
> behavior of 64bit floats, so either you live with "almost" the right
> behavior or you don't use the x87 hardware (which on pre-SSE2 hardware
> implies a massive slow down on floating point operations).

Precisely. Those are the two options GCC should offer, instead of (or
in addition to) three degrees of wrongness. This is obsolete hardware
which does not, apparently, provide any support for adding two IEEE
754 64-bit floats. Pretending it does is not helpful and, at the very
least, a bug in the documentation.

> >> Several GNU/Linux distributions have already dropped support for x86-only
> >> hardware like the circa-2001 Intel Mobile Pentium III-M in your laptop. On the
> >> distributions that still support i686, you can still build and run Emacs on your
> >> laptop (which has SSE but not SSE2) by configuring with CFLAGS='-msse
> >> -mfpmath=sse -fexcess-precision=standard'; this should avoid some (but not all)
> >> of the rounding problems.

FWIW, that doesn't seem to have any effect here, it just uses x87 instructions.

> If I need to change the flags, then I'm much more likely to just use the
> "normal" compilation option: I actually couldn't care less about the
> potential differences in rounding.
>
> I'm actually not completely sure why we care about those minor
> rounding differences.

Neither am I. If the idea is to standardize Emacs on a single
floating-point representation, let's at least use the 61-bit floats
Paul suggested a while back? (Incidentally, I believe those can be
implemented somewhat more efficiently on x87 hardware). Or we could go
with bignum ratios or GMP floats.