[binutils-gdb] x86: decouple broadcast type and bytes fields

Jan Beulich jbeulich@sourceware.org
Fri Mar 10 10:07:38 GMT 2023


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

commit 9b345ce8949ffc997f23c998a18937b359ef50ce
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Mar 10 11:07:11 2023 +0100

    x86: decouple broadcast type and bytes fields
    
    Keep both representing exclusively what was parsed from input, to avoid
    the need for (potentially bogus) calculations when processing .insn.

Diff:
---
 gas/config/tc-i386.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 571fc3aacaf..835fd145c87 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -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;


More information about the Binutils-cvs mailing list