x86: fold redundant expressions in process_suffix()

Message ID 5A9FF18D02000078001AF62C@prv-mh.provo.novell.com
State New
Headers show
Series
  • x86: fold redundant expressions in process_suffix()
Related show

Commit Message

Jan Beulich March 7, 2018, 1:05 p.m.
There's no point repeatedly evaluating i.types[op].bitfield.reg.

gas/
2018-03-07  Jan Beulich  <jbeulich@suse.com>

	* config/tc-i386.c (process_suffix): Do common part of register
	checks first.

Comments

H.J. Lu March 7, 2018, 1:42 p.m. | #1
On Wed, Mar 7, 2018 at 5:05 AM, Jan Beulich <JBeulich@suse.com> wrote:
> There's no point repeatedly evaluating i.types[op].bitfield.reg.

>

> gas/

> 2018-03-07  Jan Beulich  <jbeulich@suse.com>

>

>         * config/tc-i386.c (process_suffix): Do common part of register

>         checks first.

>


OK.

Thanks.

-- 
H.J.

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -5746,26 +5746,19 @@  process_suffix (void)
 		if (!i.tm.operand_types[op].bitfield.inoutportreg
 		    && !i.tm.operand_types[op].bitfield.shiftcount)
 		  {
-		    if (i.types[op].bitfield.reg && i.types[op].bitfield.byte)
-		      {
-			i.suffix = BYTE_MNEM_SUFFIX;
-			break;
-		      }
-		    if (i.types[op].bitfield.reg && i.types[op].bitfield.word)
-		      {
-			i.suffix = WORD_MNEM_SUFFIX;
-			break;
-		      }
-		    if (i.types[op].bitfield.reg && i.types[op].bitfield.dword)
-		      {
-			i.suffix = LONG_MNEM_SUFFIX;
-			break;
-		      }
-		    if (i.types[op].bitfield.reg && i.types[op].bitfield.qword)
-		      {
-			i.suffix = QWORD_MNEM_SUFFIX;
-			break;
-		      }
+		    if (!i.types[op].bitfield.reg)
+		      continue;
+		    if (i.types[op].bitfield.byte)
+		      i.suffix = BYTE_MNEM_SUFFIX;
+		    else if (i.types[op].bitfield.word)
+		      i.suffix = WORD_MNEM_SUFFIX;
+		    else if (i.types[op].bitfield.dword)
+		      i.suffix = LONG_MNEM_SUFFIX;
+		    else if (i.types[op].bitfield.qword)
+		      i.suffix = QWORD_MNEM_SUFFIX;
+		    else
+		      continue;
+		    break;
 		  }
 	    }
 	}