From fd1fd0618645c5d4ff4279433360e3a7fd779fba Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 11 Mar 2021 16:21:48 +0100 Subject: [PATCH] x86: re-order logic in OP_XMM() Instead of excluding an increasing number of modes in the initial if(), check the special modes first. --- opcodes/ChangeLog | 4 +++ opcodes/i386-dis.c | 66 ++++++++++++++++++++++------------------------ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index e31a93f7de9..60a9c687250 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2021-03-11 Jan Beulich + + * i386-dis.c (OP_XMM): Re-order checks. + 2021-03-11 Jan Beulich * i386-dis.c (putop): Drop need_vex check when also checking diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 10dbe7fe183..2985e8d4417 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -12598,13 +12598,37 @@ OP_XMM (int bytemode, int sizeflag ATTRIBUTE_UNUSED) reg += 16; } - if (need_vex - && bytemode != xmm_mode - && bytemode != xmmq_mode - && bytemode != evex_half_bcst_xmmq_mode - && bytemode != ymm_mode - && bytemode != tmm_mode - && bytemode != scalar_mode) + if (bytemode == xmmq_mode + || bytemode == evex_half_bcst_xmmq_mode) + { + switch (vex.length) + { + case 128: + case 256: + names = names_xmm; + break; + case 512: + names = names_ymm; + break; + default: + abort (); + } + } + else if (bytemode == ymm_mode) + names = names_ymm; + else if (bytemode == tmm_mode) + { + modrm.reg = reg; + if (reg >= 8) + { + oappend ("(bad)"); + return; + } + names = names_tmm; + } + else if (need_vex + && bytemode != xmm_mode + && bytemode != scalar_mode) { switch (vex.length) { @@ -12629,34 +12653,6 @@ OP_XMM (int bytemode, int sizeflag ATTRIBUTE_UNUSED) abort (); } } - else if (bytemode == xmmq_mode - || bytemode == evex_half_bcst_xmmq_mode) - { - switch (vex.length) - { - case 128: - case 256: - names = names_xmm; - break; - case 512: - names = names_ymm; - break; - default: - abort (); - } - } - else if (bytemode == tmm_mode) - { - modrm.reg = reg; - if (reg >= 8) - { - oappend ("(bad)"); - return; - } - names = names_tmm; - } - else if (bytemode == ymm_mode) - names = names_ymm; else names = names_xmm; oappend (names[reg]);