all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Po Lu <luangruo@yahoo.com>,
	vibhavp@gmail.com, rpluim@gmail.com, emacs-devel@gnu.org
Subject: Re: HAVE_FAST_UNALIGNED_ACCESS
Date: Sat, 1 Apr 2023 09:42:53 +0200	[thread overview]
Message-ID: <63A29442-4C0C-4C3C-B40E-4A3DB91E3009@gmail.com> (raw)
In-Reply-To: <83wn2wyuli.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 481 bytes --]

1 apr. 2023 kl. 08.39 skrev Eli Zaretskii <eliz@gnu.org>:

> 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.


[-- Attachment #2: drop-string-lessp-vectorisation.diff --]
[-- Type: application/octet-stream, Size: 1818 bytes --]

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++;

  reply	other threads:[~2023-04-01  7:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30  9:34 HAVE_FAST_UNALIGNED_ACCESS Robert Pluim
2023-03-30 10:26 ` HAVE_FAST_UNALIGNED_ACCESS Eli Zaretskii
2023-03-30 11:09   ` HAVE_FAST_UNALIGNED_ACCESS Sam James
2023-03-30 12:18   ` HAVE_FAST_UNALIGNED_ACCESS Arsen Arsenović
     [not found]     ` <87v8ihu3t8.fsf@yahoo.com>
2023-03-31  7:15       ` HAVE_FAST_UNALIGNED_ACCESS Robert Pluim
2023-03-31  7:45       ` HAVE_FAST_UNALIGNED_ACCESS Arsen Arsenović
2023-03-31 17:29     ` HAVE_FAST_UNALIGNED_ACCESS Mattias Engdegård
2023-03-31 20:13       ` HAVE_FAST_UNALIGNED_ACCESS Arsen Arsenović
2023-03-30 10:28 ` HAVE_FAST_UNALIGNED_ACCESS Mattias Engdegård
2023-03-30 11:38 ` HAVE_FAST_UNALIGNED_ACCESS Vibhav Pant
2023-03-31 16:57   ` HAVE_FAST_UNALIGNED_ACCESS Mattias Engdegård
2023-03-31 17:59     ` HAVE_FAST_UNALIGNED_ACCESS Eli Zaretskii
2023-03-31 18:03       ` HAVE_FAST_UNALIGNED_ACCESS Mattias Engdegård
2023-03-31 18:12         ` HAVE_FAST_UNALIGNED_ACCESS Eli Zaretskii
2023-04-01  0:45         ` HAVE_FAST_UNALIGNED_ACCESS Po Lu
2023-04-01  5:43           ` HAVE_FAST_UNALIGNED_ACCESS Eli Zaretskii
2023-04-01  6:31             ` HAVE_FAST_UNALIGNED_ACCESS Po Lu
2023-04-01  6:39               ` HAVE_FAST_UNALIGNED_ACCESS Eli Zaretskii
2023-04-01  7:42                 ` Mattias Engdegård [this message]
2023-04-01  8:19                   ` HAVE_FAST_UNALIGNED_ACCESS Eli Zaretskii
2023-04-01  9:17                     ` HAVE_FAST_UNALIGNED_ACCESS Po Lu
2023-04-01 11:25                       ` HAVE_FAST_UNALIGNED_ACCESS Eli Zaretskii
2023-04-01 12:59                         ` HAVE_FAST_UNALIGNED_ACCESS Arsen Arsenović
2023-04-01 13:33                           ` HAVE_FAST_UNALIGNED_ACCESS Eli Zaretskii
2023-04-01 15:22                             ` HAVE_FAST_UNALIGNED_ACCESS Arsen Arsenović
2023-04-01 16:22                               ` HAVE_FAST_UNALIGNED_ACCESS Eli Zaretskii
2023-04-02  0:50                                 ` HAVE_FAST_UNALIGNED_ACCESS Po Lu
2023-04-02  0:48                             ` HAVE_FAST_UNALIGNED_ACCESS Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63A29442-4C0C-4C3C-B40E-4A3DB91E3009@gmail.com \
    --to=mattias.engdegard@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=rpluim@gmail.com \
    --cc=vibhavp@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.