This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

SSE/x86_64 fix


Hi
The x86_64 insist on placing the REX prefix as last.  The SSE uses
REP/REPNZ and DATA prefixes to distinguish various SSE operations and
even when they are documented as part of opcodes, they behave as prefixes
in simulator - clears out the REX prefix.

So I need to take care to place REX prefix last.

Honza
Thu Jan  4 23:09:18 MET 2001  Jan Hubicka  <jh@suse.cz.

	* tc-i386.c (md_assemble): Handle third byte of the opcode as prefix.

--- /home3/hubicka/src/gas/config/tc-i386.c	Thu Jan  4 22:25:14 2001
+++ gas/config/tc-i386.c	Wed Aug  9 05:16:22 2000
@@ -2826,6 +2828,11 @@ md_assemble (line)
 	/* Output normal instructions here.  */
 	unsigned char *q;
 
+	/* All opcodes on i386 have eighter 1 or 2 bytes.  We may use third
+	   byte for the SSE instructions to specify prefix they require.  */
+	if (i.tm.base_opcode & 0xff0000)
+	  add_prefix ((i.tm.base_opcode >> 16) & 0xff);
+
 	/* The prefix bytes.  */
 	for (q = i.prefix;
 	     q < i.prefix + sizeof (i.prefix) / sizeof (i.prefix[0]);
@@ -2845,30 +2852,13 @@ md_assemble (line)
 	    insn_size += 1;
 	    FRAG_APPEND_1_CHAR (i.tm.base_opcode);
 	  }
-	else if (fits_in_unsigned_word (i.tm.base_opcode))
+	else
 	  {
 	    insn_size += 2;
 	    p = frag_more (2);
 	    /* Put out high byte first: can't use md_number_to_chars!  */
 	    *p++ = (i.tm.base_opcode >> 8) & 0xff;
 	    *p = i.tm.base_opcode & 0xff;
-	  }
-	else
-	  {			/* Opcode is either 3 or 4 bytes.  */
-	    if (i.tm.base_opcode & 0xff000000)
-	      {
-		insn_size += 4;
-		p = frag_more (4);
-		*p++ = (i.tm.base_opcode >> 24) & 0xff;
-	      }
-	    else
-	      {
-		insn_size += 3;
-		p = frag_more (3);
-	      }
-	    *p++ = (i.tm.base_opcode >> 16) & 0xff;
-	    *p++ = (i.tm.base_opcode >> 8) & 0xff;
-	    *p = (i.tm.base_opcode) & 0xff;
 	  }
 
 	/* Now the modrm byte and sib byte (if present).  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]