[3/6] x86: record further wrong uses of EVEX.b

Message ID cb538e5b-ed5e-5457-a060-42b767f767e1@suse.com
State New
Headers show
Series
  • x86: AVX512* / EVEX decoding adjustments
Related show

Commit Message

H.J. Lu via Binutils Jan. 5, 2022, 11:34 a.m.
For one EVEX.W set does not imply EVEX.b is uniformly valid. Reject it
for modes which occur for insns allowing for EVEX.W to be set (noticed
with VMOV{H,L}PD and VMOVDDUP, and only in AT&T mode, but not checked
whether further insns would also have been impacted; I expect e.g.
VCMPSD would have had the same issue). And then the present concept of
broadcast makes no sense at all when the memory operand of an insn is
the destination.

Patch

--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -11877,6 +11877,11 @@  OP_E_memory (int bytemode, int sizeflag)
   if (vex.b)
     {
       evex_used |= EVEX_b_used;
+
+      /* Broadcast can only ever be valid for memory sources.  */
+      if (obufp == op_out[0])
+	vex.no_broadcast = 1;
+
       if (!vex.no_broadcast)
 	{
 	  if (bytemode == xh_mode)
@@ -11901,6 +11906,9 @@  OP_E_memory (int bytemode, int sizeflag)
 		    }
 		}
 	    }
+	  else if (bytemode == q_mode
+		   || bytemode == ymmq_mode)
+	    vex.no_broadcast = 1;
 	  else if (vex.w
 		   || bytemode == evex_half_bcst_xmmqdh_mode
 		   || bytemode == evex_half_bcst_xmmq_mode)