public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] x86: reduce check_{byte,word,long,qword}_reg() overhead
@ 2024-05-24 10:26 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2024-05-24 10:26 UTC (permalink / raw)
  To: Binutils; +Cc: H.J. Lu

These run after template matching. Therefore it is quite pointless for
them to check all operands, when operand sizes matching across operands
is already known. Exit the loops early in such cases.

In check_byte_reg() also drop a long-stale part of a comment.

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -9834,11 +9834,13 @@ check_byte_reg (void)
       if (i.types[op].bitfield.class != Reg)
 	continue;
 
-      /* If this is an eight bit register, it's OK.  If it's the 16 or
-	 32 bit version of an eight bit register, we will just use the
-	 low portion, and that's OK too.  */
+      /* If this is an eight bit register, it's OK.  */
       if (i.types[op].bitfield.byte)
-	continue;
+	{
+	  if (i.tm.opcode_modifier.checkoperandsize)
+	    break;
+	  continue;
+	}
 
       /* I/O port address operands are OK too.  */
       if (i.tm.operand_types[op].bitfield.instance == RegD
@@ -9892,6 +9894,9 @@ check_long_reg (void)
 		i.suffix);
 	return 0;
       }
+    else if (i.tm.opcode_modifier.checkoperandsize)
+      break;
+
   return 1;
 }
 
@@ -9927,6 +9932,9 @@ check_qword_reg (void)
 		register_prefix, i.op[op].regs->reg_name, i.suffix);
 	return 0;
       }
+    else if (i.tm.opcode_modifier.checkoperandsize)
+      break;
+
   return 1;
 }
 
@@ -9962,6 +9970,9 @@ check_word_reg (void)
 		i.suffix);
 	return 0;
       }
+    else if (i.tm.opcode_modifier.checkoperandsize)
+      break;
+
   return 1;
 }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-24 10:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-24 10:26 [PATCH] x86: reduce check_{byte,word,long,qword}_reg() overhead Jan Beulich

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