From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.2 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 804541F461 for ; Thu, 27 Jun 2019 21:17:13 +0000 (UTC) Received: from localhost ([::1]:54736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgblY-0007EW-Rb for normalperson@yhbt.net; Thu, 27 Jun 2019 17:17:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56068) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgbhs-0004Gs-7V for bug-gnulib@gnu.org; Thu, 27 Jun 2019 17:13:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgbhq-0007KP-9h for bug-gnulib@gnu.org; Thu, 27 Jun 2019 17:13:24 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42726) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgbho-0007E6-Cx for bug-gnulib@gnu.org; Thu, 27 Jun 2019 17:13:21 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 08872161BDC; Thu, 27 Jun 2019 14:13:16 -0700 (PDT) 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 e-Ddqz0_GO2D; Thu, 27 Jun 2019 14:13:15 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 23DE3161C02; Thu, 27 Jun 2019 14:13:15 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 hO_HKpPJzR9A; Thu, 27 Jun 2019 14:13:15 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 01644161BDC; Thu, 27 Jun 2019 14:13:15 -0700 (PDT) Subject: Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers To: Pip Cet References: <7ef599ae-0a1d-e86f-2bed-a1503455833f@cs.ucla.edu> From: Paul Eggert Openpgp: preference=signencrypt Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6PrIIhYraeua7XDdb2LS1en3Ss mE3QjqfRqI/A2ue8JMwsvXe/WK38Ezs6x74iTaqI3AFH6ilAhDqpMnd/msSESNFt76DiO1ZK QMr9amVPknjfPmJISqdhgB1DlEdw34sROf6V8mZw0xfqT6PKE46LcFefzs0kbg4GORf8vjG2 Sf1tk5eU8MBiyN/bZ03bKNjNYMpODDQQwuP84kYLkX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YJoXvQfD5L3lqAl8TCqDUzYxhH/tJhbDdHrqHH767jaDaTB1+Talp/2AMKwc XNOdiklGxbmHVG6YGl6g8Lrbsu9NZEI4yLlHzuikthJWgz+3vZhVGyNlt+HNIoF6CjDL2omu 5cEq4RDHM44QqPk6l7O0pUvN1mT4B+S1b08RKpqm/ff015E37HNV/piIvJlxGAYz8PSfuGCB 1thMYqlmgdhd9/BabGFbGGYHA6U4/T5zqU+f6xHy1SsAQZ1MSKlLwekBIT+4/cLRGqCHjnV0 q5H/T6a7t5mPkbzSrOLSo4puj+IToNjYyYIDBWzhlA19avOa+rvUjmHtD3sFN7cXWtkGoi8b uNcby4U= Organization: UCLA Computer Science Department Message-ID: <5284eb58-3560-da42-d1d1-3bdb930eae49@cs.ucla.edu> Date: Thu, 27 Jun 2019 14:13:14 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------0E9AA5AAFD624B3F33C2ECCE" Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 36370@debbugs.gnu.org, Gnulib bugs Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" This is a multi-part message in MIME format. --------------0E9AA5AAFD624B3F33C2ECCE Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 6/27/19 12:56 PM, Pip Cet wrote: > The eassume tells GCC i is nonnegative, since (!(i >= 0) == !(i >= 0)) > is indeed a constant. Ah! Thanks, I didn't catch that subtle point. Would the attached patch to verify.h address that problem? This patch is for Gnulib, but would propagate into Emacs. I tried this out with Emacs master and although it did change the machine code subtly I didn't have the patience to see whether the changes were likely to improve performance. The changes did grow the Emacs text segment from 2556193 to 2557657 bytes (a 0.06% growth), which is not a good sign. This was on Fedora 30 x86-64 with a default Emacs build. I'll CC: this to bug-gnulib since it's a Gnulib issue. I have not installed this patch into Gnulib on savannah. --------------0E9AA5AAFD624B3F33C2ECCE Content-Type: text/x-patch; name="0001-verify-tweak-assume-performance.patch" Content-Disposition: attachment; filename="0001-verify-tweak-assume-performance.patch" Content-Transfer-Encoding: quoted-printable >From 9a5a83937544e7c127026fcf32030f7dbaa5766c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 27 Jun 2019 14:01:53 -0700 Subject: [PATCH] =3D?UTF-8?q?verify:=3D20tweak=3D20=3DE2=3D80=3D98assume=3D= E2=3D80=3D99=3D20pe?=3D =3D?UTF-8?q?rformance?=3D MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Suggested by Pip Cet (Bug#36370#30). * lib/verify.h (assume): Use __builtin_constant_p to generate better code in recent GCC. --- ChangeLog | 7 +++++++ lib/verify.h | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ae108e25..7059f4f2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-06-27 Paul Eggert + + verify: tweak =E2=80=98assume=E2=80=99 performance + Suggested by Pip Cet (Bug#36370#30). + * lib/verify.h (assume): Use __builtin_constant_p to generate + better code in recent GCC. + 2019-06-26 Paul Eggert =20 strverscmp: sync from glibc diff --git a/lib/verify.h b/lib/verify.h index f8e4eff02..9b015c693 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -263,9 +263,11 @@ template accordingly. R should not have side-effects; it may or may not be evaluated. Behavior is undefined if R is false. */ =20 -#if (__has_builtin (__builtin_unreachable) \ +#if ((__has_builtin (__builtin_constant_p) \ + && __has_builtin (__builtin_unreachable)) \ || 4 < __GNUC__ + (5 <=3D __GNUC_MINOR__)) -# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) +# define assume(R) (!__builtin_constant_p (!(R) =3D=3D !(R)) || (R) \ + ? (void) 0 : __builtin_unreachable ()) #elif 1200 <=3D _MSC_VER # define assume(R) __assume (R) #elif ((defined GCC_LINT || defined lint) \ --=20 2.21.0 --------------0E9AA5AAFD624B3F33C2ECCE--