x86: fold redundant expressions in process_suffix()
authorJan Beulich <jbeulich@novell.com>
Thu, 8 Mar 2018 07:50:13 +0000 (08:50 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 8 Mar 2018 07:50:13 +0000 (08:50 +0100)
There's no point repeatedly evaluating i.types[op].bitfield.reg.

gas/ChangeLog
gas/config/tc-i386.c

index d125b23a0983745bad967a64dde762c1bbf3b1b0..0f66f5efd4784aaa36d090fe045c15f8f8f0dd15 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-08  Jan Beulich  <jbeulich@suse.com>
+
+       * config/tc-i386.c (process_suffix): Do common part of register
+       checks first.
+
 2018-03-08  Jan Beulich  <jbeulich@suse.com>
 
        * config/tc-i386.c (parse_insn): Move success return up. Combine
index 67e806920efab670958fbcdf02cbf3ec36a372c3..83fd18cdbaabab93e2859ef4d73a8d5d60617223 100644 (file)
@@ -5736,26 +5736,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;
                  }
            }
        }