public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <alan@spri.levels.unisa.edu.au>
To: hjl@lucon.org (H.J. Lu)
Subject: A gas patch
Date: Mon, 16 Mar 1998 08:08:00 -0000	[thread overview]
Message-ID: <199803161150.WAA00761@mullet.Levels.UniSA.Edu.Au> (raw)

Here is a patch you might like to include in your next release of
binutils for linux.  I've sent it off to Ian Taylor, but he's on
vacation for another week, so it may not get into the official sources
for a while.

1998-03-15  Alan Modra  <alan@SPRI.Levels.UniSA.Edu.Au>

	* config/tc-i386.c (md_assemble):   Add no_word_prefix_needed
	variable and don't emit a data-size prefix byte for segment
	register or control/debug register moves.  Check for incorrect
	suffix on these instructions too.

diff -ur gas-980310/gas/config/tc-i386.c gas/gas/config/tc-i386.c
--- gas-980310/gas/config/tc-i386.c	Tue Mar  3 19:40:21 1998
+++ gas/gas/config/tc-i386.c	Sun Mar 15 15:47:46 1998
@@ -1093,6 +1093,7 @@
     expressionS *exp;
     unsigned int overlap2;
     unsigned int found_reverse_match;
+    int no_word_prefix_needed = 0;
 
     overlap0 = overlap1 = overlap2 = found_reverse_match = 0;
     for (t = current_templates->start;
@@ -1276,6 +1277,22 @@
     if (overlap0 & Imm1)
       i.imm_operands = 0;	/* kludge for shift insns */
 
+    if (t->operand_types[0] & (SReg3|SReg2|Control|Debug|Test))
+      {
+	no_word_prefix_needed = 1;
+	if (i.suffix)
+	  {
+	    if ((i.suffix != WORD_OPCODE_SUFFIX
+		 && (t->operand_types[0] & (SReg3|SReg2)))
+		|| (i.suffix != DWORD_OPCODE_SUFFIX
+		    && (t->operand_types[0] & (Control|Debug|Test))))
+	      {
+		as_bad ("register does not match opcode suffix");
+		return;
+	      }
+	  }
+      }
+
     if (found_reverse_match)
       {
 	unsigned int save;
@@ -1301,7 +1318,8 @@
 	  t->base_opcode |= W;
 	/* Now select between word & dword operations via the
 				   operand size prefix. */
-	if ((i.suffix == WORD_OPCODE_SUFFIX) ^ flag_16bit_code)
+	if ((i.suffix == WORD_OPCODE_SUFFIX) != flag_16bit_code
+	    && !no_word_prefix_needed)
 	  {
 	    if (i.prefixes == MAX_PREFIXES)
 	      {


-- 
H.J. Lu (hjl@gnu.org)

                 reply	other threads:[~1998-03-16  8:08 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=199803161150.WAA00761@mullet.Levels.UniSA.Edu.Au \
    --to=alan@spri.levels.unisa.edu.au \
    --cc=hjl@lucon.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).