diff options
author | Cui,Lili <lili.cui@intel.com> | 2021-09-28 11:13:33 +0800 |
---|---|---|
committer | Cui,Lili <lili.cui@intel.com> | 2021-09-28 11:13:50 +0800 |
commit | 2c02075a8ec5223bc4cbcc9561eb91e28d46a9e5 (patch) | |
tree | e256cbf3e6f20078a9ed58e2bac723e52b926382 /opcodes | |
parent | 901b98215e767bbffb1bfa869e02d7dc5ea786ec (diff) | |
download | gdb-2c02075a8ec5223bc4cbcc9561eb91e28d46a9e5.zip gdb-2c02075a8ec5223bc4cbcc9561eb91e28d46a9e5.tar.gz gdb-2c02075a8ec5223bc4cbcc9561eb91e28d46a9e5.tar.bz2 |
x86: Print {bad} on invalid broadcast in OP_E_memory
Don't print broadcast for scalar_mode, and print {bad} for invalid broadcast.
gas/
PR binutils/28381
* testsuite/gas/i386/bad-bcast.s: Add a new testcase.
* testsuite/gas/i386/bad-bcast.d: Likewise.
* testsuite/gas/i386/bad-bcast-intel.d: New.
opcodes/
PR binutils/28381
* i386-dis.c (static struct): Add no_broadcast.
(OP_E_memory): Mark invalid broadcast with no_broadcast=1 and Print "{bad}"for it.
(intel_operand_size): mark invalid broadcast with no_broadcast=1.
(OP_XMM): Mark scalar_mode with no_broadcast=1.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/i386-dis.c | 155 |
1 files changed, 81 insertions, 74 deletions
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index aa29223..926f776 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -2422,6 +2422,7 @@ static struct int zeroing; int ll; int b; + int no_broadcast; } vex; static unsigned char need_vex; @@ -11059,23 +11060,25 @@ intel_operand_size (int bytemode, int sizeflag) { if (vex.b) { - switch (bytemode) - { - case x_mode: - case evex_half_bcst_xmmq_mode: - if (vex.w) - oappend ("QWORD PTR "); - else - oappend ("DWORD PTR "); - break; - case xh_mode: - case evex_half_bcst_xmmqh_mode: - case evex_half_bcst_xmmqdh_mode: - oappend ("WORD PTR "); - break; - default: - abort (); - } + if (!vex.no_broadcast) + switch (bytemode) + { + case x_mode: + case evex_half_bcst_xmmq_mode: + if (vex.w) + oappend ("QWORD PTR "); + else + oappend ("DWORD PTR "); + break; + case xh_mode: + case evex_half_bcst_xmmqh_mode: + case evex_half_bcst_xmmqdh_mode: + oappend ("WORD PTR "); + break; + default: + vex.no_broadcast = 1; + break; + } return; } switch (bytemode) @@ -11908,69 +11911,71 @@ OP_E_memory (int bytemode, int sizeflag) if (vex.b) { evex_used |= EVEX_b_used; - if (bytemode == xh_mode) - { - if (vex.w) - { - oappend ("{bad}"); - } - else - { - switch (vex.length) - { - case 128: - oappend ("{1to8}"); - break; - case 256: - oappend ("{1to16}"); - break; - case 512: - oappend ("{1to32}"); - break; - default: - abort (); - } - } - } - else if (vex.w - || bytemode == evex_half_bcst_xmmqdh_mode - || bytemode == evex_half_bcst_xmmq_mode) + if (!vex.no_broadcast) { - switch (vex.length) + if (bytemode == xh_mode) { - case 128: - oappend ("{1to2}"); - break; - case 256: - oappend ("{1to4}"); - break; - case 512: - oappend ("{1to8}"); - break; - default: - abort (); + if (vex.w) + oappend ("{bad}"); + else + { + switch (vex.length) + { + case 128: + oappend ("{1to8}"); + break; + case 256: + oappend ("{1to16}"); + break; + case 512: + oappend ("{1to32}"); + break; + default: + abort (); + } + } } - } - else if (bytemode == x_mode - || bytemode == evex_half_bcst_xmmqh_mode) - { - switch (vex.length) + else if (vex.w + || bytemode == evex_half_bcst_xmmqdh_mode + || bytemode == evex_half_bcst_xmmq_mode) { - case 128: - oappend ("{1to4}"); - break; - case 256: - oappend ("{1to8}"); - break; - case 512: - oappend ("{1to16}"); - break; - default: - abort (); + switch (vex.length) + { + case 128: + oappend ("{1to2}"); + break; + case 256: + oappend ("{1to4}"); + break; + case 512: + oappend ("{1to8}"); + break; + default: + abort (); + } + } + else if (bytemode == x_mode + || bytemode == evex_half_bcst_xmmqh_mode) + { + switch (vex.length) + { + case 128: + oappend ("{1to4}"); + break; + case 256: + oappend ("{1to8}"); + break; + case 512: + oappend ("{1to16}"); + break; + default: + abort (); + } } + else + vex.no_broadcast = 1; } - else - /* If operand doesn't allow broadcast, vex.b should be 0. */ + if (vex.no_broadcast) oappend ("{bad}"); } } @@ -12685,6 +12690,8 @@ OP_XMM (int bytemode, int sizeflag ATTRIBUTE_UNUSED) if (bytemode == tmm_mode) modrm.reg = reg; + else if (bytemode == scalar_mode) + vex.no_broadcast = 1; print_vector_reg (reg, bytemode); } |