All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: linux-parisc@vger.kernel.org,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	John David Anglin <dave.anglin@bell.net>
Subject: [PATCH] parisc: Prevent using same register as soure and target in extru/shr
Date: Tue, 17 May 2022 14:49:15 +0200	[thread overview]
Message-ID: <YoOZy3A3R0i0DUWB@p100> (raw)

In 2004 Randolph added the shr() assembly macro and noted that the
source and target register could not be the same.

I did not find any confindence in the docs for this restriction. Maybe
it's related that on PA2.0 the upper bits may be clobbered?

Anyway, add a compile-time check for it now.

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/arch/parisc/include/asm/assembly.h b/arch/parisc/include/asm/assembly.h
index ea0cb318b13d..ca1a12ae5ee7 100644
--- a/arch/parisc/include/asm/assembly.h
+++ b/arch/parisc/include/asm/assembly.h
@@ -146,6 +146,9 @@
 	/* Shift Right - note the r and t can NOT be the same! */
 	.macro shr r, sa, t
 	extru \r, 31-(\sa), 32-(\sa), \t
+.ifc \r,\t
+        .error "Can not used the same register (\r) in shr/extru as source and target register."
+.endif
 	.endm

 	/* pa20w version of shift right */

             reply	other threads:[~2022-05-17 12:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17 12:49 Helge Deller [this message]
2022-05-17 12:54 ` [PATCH] parisc: Prevent using same register as soure and target in extru/shr Helge Deller
2022-05-17 13:41   ` John David Anglin
2022-05-18  6:57   ` Sven Schnelle
2022-05-18  7:10     ` Helge Deller

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=YoOZy3A3R0i0DUWB@p100 \
    --to=deller@gmx.de \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=linux-parisc@vger.kernel.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 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.