x86: decouple broadcast type and bytes fields
authorJan Beulich <jbeulich@suse.com>
Fri, 10 Mar 2023 10:07:11 +0000 (11:07 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 10 Mar 2023 10:07:11 +0000 (11:07 +0100)
Keep both representing exclusively what was parsed from input, to avoid
the need for (potentially bogus) calculations when processing .insn.

gas/config/tc-i386.c

index 571fc3aacaf99465924c420d82dc861fd20559f8..835fd145c87619328fb64b28b21900dabb51e472 100644 (file)
@@ -3743,8 +3743,7 @@ get_broadcast_bytes (const insn_template *t, bool diag)
   const i386_operand_type *types;
 
   if (i.broadcast.type)
-    return i.broadcast.bytes = ((1 << (t->opcode_modifier.broadcast - 1))
-                               * i.broadcast.type);
+    return (1 << (t->opcode_modifier.broadcast - 1)) * i.broadcast.type;
 
   gas_assert (intel_syntax);
 
@@ -3928,7 +3927,8 @@ build_evex_prefix (void)
                    i.tm.opcode_modifier.evex = EVEX128;
                    break;
                  }
-               else if (i.broadcast.bytes && op == i.broadcast.operand)
+               else if ((i.broadcast.type || i.broadcast.bytes)
+                        && op == i.broadcast.operand)
                  {
                    switch (get_broadcast_bytes (&i.tm, true))
                      {
@@ -3972,7 +3972,7 @@ build_evex_prefix (void)
        }
       i.vex.bytes[3] |= vec_length;
       /* Encode the broadcast bit.  */
-      if (i.broadcast.bytes)
+      if (i.broadcast.type || i.broadcast.bytes)
        i.vex.bytes[3] |= 0x10;
     }
   else if (i.rounding.type != saeonly)
@@ -4473,6 +4473,7 @@ optimize_encoding (void)
           && !i.types[0].bitfield.zmmword
           && !i.types[1].bitfield.zmmword
           && !i.mask.reg
+          && !i.broadcast.type
           && !i.broadcast.bytes
           && is_evex_encoding (&i.tm)
           && ((i.tm.base_opcode & ~Opcode_SIMD_IntD) == 0x6f
@@ -6559,7 +6560,7 @@ check_VecOperands (const insn_template *t)
   if (t->opcode_modifier.disp8memshift
       && i.disp_encoding <= disp_encoding_8bit)
     {
-      if (i.broadcast.bytes)
+      if (i.broadcast.type || i.broadcast.bytes)
        i.memshift = t->opcode_modifier.broadcast - 1;
       else if (t->opcode_modifier.disp8memshift != DISP8_SHIFT_VL)
        i.memshift = t->opcode_modifier.disp8memshift;