This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Fix PR 2512, movsd in intel mode


movsd is a valid mnemonic for two wildly different instructions in Intel
mode, a string move, and a XMM reg load or store.  The templates have
quite different flags so testing just the first template leads to a
wrong conclusion.  Swapping the order of the templates fixes this place,
but causes a problem elsewhere with number of memory operands checks.

	PR 2512.
	* config/tc-i386.c (match_template): Move 64-bit operand tests
	inside loop.

Index: gas/config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.208
diff -u -p -r1.208 tc-i386.c
--- gas/config/tc-i386.c	23 Mar 2006 08:23:09 -0000	1.208
+++ gas/config/tc-i386.c	7 Apr 2006 06:05:42 -0000
@@ -2263,19 +2263,7 @@ match_template ()
 			      : (i.suffix == LONG_DOUBLE_MNEM_SUFFIX
 				 ? No_xSuf : 0))))));
 
-  t = current_templates->start;
-  if (i.suffix == QWORD_MNEM_SUFFIX
-      && flag_code != CODE_64BIT
-      && (intel_syntax
-	  ? !(t->opcode_modifier & IgnoreSize)
-	    && !intel_float_operand (t->name)
-	  : intel_float_operand (t->name) != 2)
-      && (!(t->operand_types[0] & (RegMMX | RegXMM))
-	  || !(t->operand_types[t->operands > 1] & (RegMMX | RegXMM)))
-      && (t->base_opcode != 0x0fc7
-	  || t->extension_opcode != 1 /* cmpxchg8b */))
-    t = current_templates->end;
-  for (; t < current_templates->end; t++)
+  for (t = current_templates->start; t < current_templates->end; t++)
     {
       /* Must have right number of operands.  */
       if (i.operands != t->operands)
@@ -2287,6 +2275,19 @@ match_template ()
 	       && (t->opcode_modifier & IgnoreSize)))
 	continue;
 
+      /* In general, don't allow 64-bit operands in 32-bit mode.  */
+      if (i.suffix == QWORD_MNEM_SUFFIX
+	  && flag_code != CODE_64BIT
+	  && (intel_syntax
+	      ? (!(t->opcode_modifier & IgnoreSize)
+		 && !intel_float_operand (t->name))
+	      : intel_float_operand (t->name) != 2)
+	  && (!(t->operand_types[0] & (RegMMX | RegXMM))
+	      || !(t->operand_types[t->operands > 1] & (RegMMX | RegXMM)))
+	  && (t->base_opcode != 0x0fc7
+	      || t->extension_opcode != 1 /* cmpxchg8b */))
+	continue;
+
       /* Do not verify operands when there are none.  */
       else if (!t->operands)
 	{

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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