aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2020-07-14 10:29:55 +0200
committerJan Beulich <jbeulich@suse.com>2020-07-14 10:29:55 +0200
commit059edf8b977782457c358b408a71caba4b0311e4 (patch)
tree5456d047310ddc34fcb3272d73dcb8af977b91cd /opcodes
parent4726e9a47938baa67a8e41c704bfdde1f123c01e (diff)
downloadgdb-059edf8b977782457c358b408a71caba4b0311e4.zip
gdb-059edf8b977782457c358b408a71caba4b0311e4.tar.gz
gdb-059edf8b977782457c358b408a71caba4b0311e4.tar.bz2
x86: merge/move logic determining the EVEX disp8 shift
Fold redundant case blocks and move the extra adjustments logic into the single case block that actually needs it - there's no need to go through the extra logic for all the other cases. Also utilize there that vex.b cannot be set at this point, due to earlier logic. Reduce the comment there, which was partly stale anyway.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog7
-rw-r--r--opcodes/i386-dis.c45
2 files changed, 23 insertions, 29 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index f0b4d8c..88ea70d 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,12 @@
2020-07-14 Jan Beulich <jbeulich@suse.com>
+ * i386-dis.c (OP_E_memory): Move xmm_mw_mode, xmm_mb_mode,
+ dqd_mode, xmm_md_mode, d_mode, d_swap_mode, and
+ d_scalar_swap_mode case handling. Move shift adjsutment into
+ the case its applicable to.
+
+2020-07-14 Jan Beulich <jbeulich@suse.com>
+
* i386-dis.c (EVEX_W_0F3862_P_2, EVEX_W_0F3863_P_2): Delete.
(EXbScalar, EXwScalar): Fold to ...
(EXbwUnit): ... this.
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index b68e737..708d820 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -14517,15 +14517,22 @@ OP_E_memory (int bytemode, int sizeflag)
{
case dqw_mode:
case dw_mode:
+ case xmm_mw_mode:
shift = 1;
break;
case dqb_mode:
case db_mode:
+ case xmm_mb_mode:
shift = 0;
break;
case dq_mode:
if (address_mode != mode_64bit)
{
+ case dqd_mode:
+ case xmm_md_mode:
+ case d_mode:
+ case d_swap_mode:
+ case d_scalar_swap_mode:
shift = 2;
break;
}
@@ -14566,6 +14573,15 @@ OP_E_memory (int bytemode, int sizeflag)
default:
abort ();
}
+ /* Make necessary corrections to shift for modes that need it. */
+ if (bytemode == xmmq_mode
+ || bytemode == evex_half_bcst_xmmq_mode
+ || (bytemode == ymmq_mode && vex.length == 128))
+ shift -= 1;
+ else if (bytemode == xmmqd_mode)
+ shift -= 2;
+ else if (bytemode == xmmdw_mode)
+ shift -= 3;
break;
case ymm_mode:
shift = 5;
@@ -14579,41 +14595,12 @@ OP_E_memory (int bytemode, int sizeflag)
case q_scalar_swap_mode:
shift = 3;
break;
- case dqd_mode:
- case xmm_md_mode:
- case d_mode:
- case d_swap_mode:
- case d_scalar_swap_mode:
- shift = 2;
- break;
case bw_unit_mode:
shift = vex.w ? 1 : 0;
break;
- case xmm_mw_mode:
- shift = 1;
- break;
- case xmm_mb_mode:
- shift = 0;
- break;
default:
abort ();
}
- /* Make necessary corrections to shift for modes that need it.
- For these modes we currently have shift 4, 5 or 6 depending on
- vex.length (it corresponds to xmmword, ymmword or zmmword
- operand). We might want to make it 3, 4 or 5 (e.g. for
- xmmq_mode). In case of broadcast enabled the corrections
- aren't needed, as element size is always 32 or 64 bits. */
- if (!vex.b
- && (bytemode == xmmq_mode
- || bytemode == evex_half_bcst_xmmq_mode))
- shift -= 1;
- else if (bytemode == xmmqd_mode)
- shift -= 2;
- else if (bytemode == xmmdw_mode)
- shift -= 3;
- else if (bytemode == ymmq_mode && vex.length == 128)
- shift -= 1;
}
else
shift = 0;