From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: HAVE_FAST_UNALIGNED_ACCESS Date: Sat, 1 Apr 2023 09:42:53 +0200 Message-ID: <63A29442-4C0C-4C3C-B40E-4A3DB91E3009@gmail.com> References: <87sfdmlgzx.fsf@gmail.com> <94d3de92c50a96d9172f88462bf3bc9c2792600c.camel@gmail.com> <83mt3s244o.fsf@gnu.org> <875yagtopn.fsf@yahoo.com> <838rfc17ja.fsf@gnu.org> <871ql4t8ph.fsf@yahoo.com> <83wn2wyuli.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.14\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_27472F66-EF4E-4C06-BC46-E4C0E4E3F9A2" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2380"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Po Lu , vibhavp@gmail.com, rpluim@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 01 10:19:53 2023 Return-path: Envelope-to: ged-emacs-devel@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 1piWSm-0000Pc-Q6 for ged-emacs-devel@m.gmane-mx.org; Sat, 01 Apr 2023 10:19:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1piWSD-0003YD-ED; Sat, 01 Apr 2023 04:19:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piVt5-0005Go-HV for emacs-devel@gnu.org; Sat, 01 Apr 2023 03:42:59 -0400 Original-Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1piVt3-0007Az-JH; Sat, 01 Apr 2023 03:42:58 -0400 Original-Received: by mail-lf1-x132.google.com with SMTP id g19so18686488lfr.9; Sat, 01 Apr 2023 00:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680334975; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=vbdvwe7MCfPQSWSY29CRyld25eKDJbMvSU4l567sejg=; b=ApMqkeSRbcsDPdiECU4wvfl06R85TeXhQtbU++FRFqrLN+tfNygfB2uwzCDdbrrAAi mV71OLodI1E3nRv+MP9oKiH3+cimb9DG5EYmmg2Pb/Qjr6qn4l08Hqtl31nmI5B4701v UWNRW+pK4cwZIPbjZwqFYMYxwP3OWClyJJtqC1RASGS5+XuieKXp3Ojoz0CGRsg0l6K0 UOOGRk9RUKuFLxBP4ZELfF01CizWfH4fLUkdcvlVsZkGZkdpYen8QLHcCRjt5/1B7dmC +Tj8+lieTA8jqGSiv2ILHsw+oX4biUvIbd74LnA/KIzTbyQwkRcRb48hhkAAWBtkJ3Dl CT+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680334975; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vbdvwe7MCfPQSWSY29CRyld25eKDJbMvSU4l567sejg=; b=21fKQwQ8yZYRusGVZazdmdCEq9wyeJMq9JF8dTESsRmaPloE5rtufNyxcGgoj2TAQt J4/LXe2mQnjeQfsmqFoesjE4vrzLQ8nAbPtZU9V41Gi1AM0Tzl/JuP3T4aHSQAsM3mDo 80GoLydtQC9IWINcJxH5un2JL7cIxHRYlVJzzGs5Sz2DEy+fkemM5tr2fqUOKDZooKPb WVtL930hAdwWovMZX03WGIhS4ysh+d3/X4aLp7mNU5atgZBqPRMGDaE/FQ6O6QENA2Qy H5w72FEoZtjs2JXXcHN4biIPi6u1PPPY4oc8FEIRUrf5kh4mAH7AbAy6a9pmxljA0r2L mkAA== X-Gm-Message-State: AAQBX9dnA8TN8QG8q32b4FwL8IKLAPD4hp9JX3zNdt5LcgO7nEgTZRdS 3rCbsCMHgruba5NFak1jJa+XPtdF0E4= X-Google-Smtp-Source: AKy350ZfuOWmNJbZW4/j1c+kmerQZ5b9vNTZu4y1E7tnQKktdS/QjK0K/GGw981+BSPvFjQKzo3Zuw== X-Received: by 2002:ac2:53ad:0:b0:4dc:6ad4:5fe4 with SMTP id j13-20020ac253ad000000b004dc6ad45fe4mr8716316lfh.32.1680334974976; Sat, 01 Apr 2023 00:42:54 -0700 (PDT) Original-Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id q9-20020ac25a09000000b004e9b307d2c8sm710619lfn.238.2023.04.01.00.42.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Apr 2023 00:42:54 -0700 (PDT) In-Reply-To: <83wn2wyuli.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.14) Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=mattias.engdegard@gmail.com; helo=mail-lf1-x132.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 01 Apr 2023 04:19:15 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304979 Archived-At: --Apple-Mail=_27472F66-EF4E-4C06-BC46-E4C0E4E3F9A2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 1 apr. 2023 kl. 08.39 skrev Eli Zaretskii : > I don't want to make changes on the release branch without a positive > evidence that the existing code causes verifiable problems. And even > then I prefer to make changes only for platforms where those problems > happen. I'm not overly worried about the code, but to put this matter to rest, = what about simply dropping the vectorisation altogether, on all = platforms, in Emacs 29? That should be very safe. --Apple-Mail=_27472F66-EF4E-4C06-BC46-E4C0E4E3F9A2 Content-Disposition: attachment; filename=drop-string-lessp-vectorisation.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="drop-string-lessp-vectorisation.diff" Content-Transfer-Encoding: 7bit diff --git a/src/fns.c b/src/fns.c index ff364c65e26..95c4d2c028c 100644 --- a/src/fns.c +++ b/src/fns.c @@ -438,22 +438,6 @@ DEFUN ("compare-strings", Fcompare_strings, Scompare_strings, 6, 7, 0, return Qt; } -/* Check whether the platform allows access to unaligned addresses for - size_t integers without trapping or undue penalty (a few cycles is OK). - - This whitelist is incomplete but since it is only used to improve - performance, omitting cases is safe. */ -#if defined __x86_64__|| defined __amd64__ \ - || defined __i386__ || defined __i386 \ - || defined __arm64__ || defined __aarch64__ \ - || defined __powerpc__ || defined __powerpc \ - || defined __ppc__ || defined __ppc \ - || defined __s390__ || defined __s390x__ -#define HAVE_FAST_UNALIGNED_ACCESS 1 -#else -#define HAVE_FAST_UNALIGNED_ACCESS 0 -#endif - DEFUN ("string-lessp", Fstring_lessp, Sstring_lessp, 2, 2, 0, doc: /* Return non-nil if STRING1 is less than STRING2 in lexicographic order. Case is significant. @@ -491,20 +475,6 @@ DEFUN ("string-lessp", Fstring_lessp, Sstring_lessp, 2, 2, 0, ptrdiff_t nb = min (nb1, nb2); ptrdiff_t b = 0; - /* String data is normally allocated with word alignment, but - there are exceptions (notably pure strings) so we restrict the - wordwise skipping to safe architectures. */ - if (HAVE_FAST_UNALIGNED_ACCESS) - { - /* First compare entire machine words. */ - typedef size_t word_t; - int ws = sizeof (word_t); - const word_t *w1 = (const word_t *) SDATA (string1); - const word_t *w2 = (const word_t *) SDATA (string2); - while (b < nb - ws + 1 && w1[b / ws] == w2[b / ws]) - b += ws; - } - /* Scan forward to the differing byte. */ while (b < nb && SREF (string1, b) == SREF (string2, b)) b++; --Apple-Mail=_27472F66-EF4E-4C06-BC46-E4C0E4E3F9A2--