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]

Re: i386 Intel synax assembler is broken.


On Tue, 15 Aug 2000, H . J . Lu wrote:

> > Wed Aug  9 16:28:21 EDT 2000	Diego Novillo <dnovillo@cygnus.com>
> > 
> > 	* tc-i386.c (md_assemble): Skip suffix check if the opcode modifier
> > 	has the IgnoreSize bit set.
> > 
> 
> This patch seems to work for me. I don't know if it is entirely correct.
> 
Yes. That's the first thing I tried and it indeed fixes the
regression. However, I do not know why the movzx and movsx
templates have inconsistent IgnoreSize settings.

In any case, this patch does essentially the same thing except
that it's not affected by relative instruction ordering in the
opcode table. I don't feel strongly one way or another, though.

Which one is preferrable?


Wed Aug 16 00:48:28 EDT 2000	Diego Novillo <dnovillo@cygnus.com>

	* tc-i386.c (md_assemble): Only ignore the suffix check if all the
	instruction templates have the IgnoreSize bit set.

Index: tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.59
diff -d -c -p -r1.59 tc-i386.c
*** tc-i386.c	2000/08/14 21:12:47	1.59
--- tc-i386.c	2000/08/16 04:48:07
*************** md_assemble (line)
*** 1508,1513 ****
--- 1508,1531 ----
  				? No_dSuf
  				: (i.suffix == LONG_DOUBLE_MNEM_SUFFIX ? No_xSuf : 0))))));
  
+     /* In intel syntax, check whether the instruction templates ignore the
+        size prefix.  */
+     if (intel_syntax && suffix_check)
+       {
+ 	for (t = current_templates->start;
+ 	     t < current_templates->end;
+ 	     t++)
+ 	  {
+ 	    if (!(t->opcode_modifier & IgnoreSize))
+ 	      break;
+ 	  }
+ 
+ 	/* If all the instruction templates ignore the size prefix, then we
+ 	   don't need to do a suffix check.  */
+ 	if (t == current_templates->end)
+ 	  suffix_check = 0;
+       }
+ 
      for (t = current_templates->start;
  	 t < current_templates->end;
  	 t++)
*************** md_assemble (line)
*** 1518,1525 ****
  
  	/* Check the suffix, except for some instructions in intel mode.  */
  	if ((t->opcode_modifier & suffix_check)
- 	    && !(intel_syntax
- 		 && (t->opcode_modifier & IgnoreSize))
  	    && !(intel_syntax
  		 && t->base_opcode == 0xd9
  		 && (t->extension_opcode == 5	/* 0xd9,5 "fldcw"  */
--- 1536,1541 ----

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