unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs using SSE2 on x86
@ 2020-07-04 16:27 Paul Eggert
  2020-07-04 18:58 ` Sven Joachim
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Eggert @ 2020-07-04 16:27 UTC (permalink / raw)
  To: Emacs Development

Bug#42147 reports that Emacs floating-point rounds differently on x86 than on
all other platforms, and in its Message #104 I propose a patch to fix this by
using GCC's -msse2 -mfpmath=sse options. This patch is needed on GNU/Linux
systems; it should be irrelevant on macOS (where SSE2 has always been required)
or on MS-Windows development systems (where SSE2 has been the default since 2012).

The patch cajoles GCC and similar compilers into using 64-bit floating point
instead of erratically substituting 80-bit floating point. Although using 80
bits can improve accuracy, it means the numbers disagree with other platforms
and (as Bug#42147 notes) this is more of a problem for Emacs than any lost accuracy.

The patch relies on SSE2 instructions on the x86, which were introduced in 2000
and which have by now become universal. I don't see a downside of requiring SSE2
for GCC etc., because as far as I can see, in the GNU/Linux world the only
people running 32-bit Emacs on Intelish platforms nowadays are using AMD64 Linux
kernels and compiling with 'gcc -m32', and AMD64 requires SSE2 anyway. However,
I thought I'd mention this on emacs-devel in case I'm missing something.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs using SSE2 on x86
  2020-07-04 16:27 Emacs using SSE2 on x86 Paul Eggert
@ 2020-07-04 18:58 ` Sven Joachim
  2020-07-04 19:19   ` Eli Zaretskii
  2020-07-04 21:10   ` [OFFTOPIC] " Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Sven Joachim @ 2020-07-04 18:58 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Emacs Development

On 2020-07-04 09:27 -0700, Paul Eggert wrote:

> Bug#42147 reports that Emacs floating-point rounds differently on x86 than on
> all other platforms, and in its Message #104 I propose a patch to fix this by
> using GCC's -msse2 -mfpmath=sse options. This patch is needed on GNU/Linux
> systems; it should be irrelevant on macOS (where SSE2 has always been required)
> or on MS-Windows development systems (where SSE2 has been the default since 2012).
>
> The patch cajoles GCC and similar compilers into using 64-bit floating point
> instead of erratically substituting 80-bit floating point. Although using 80
> bits can improve accuracy, it means the numbers disagree with other platforms
> and (as Bug#42147 notes) this is more of a problem for Emacs than any lost accuracy.
>
> The patch relies on SSE2 instructions on the x86, which were introduced in 2000
> and which have by now become universal. I don't see a downside of requiring SSE2
> for GCC etc., because as far as I can see, in the GNU/Linux world the only
> people running 32-bit Emacs on Intelish platforms nowadays are using AMD64 Linux
> kernels and compiling with 'gcc -m32', and AMD64 requires SSE2 anyway. However,
> I thought I'd mention this on emacs-devel in case I'm missing something.

The Debian i386 port still uses older machines without SSE2 as its
baseline, and apparently there are some people who still use Pentium III
or Athlon XP machines, even for web browsing[1].

Whether you want to support them is up to you, but in general Emacs runs
very well even on such old hardware.

Cheers,
       Sven


1. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=877445



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs using SSE2 on x86
  2020-07-04 18:58 ` Sven Joachim
@ 2020-07-04 19:19   ` Eli Zaretskii
  2020-07-04 23:07     ` Andrea Corallo via Emacs development discussions.
  2020-07-04 21:10   ` [OFFTOPIC] " Stefan Monnier
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2020-07-04 19:19 UTC (permalink / raw)
  To: Sven Joachim; +Cc: eggert, Emacs-devel

> From: Sven Joachim <svenjoac@gmx.de>
> Date: Sat, 04 Jul 2020 20:58:34 +0200
> Cc: Emacs Development <Emacs-devel@gnu.org>
> 
> The Debian i386 port still uses older machines without SSE2 as its
> baseline, and apparently there are some people who still use Pentium III
> or Athlon XP machines, even for web browsing[1].
> 
> Whether you want to support them is up to you, but in general Emacs runs
> very well even on such old hardware.

Maybe we should step back a notch and remind ourselves why do we want
to make this change.  What exactly are we going to gain, and are these
gains important enough for us to have to deal with all the issues it
will raise (some of which were already mentioned in this discussion)?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [OFFTOPIC] Re: Emacs using SSE2 on x86
  2020-07-04 18:58 ` Sven Joachim
  2020-07-04 19:19   ` Eli Zaretskii
@ 2020-07-04 21:10   ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2020-07-04 21:10 UTC (permalink / raw)
  To: Sven Joachim; +Cc: Paul Eggert, Emacs Development

> The Debian i386 port still uses older machines without SSE2 as its
> baseline, and apparently there are some people who still use Pentium III
> or Athlon XP machines, even for web browsing[1].
> Whether you want to support them is up to you, but in general Emacs runs
> very well even on such old hardware.

Web browsing is pretty painful on my Thinkpad X30 (tho it seems to be
largely due to the 768MB of RAM), but indeed xterm and Emacs work just
fine (I mostly use it with doc-view-mode which works particularly well
since it pre-computes the pages).

Admittedly, I'm beginning to have to phase it out because projectors
around here seem to finally be switching away from VGA.


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs using SSE2 on x86
  2020-07-04 19:19   ` Eli Zaretskii
@ 2020-07-04 23:07     ` Andrea Corallo via Emacs development discussions.
  0 siblings, 0 replies; 5+ messages in thread
From: Andrea Corallo via Emacs development discussions. @ 2020-07-04 23:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Sven Joachim, eggert, Emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Sven Joachim <svenjoac@gmx.de>
>> Date: Sat, 04 Jul 2020 20:58:34 +0200
>> Cc: Emacs Development <Emacs-devel@gnu.org>
>> 
>> The Debian i386 port still uses older machines without SSE2 as its
>> baseline, and apparently there are some people who still use Pentium III
>> or Athlon XP machines, even for web browsing[1].
>> 
>> Whether you want to support them is up to you, but in general Emacs runs
>> very well even on such old hardware.
>
> Maybe we should step back a notch and remind ourselves why do we want
> to make this change.  What exactly are we going to gain, and are these
> gains important enough for us to have to deal with all the issues it
> will raise (some of which were already mentioned in this discussion)?

Is the only concern the moving in the compile-time of floating point
operations those result is not completely portable while producing the
.elc?  If this is the case I'm wondering how many of these optimizations
do we really perform compiling Emacs and if we really care about the
possible rounding difference.

If this is the case, regarding the first question, should easy to just
count performing a bootstrap with some instrumentation.

Regards

  Andrea

-- 
akrl@sdf.org



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-04 23:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-04 16:27 Emacs using SSE2 on x86 Paul Eggert
2020-07-04 18:58 ` Sven Joachim
2020-07-04 19:19   ` Eli Zaretskii
2020-07-04 23:07     ` Andrea Corallo via Emacs development discussions.
2020-07-04 21:10   ` [OFFTOPIC] " Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).