public inbox for binutils-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] x86: fold two switch() statements in match_template()
@ 2022-07-06 13:40 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2022-07-06 13:40 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3d0738af2a6dac3c729126f2ceb3af6529da7348

commit 3d0738af2a6dac3c729126f2ceb3af6529da7348
Author: Jan Beulich <jbeulich@suse.com>
Date:   Wed Jul 6 15:39:37 2022 +0200

    x86: fold two switch() statements in match_template()
    
    I don't see why two of them were introduced (very long ago) using
    similar fall-through logic.

Diff:
---
 gas/config/tc-i386.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 542f5cdf2d0..31b10d2e605 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -6763,22 +6763,7 @@ match_template (char mnem_suffix)
 	      switch (t->operands)
 		{
 		case 5:
-		  overlap4 = operand_type_and (i.types[4],
-					       operand_types[4]);
-		  /* Fall through.  */
-		case 4:
-		  overlap3 = operand_type_and (i.types[3],
-					       operand_types[3]);
-		  /* Fall through.  */
-		case 3:
-		  overlap2 = operand_type_and (i.types[2],
-					       operand_types[2]);
-		  break;
-		}
-
-	      switch (t->operands)
-		{
-		case 5:
+		  overlap4 = operand_type_and (i.types[4], operand_types[4]);
 		  if (!operand_type_match (overlap4, i.types[4])
 		      || !operand_type_register_match (i.types[3],
 						       operand_types[3],
@@ -6787,6 +6772,7 @@ match_template (char mnem_suffix)
 		    continue;
 		  /* Fall through.  */
 		case 4:
+		  overlap3 = operand_type_and (i.types[3], operand_types[3]);
 		  if (!operand_type_match (overlap3, i.types[3])
 		      || ((check_register & 0xa) == 0xa
 			  && !operand_type_register_match (i.types[1],
@@ -6801,6 +6787,7 @@ match_template (char mnem_suffix)
 		    continue;
 		  /* Fall through.  */
 		case 3:
+		  overlap2 = operand_type_and (i.types[2], operand_types[2]);
 		  if (!operand_type_match (overlap2, i.types[2])
 		      || ((check_register & 5) == 5
 			  && !operand_type_register_match (i.types[0],


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

only message in thread, other threads:[~2022-07-06 13:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 13:40 [binutils-gdb] x86: fold two switch() statements in match_template() 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).