public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] x86: fold conditionals in check_long_reg()
Date: Fri, 17 Nov 2023 10:21:31 +0000 (GMT)	[thread overview]
Message-ID: <20231117102131.372C53858C41@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d9a1b71137d206f1ff73eee25423cf6d22814495

commit d9a1b71137d206f1ff73eee25423cf6d22814495
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Nov 17 11:20:25 2023 +0100

    x86: fold conditionals in check_long_reg()
    
    Simplify the code follow ing what check_{,q}word_reg() already do. This
    the also eliminates a stale comment talking about a warning when an
    error is raised. While there, correct a similarly stale comment in
    check_qword_reg() while there.

Diff:
---
 gas/config/tc-i386.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 6dcdccbccd6..8d11955a88b 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -8112,8 +8112,10 @@ check_long_reg (void)
 		i.suffix);
 	return 0;
       }
-    /* Error if the e prefix on a general reg is missing.  */
-    else if (i.types[op].bitfield.word
+    /* Error if the e prefix on a general reg is missing, or if the r
+       prefix on a general reg is present.  */
+    else if ((i.types[op].bitfield.word
+	      || i.types[op].bitfield.qword)
 	     && (i.tm.operand_types[op].bitfield.class == Reg
 		 || i.tm.operand_types[op].bitfield.instance == Accum)
 	     && i.tm.operand_types[op].bitfield.dword)
@@ -8123,16 +8125,6 @@ check_long_reg (void)
 		i.suffix);
 	return 0;
       }
-    /* Warn if the r prefix on a general reg is present.  */
-    else if (i.types[op].bitfield.qword
-	     && (i.tm.operand_types[op].bitfield.class == Reg
-		 || i.tm.operand_types[op].bitfield.instance == Accum)
-	     && i.tm.operand_types[op].bitfield.dword)
-      {
-	as_bad (_("incorrect register `%s%s' used with `%c' suffix"),
-		register_prefix, i.op[op].regs->reg_name, i.suffix);
-	return 0;
-      }
   return 1;
 }
 
@@ -8161,7 +8153,7 @@ check_qword_reg (void)
 		i.suffix);
 	return 0;
       }
-    /* Warn if the r prefix on a general reg is missing.  */
+    /* Error if the r prefix on a general reg is missing.  */
     else if ((i.types[op].bitfield.word
 	      || i.types[op].bitfield.dword)
 	     && (i.tm.operand_types[op].bitfield.class == Reg

                 reply	other threads:[~2023-11-17 10:21 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=20231117102131.372C53858C41@sourceware.org \
    --to=jbeulich@sourceware.org \
    --cc=bfd-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).