public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] x86: rep prefix handling adjustment
@ 2005-05-06 12:04 Jan Beulich
  2005-05-06 14:49 ` H. J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2005-05-06 12:04 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1950 bytes --]

Until now, gas looked just at the first instruction of a series of
identically named ones to determine whether it is a string instruction and
thus accepts the use of a rep prefix. Since that required particular
ordering in the opcode table (without that being said to be so), this
patch adjusts code to have more freedom in the table ordering. At once, it
restricts the set of instructions to choose from to just the string ones
when a rep prefix was specified. As a nice side effect, some diagnostics
get replaced by more meaningful ones.

Built and tested on i686-pc-linux-gnu and x86_64-unknown-linux-gnu.

Jan

gas/
2005-05-06  Jan Beulich  <jbeulich@novell.com>

	* config/tc-i386.c (parse_insn): Consider all matching instructions
	when checking for string instruction after string-only prefix.

--- /home/jbeulich/src/binutils/mainline/2005-05-06/gas/config/tc-i386.c	2005-05-06 08:24:28.000000000 +0200
+++ 2005-05-06/gas/config/tc-i386.c	2005-05-06 11:45:55.861726528 +0200
@@ -1765,12 +1766,24 @@ parse_insn (line, mnemonic)
     }
 
   /* Check for rep/repne without a string instruction.  */
-  if (expecting_string_instruction
-      && !(current_templates->start->opcode_modifier & IsString))
+  if (expecting_string_instruction)
     {
-      as_bad (_("expecting string instruction after `%s'"),
-	      expecting_string_instruction);
-      return NULL;
+      static templates override;
+
+      for (t = current_templates->start; t < current_templates->end; ++t)
+	if (t->opcode_modifier & IsString)
+	  break;
+      if (t >= current_templates->end)
+	{
+	  as_bad (_("expecting string instruction after `%s'"),
+	        expecting_string_instruction);
+	  return NULL;
+	}
+      for (override.start = t; t < current_templates->end; ++t)
+	if (!(t->opcode_modifier & IsString))
+	  break;
+      override.end = t;
+      current_templates = &override;
     }
 
   return l;



[-- Attachment #2: binutils-mainline-x86-string-prefix.patch --]
[-- Type: text/plain, Size: 1895 bytes --]

Until now, gas looked just at the first instruction of a series of
identically named ones to determine whether it is a string instruction and
thus accepts the use of a rep prefix. Since that required particular
ordering in the opcode table (without that being said to be so), this
patch adjusts code to have more freedom in the table ordering. At once, it
restricts the set of instructions to choose from to just the string ones
when a rep prefix was specified. As a nice side effect, some diagnostics
get replaced by more meaningful ones.

Built and tested on i686-pc-linux-gnu and x86_64-unknown-linux-gnu.

Jan

gas/
2005-05-06  Jan Beulich  <jbeulich@novell.com>

	* config/tc-i386.c (parse_insn): Consider all matching instructions
	when checking for string instruction after string-only prefix.

--- /home/jbeulich/src/binutils/mainline/2005-05-06/gas/config/tc-i386.c	2005-05-06 08:24:28.000000000 +0200
+++ 2005-05-06/gas/config/tc-i386.c	2005-05-06 11:45:55.861726528 +0200
@@ -1765,12 +1766,24 @@ parse_insn (line, mnemonic)
     }
 
   /* Check for rep/repne without a string instruction.  */
-  if (expecting_string_instruction
-      && !(current_templates->start->opcode_modifier & IsString))
+  if (expecting_string_instruction)
     {
-      as_bad (_("expecting string instruction after `%s'"),
-	      expecting_string_instruction);
-      return NULL;
+      static templates override;
+
+      for (t = current_templates->start; t < current_templates->end; ++t)
+	if (t->opcode_modifier & IsString)
+	  break;
+      if (t >= current_templates->end)
+	{
+	  as_bad (_("expecting string instruction after `%s'"),
+	        expecting_string_instruction);
+	  return NULL;
+	}
+      for (override.start = t; t < current_templates->end; ++t)
+	if (!(t->opcode_modifier & IsString))
+	  break;
+      override.end = t;
+      current_templates = &override;
     }
 
   return l;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86: rep prefix handling adjustment
  2005-05-06 12:04 [PATCH] x86: rep prefix handling adjustment Jan Beulich
@ 2005-05-06 14:49 ` H. J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H. J. Lu @ 2005-05-06 14:49 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

On Fri, May 06, 2005 at 02:03:18PM +0200, Jan Beulich wrote:
> Until now, gas looked just at the first instruction of a series of
> identically named ones to determine whether it is a string instruction and
> thus accepts the use of a rep prefix. Since that required particular
> ordering in the opcode table (without that being said to be so), this
> patch adjusts code to have more freedom in the table ordering. At once, it
> restricts the set of instructions to choose from to just the string ones
> when a rep prefix was specified. As a nice side effect, some diagnostics
> get replaced by more meaningful ones.
> 

OK. Thanks.


H.J.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-06 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-06 12:04 [PATCH] x86: rep prefix handling adjustment Jan Beulich
2005-05-06 14:49 ` H. J. Lu

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).