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

From: Paul Eggert <[email-masked]>
Date: Sat, 4 Jul 2020 10:00:39 -0700

On 7/4/20 9:33 AM, Stefan Monnier wrote:
> Is there a way to tell gcc to try and avoid x87's idiosyncrasies without
> being platform-dependent (or at least without imposing SSE2, since
> I still use Emacs on my old Thinkpad X30)?

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. However, this still suffers from double-rounding on the x86 unless
you also specify -msse2 -mfpmath=sse. (-fexcess-precision=standard supports the
C standard better than the older -ffloat-store option, which generates code that
is faster but has more double-rounding problems than -fexcess-precision=standard
does.)

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.