public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sebastian Huber <sh@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] powerpc/setjmp: Fix 64-bit buffer alignment
Date: Thu, 10 Nov 2022 15:06:52 +0000 (GMT)	[thread overview]
Message-ID: <20221110150652.64E013858439@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5c79aa4b22df09b6fb3e97538fee7f108f9fd768

commit 5c79aa4b22df09b6fb3e97538fee7f108f9fd768
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date:   Mon Nov 7 14:33:42 2022 +0100

    powerpc/setjmp: Fix 64-bit buffer alignment
    
    The rlwinm is a word-size instruction which clears the remaining 32 bits of a
    64-bit register.  Use clrrdi in 64-bit configurations.

Diff:
---
 newlib/libc/machine/powerpc/setjmp.S | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/newlib/libc/machine/powerpc/setjmp.S b/newlib/libc/machine/powerpc/setjmp.S
index 3a6fa4a58..c7af5b105 100644
--- a/newlib/libc/machine/powerpc/setjmp.S
+++ b/newlib/libc/machine/powerpc/setjmp.S
@@ -8,11 +8,19 @@
 FUNC_START(setjmp)
 #ifdef __ALTIVEC__
 	addi	3,3,15		# align Altivec to 16 byte boundary
+#if __powerpc64__
+	clrrdi	3,3,4
+#else
 	rlwinm	3,3,0,0,27
+#endif
 #else
 	addi	3,3,7		# align to 8 byte boundary
+#if __powerpc64__
+	clrrdi	3,3,3
+#else
 	rlwinm	3,3,0,0,28
 #endif
+#endif
 #if __SPE__
 	/* If we are E500, then save 64-bit registers.  */
 	evstdd	1,0(3)		# offset 0
@@ -193,11 +201,19 @@ FUNC_END(setjmp)
 FUNC_START(longjmp)
 #ifdef __ALTIVEC__
 	addi	3,3,15		# align Altivec to 16 byte boundary
+#if __powerpc64__
+	clrrdi	3,3,4
+#else
 	rlwinm	3,3,0,0,27
+#endif
 #else
 	addi	3,3,7		# align to 8 byte boundary
+#if __powerpc64__
+	clrrdi	3,3,3
+#else
 	rlwinm	3,3,0,0,28
 #endif
+#endif
 #if __SPE__
 	/* If we are E500, then restore 64-bit registers.  */
 	evldd	1,0(3)		# offset 0

                 reply	other threads:[~2022-11-10 15:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221110150652.64E013858439@sourceware.org \
    --to=sh@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /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.
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).