x86: tighten condition for emitting LOCK on control register accesses
authorJan Beulich <jbeulich@novell.com>
Fri, 1 Jun 2018 06:38:36 +0000 (08:38 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 1 Jun 2018 06:38:36 +0000 (08:38 +0200)
The control register is never expressed by REX.B; this bit only affects
the involved GPR. Also only one of the operands can have its "control"
flag set, so only check the correct operand.

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

index 14f03bc8107ce8c00cdbe8745106d0e2d71e999a..199a48d8303e08807fd9bb02b726c8be2ac05f1d 100644 (file)
@@ -1,3 +1,9 @@
+2018-06-01  Jan Beulich  <jbeulich@suse.com>
+
+       * config/tc-i386.c (build_modrm_byte): Drop REX_B from condition
+       checking for the need of emitting LOCK. Check "control" bit just
+       once.
+
 2018-06-01  Jan Beulich  <jbeulich@suse.com>
 
        *  testsuite/gas/i386/invpcid.s,
index 36e42eb394c0bac358fa2fe8d7b326feebff4ea5..3d04a8361d9c33e49e03c690e585c2045b471ebf 100644 (file)
@@ -6894,12 +6894,11 @@ build_modrm_byte (void)
          if ((i.op[source].regs->reg_flags & RegVRex) != 0)
            i.vrex |= REX_R;
        }
-      if (flag_code != CODE_64BIT && (i.rex & (REX_R | REX_B)))
+      if (flag_code != CODE_64BIT && (i.rex & REX_R))
        {
-         if (!i.types[0].bitfield.control
-             && !i.types[1].bitfield.control)
+         if (!i.types[i.tm.operand_types[0].bitfield.regmem].bitfield.control)
            abort ();
-         i.rex &= ~(REX_R | REX_B);
+         i.rex &= ~REX_R;
          add_prefix (LOCK_PREFIX_OPCODE);
        }
     }
This page took 0.044489 seconds and 4 git commands to generate.