From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations? Date: Sat, 4 Jul 2020 08:57:08 -0700 Organization: UCLA Computer Science Department Message-ID: <793d67e0-68a0-fc53-89a9-0902747d6389@cs.ucla.edu> References: <3A9CC2A3-8307-47B2-8D80-795C0AF020E1@acm.org> <0433A879-C98D-4B1A-B85C-A15DA9289099@acm.org> <1621669100.2102667.1593639091621@mail.yahoo.com> <775819003.2516724.1593687594435@mail.yahoo.com> <5F2B4684-34D1-4474-8909-9F435369FE54@acm.org> <705260433.2731607.1593698199171@mail.yahoo.com> <6CF8EE58-9A49-40E7-AA86-48AB39BF94BA@acm.org> <28B19D86-343C-4126-B95F-1F38735F73F2@acm.org> <1288c6a5-545b-f68c-ff6b-7683db3e54c1@cs.ucla.edu> <0AF276D8-FB28-4745-AAE4-DC30E0441F89@acm.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C604600103C626970557F6D0" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37424"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 Cc: Stefan Monnier , Andrea Corallo , 42147@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 04 17:58:55 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jrkZ4-0009ZR-NG for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jul 2020 17:58:54 +0200 Original-Received: from localhost ([::1]:54438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jrkZ3-0000Lv-Np for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jul 2020 11:58:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrkYE-0007WO-NA for bug-gnu-emacs@gnu.org; Sat, 04 Jul 2020 11:58:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47879) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jrkYE-00043n-D0 for bug-gnu-emacs@gnu.org; Sat, 04 Jul 2020 11:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jrkYE-00072I-BT for bug-gnu-emacs@gnu.org; Sat, 04 Jul 2020 11:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jul 2020 15:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42147 X-GNU-PR-Package: emacs Original-Received: via spool by 42147-submit@debbugs.gnu.org id=B42147.159387824526998 (code B ref 42147); Sat, 04 Jul 2020 15:58:02 +0000 Original-Received: (at 42147) by debbugs.gnu.org; 4 Jul 2020 15:57:25 +0000 Original-Received: from localhost ([127.0.0.1]:59425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jrkXb-00071G-Qx for submit@debbugs.gnu.org; Sat, 04 Jul 2020 11:57:25 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:54984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jrkXW-00070u-Kd for 42147@debbugs.gnu.org; Sat, 04 Jul 2020 11:57:23 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 916121600EB; Sat, 4 Jul 2020 08:57:12 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id AgwuUstwyPlT; Sat, 4 Jul 2020 08:57:08 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 989461600F1; Sat, 4 Jul 2020 08:57:08 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id P83Ap5F1zHvR; Sat, 4 Jul 2020 08:57:08 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-75-82-69-226.socal.res.rr.com [75.82.69.226]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 4DC771600EB; Sat, 4 Jul 2020 08:57:08 -0700 (PDT) Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEVtbS95N0xiWUVQUWRVZHh1NDd4QTVL aFRZcDVibHRGM1dZRHoxWQpnZDdneDA3QXV3cDdpdzdlTnZub0RUQWxLQWw4S1lEWnpiRE5D UUdFYnBZM2VmWkl2UGRlSStGV1FONFcra2doCnkrUDZhdTZQcklJaFlyYWV1YTdYRGRiMkxT MWVuM1NzbUUzUWpxZlJxSS9BMnVlOEpNd3N2WGUvV0szOEV6czYKeDc0aVRhcUkzQUZINmls QWhEcXBNbmQvbXNTRVNORnQ3NkRpTzFaS1FNcjlhbVZQa25qZlBtSklTcWRoZ0IxRApsRWR3 MzRzUk9mNlY4bVp3MHhmcVQ2UEtFNDZMY0ZlZnpzMGtiZzRHT1JmOHZqRzJTZjF0azVlVThN Qml5Ti9iClowM2JLTmpOWU1wT0REUVF3dVA4NGtZTGtYMndCeHhNQWhCeHdiRFZadWR6eERa SjFDMlZYdWpDT0pWeHEya2wKakJNOUVUWXVVR3FkNzVBVzJMWHJMdzYrTXVJc0hGQVlBZ1Jy NytLY3dEZ0JBZndoU In-Reply-To: <0AF276D8-FB28-4745-AAE4-DC30E0441F89@acm.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:182696 Archived-At: This is a multi-part message in MIME format. --------------C604600103C626970557F6D0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 7/3/20 11:47 AM, Mattias Engdeg=C3=A5rd wrote: >> Having Emacs use --with-mfpmath=3Dsse should improve performance a bit= on x86. But >> more important, it should make floating point more reproducible. If I = get the >> time I'll look into having 'configure' add it automatically. > Thank you, this would be a prerequisite for further improvements. Attached is a patch to do that. I looked at the GCC source code, and x86 = is the only platform where this sort of thing should be necessary. I'll mention = this patch on emacs-devel, to give people a heads-up before installing. --------------C604600103C626970557F6D0 Content-Type: text/x-patch; charset=UTF-8; name="0001-Prefer-standard-rounding-on-x86.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Prefer-standard-rounding-on-x86.patch" >From df1cd25cefbbbd908efef3023598a6c72d34a176 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 4 Jul 2020 08:43:12 -0700 Subject: [PATCH] Prefer standard rounding on x86 This makes Emacs behavior more consistent across platforms, and should make some byte-code optimizations safer (Bug#42147). We can assume SSE2 by now, since it has been out for 20 years. * configure.ac: On x86 with GCC, default to -msse2 -mfpmath=sse. * etc/NEWS: Mention this. --- configure.ac | 11 +++++++++++ etc/NEWS | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/configure.ac b/configure.ac index 6ede6104d3..9af691078f 100644 --- a/configure.ac +++ b/configure.ac @@ -943,6 +943,17 @@ AC_DEFUN esac fi +# Unless configured otherwise, prefer standard rounding on x86 if available. +# This makes x86 floating-point more consistent with other platforms. +# To build for older x86 processors not supporting SSE2 (introduced in +# 2000), invoke 'configure' with -mno-sse2 in CFLAGS. +case "$host_cpu, $CC $CFLAGS " in + *' -mfpmath='* | *' -mno-sse2 '*) ;; + i?86,* | x86_64,*' -m32 '*) + gl_COMPILER_OPTION_IF([-msse2 -mfpmath=sse], + [CFLAGS="$CFLAGS -msse2 -mfpmath=sse"]);; +esac + # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found]) # --------------------------------------------------------------------------- # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND. diff --git a/etc/NEWS b/etc/NEWS index fc5c215d2a..090ebd6312 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -58,6 +58,12 @@ shaping, so 'configure' now recommends that combination. ** The ftx font backend driver has been removed. It was declared obsolete in Emacs 27.1. +--- +** On x86 with GCC-like compilers, Emac builds now assume SSE2 by default. +This makes x86 floating-point more consistent with other platforms. +To build for older x86 processors not supporting SSE2 (introduced in +2000), invoke 'configure' with -mno-sse2 in CFLAGS. + --- ** Emacs no longer supports old OpenBSD systems. OpenBSD 5.3 and older releases are no longer supported, as they lack -- 2.25.4 --------------C604600103C626970557F6D0--