diff options
author | Jan Beulich <jbeulich@suse.com> | 2021-03-10 08:19:11 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2021-03-10 08:19:11 +0100 |
commit | 85ba7507f695f914d0ad22b6d1c60bc3571f5345 (patch) | |
tree | 9de6b0b4de79c378ee0d1dafd1870532d806e9db /opcodes | |
parent | 066f82b96a4902b9f4f76dfc8d24f8d73ceeef0f (diff) | |
download | fsf-binutils-gdb-85ba7507f695f914d0ad22b6d1c60bc3571f5345.zip fsf-binutils-gdb-85ba7507f695f914d0ad22b6d1c60bc3571f5345.tar.gz fsf-binutils-gdb-85ba7507f695f914d0ad22b6d1c60bc3571f5345.tar.bz2 |
x86: reuse further VEX entries for EVEX
When the VEX.L=1 decode matches that of both EVEX.L'L=1 and EVEX.L'L=2
(typically when all three are invalid) the (smaller) VEX table entry can
be reused by EVEX, instead of duplicating data. (Note that XM and XMM as
well as EXxmm_md and EXd are equivalent at least for the purposes here.)
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 19 | ||||
-rw-r--r-- | opcodes/i386-dis-evex-len.h | 65 | ||||
-rw-r--r-- | opcodes/i386-dis-evex-prefix.h | 4 | ||||
-rw-r--r-- | opcodes/i386-dis-evex-w.h | 8 | ||||
-rw-r--r-- | opcodes/i386-dis-evex.h | 20 | ||||
-rw-r--r-- | opcodes/i386-dis.c | 28 |
6 files changed, 46 insertions, 98 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index c40ca0f..0b1992a 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,24 @@ 2021-03-10 Jan Beulich <jbeulich@suse.com> + * opcodes/i386-dis.c (EVEX_LEN_0F6E, EVEX_LEN_0F7E_P_1, + EVEX_LEN_0F7E_P_2, EVEX_LEN_0FC4, EVEX_LEN_0FC5, EVEX_LEN_0FD6, + EVEX_LEN_0F3816, EVEX_LEN_0F3A14, EVEX_LEN_0F3A15, + EVEX_LEN_0F3A16, EVEX_LEN_0F3A17, EVEX_LEN_0F3A20, + EVEX_LEN_0F3A21_W_0, EVEX_LEN_0F3A22, EVEX_W_0FD6_L_0): Delete. + (EVEX_LEN_0F3816, EVEX_W_0FD6): New. + (get_valid_dis386): Also handle 512-bit vector length when + vectoring into vex_len_table[]. + * i386-dis-evex.h (evex_table): Adjust opcode 0F6E, 0FC4, 0FC5, + 0FD6, 0F3A14, 0F3A15, 0F3A16, 0F3A17, 0F3A20, and 0F3A22 + entries. + * i386-dis-evex-len.h: Delete opcode 0F6E, 0FC4, 0FC5, 0FD6, + 0F3A14, 0F3A15, 0F3A16, 0F3A17, 0F3A20, and 0F3A22 entries. + * i386-dis-evex-prefix.h: Adjust 0F7E entry. + * i386-dis-evex-w.h: Adjust 0F7E, 0F7F, 0FD6, and 0F3A21 + entries. + +2021-03-10 Jan Beulich <jbeulich@suse.com> + * opcodes/i386-dis.c (EVEX_LEN_0F3A00_W_1, EVEX_LEN_0F3A01_W_1): Rename to EVEX_LEN_0F3A00 and EVEX_LEN_0F3A01 respectively. EVEX_W_0F3A00, EVEX_W_0F3A01): Delete. diff --git a/opcodes/i386-dis-evex-len.h b/opcodes/i386-dis-evex-len.h index 01a8ee5..46f6eeb 100644 --- a/opcodes/i386-dis-evex-len.h +++ b/opcodes/i386-dis-evex-len.h @@ -1,34 +1,4 @@ static const struct dis386 evex_len_table[][3] = { - /* EVEX_LEN_0F6E */ - { - { "vmovK", { XMScalar, Edq }, PREFIX_DATA }, - }, - - /* EVEX_LEN_0F7E_P_1 */ - { - { VEX_W_TABLE (EVEX_W_0F7E_P_1) }, - }, - - /* EVEX_LEN_0F7E_P_2 */ - { - { "vmovK", { Edq, XMScalar }, 0 }, - }, - - /* EVEX_LEN_0FC4 */ - { - { "vpinsrw", { XM, Vex, Edqw, Ib }, PREFIX_DATA }, - }, - - /* EVEX_LEN_0FC5 */ - { - { "vpextrw", { Gdq, XS, Ib }, PREFIX_DATA }, - }, - - /* EVEX_LEN_0FD6 */ - { - { VEX_W_TABLE (EVEX_W_0FD6_L_0) }, - }, - /* EVEX_LEN_0F3816 */ { { Bad_Opcode }, @@ -106,26 +76,6 @@ static const struct dis386 evex_len_table[][3] = { { VEX_W_TABLE (VEX_W_0F3A01_L_1) }, }, - /* EVEX_LEN_0F3A14 */ - { - { "vpextrb", { Edqb, XM, Ib }, PREFIX_DATA }, - }, - - /* EVEX_LEN_0F3A15 */ - { - { "vpextrw", { Edqw, XM, Ib }, PREFIX_DATA }, - }, - - /* EVEX_LEN_0F3A16 */ - { - { "vpextrK", { Edq, XM, Ib }, PREFIX_DATA }, - }, - - /* EVEX_LEN_0F3A17 */ - { - { "vextractps", { Edqd, XMM, Ib }, PREFIX_DATA }, - }, - /* EVEX_LEN_0F3A18 */ { { Bad_Opcode }, @@ -154,21 +104,6 @@ static const struct dis386 evex_len_table[][3] = { { VEX_W_TABLE (EVEX_W_0F3A1B_L_2) }, }, - /* EVEX_LEN_0F3A20 */ - { - { "vpinsrb", { XM, Vex, Edqb, Ib }, PREFIX_DATA }, - }, - - /* EVEX_LEN_0F3A21_W_0 */ - { - { "vinsertps", { XMM, Vex, EXxmm_md, Ib }, PREFIX_DATA }, - }, - - /* EVEX_LEN_0F3A22 */ - { - { "vpinsrK", { XM, Vex, Edq, Ib }, PREFIX_DATA }, - }, - /* EVEX_LEN_0F3A23 */ { { Bad_Opcode }, diff --git a/opcodes/i386-dis-evex-prefix.h b/opcodes/i386-dis-evex-prefix.h index fa54400..50a11f4 100644 --- a/opcodes/i386-dis-evex-prefix.h +++ b/opcodes/i386-dis-evex-prefix.h @@ -139,8 +139,8 @@ /* PREFIX_EVEX_0F7E */ { { Bad_Opcode }, - { EVEX_LEN_TABLE (EVEX_LEN_0F7E_P_1) }, - { EVEX_LEN_TABLE (EVEX_LEN_0F7E_P_2) }, + { VEX_W_TABLE (EVEX_W_0F7E_P_1) }, + { VEX_LEN_TABLE (VEX_LEN_0F7E_P_2) }, }, /* PREFIX_EVEX_0F7F */ { diff --git a/opcodes/i386-dis-evex-w.h b/opcodes/i386-dis-evex-w.h index 0b9c259..ff89007 100644 --- a/opcodes/i386-dis-evex-w.h +++ b/opcodes/i386-dis-evex-w.h @@ -251,7 +251,7 @@ /* EVEX_W_0F7E_P_1 */ { { Bad_Opcode }, - { "vmovq", { XMScalar, EXxmm_mq }, 0 }, + { VEX_LEN_TABLE (VEX_LEN_0F7E_P_1) }, }, /* EVEX_W_0F7F_P_1 */ { @@ -291,10 +291,10 @@ { Bad_Opcode }, { "vpaddq", { XM, Vex, EXx }, PREFIX_DATA }, }, - /* EVEX_W_0FD6_L_0 */ + /* EVEX_W_0FD6 */ { { Bad_Opcode }, - { "vmovq", { EXqS, XMScalar }, PREFIX_DATA }, + { VEX_LEN_TABLE (VEX_LEN_0FD6) }, }, /* EVEX_W_0FE6_P_1 */ { @@ -625,7 +625,7 @@ }, /* EVEX_W_0F3A21 */ { - { EVEX_LEN_TABLE (EVEX_LEN_0F3A21_W_0) }, + { VEX_LEN_TABLE (VEX_LEN_0F3A21) }, }, /* EVEX_W_0F3A23_L_n */ { diff --git a/opcodes/i386-dis-evex.h b/opcodes/i386-dis-evex.h index 27446c4..eb88e5f 100644 --- a/opcodes/i386-dis-evex.h +++ b/opcodes/i386-dis-evex.h @@ -125,7 +125,7 @@ static const struct dis386 evex_table[][256] = { { VEX_W_TABLE (EVEX_W_0F6B) }, { VEX_W_TABLE (EVEX_W_0F6C) }, { VEX_W_TABLE (EVEX_W_0F6D) }, - { EVEX_LEN_TABLE (EVEX_LEN_0F6E) }, + { VEX_LEN_TABLE (VEX_LEN_0F6E) }, { PREFIX_TABLE (PREFIX_EVEX_0F6F) }, /* 70 */ { PREFIX_TABLE (PREFIX_EVEX_0F70) }, @@ -222,8 +222,8 @@ static const struct dis386 evex_table[][256] = { { Bad_Opcode }, { PREFIX_TABLE (PREFIX_EVEX_0FC2) }, { Bad_Opcode }, - { EVEX_LEN_TABLE (EVEX_LEN_0FC4) }, - { EVEX_LEN_TABLE (EVEX_LEN_0FC5) }, + { VEX_LEN_TABLE (VEX_LEN_0FC4) }, + { VEX_LEN_TABLE (VEX_LEN_0FC5) }, { "vshufpX", { XM, Vex, EXx, Ib }, PREFIX_OPCODE }, { Bad_Opcode }, /* C8 */ @@ -242,7 +242,7 @@ static const struct dis386 evex_table[][256] = { { VEX_W_TABLE (EVEX_W_0FD3) }, { VEX_W_TABLE (EVEX_W_0FD4) }, { "vpmullw", { XM, Vex, EXx }, PREFIX_DATA }, - { EVEX_LEN_TABLE (EVEX_LEN_0FD6) }, + { VEX_W_TABLE (EVEX_W_0FD6) }, { Bad_Opcode }, /* D8 */ { "vpsubusb", { XM, Vex, EXx }, PREFIX_DATA }, @@ -606,10 +606,10 @@ static const struct dis386 evex_table[][256] = { { Bad_Opcode }, { Bad_Opcode }, { Bad_Opcode }, - { EVEX_LEN_TABLE (EVEX_LEN_0F3A14) }, - { EVEX_LEN_TABLE (EVEX_LEN_0F3A15) }, - { EVEX_LEN_TABLE (EVEX_LEN_0F3A16) }, - { EVEX_LEN_TABLE (EVEX_LEN_0F3A17) }, + { VEX_LEN_TABLE (VEX_LEN_0F3A14) }, + { VEX_LEN_TABLE (VEX_LEN_0F3A15) }, + { VEX_LEN_TABLE (VEX_LEN_0F3A16) }, + { VEX_LEN_TABLE (VEX_LEN_0F3A17) }, /* 18 */ { EVEX_LEN_TABLE (EVEX_LEN_0F3A18) }, { EVEX_LEN_TABLE (EVEX_LEN_0F3A19) }, @@ -620,9 +620,9 @@ static const struct dis386 evex_table[][256] = { { "vpcmpu%DQ", { XMask, Vex, EXx, VPCMP }, PREFIX_DATA }, { "vpcmp%DQ", { XMask, Vex, EXx, VPCMP }, PREFIX_DATA }, /* 20 */ - { EVEX_LEN_TABLE (EVEX_LEN_0F3A20) }, + { VEX_LEN_TABLE (VEX_LEN_0F3A20) }, { VEX_W_TABLE (EVEX_W_0F3A21) }, - { EVEX_LEN_TABLE (EVEX_LEN_0F3A22) }, + { VEX_LEN_TABLE (VEX_LEN_0F3A22) }, { EVEX_LEN_TABLE (EVEX_LEN_0F3A23) }, { Bad_Opcode }, { "vpternlog%DQ", { XM, Vex, EXx, Ib }, PREFIX_DATA }, diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 1a5ea0e..65e8d34 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -1334,13 +1334,7 @@ enum enum { - EVEX_LEN_0F6E = 0, - EVEX_LEN_0F7E_P_1, - EVEX_LEN_0F7E_P_2, - EVEX_LEN_0FC4, - EVEX_LEN_0FC5, - EVEX_LEN_0FD6, - EVEX_LEN_0F3816, + EVEX_LEN_0F3816 = 0, EVEX_LEN_0F3819, EVEX_LEN_0F381A_M_0, EVEX_LEN_0F381B_M_0, @@ -1351,17 +1345,10 @@ enum EVEX_LEN_0F38C7_M_0, EVEX_LEN_0F3A00, EVEX_LEN_0F3A01, - EVEX_LEN_0F3A14, - EVEX_LEN_0F3A15, - EVEX_LEN_0F3A16, - EVEX_LEN_0F3A17, EVEX_LEN_0F3A18, EVEX_LEN_0F3A19, EVEX_LEN_0F3A1A, EVEX_LEN_0F3A1B, - EVEX_LEN_0F3A20, - EVEX_LEN_0F3A21_W_0, - EVEX_LEN_0F3A22, EVEX_LEN_0F3A23, EVEX_LEN_0F3A38, EVEX_LEN_0F3A39, @@ -1549,7 +1536,7 @@ enum EVEX_W_0FD2, EVEX_W_0FD3, EVEX_W_0FD4, - EVEX_W_0FD6_L_0, + EVEX_W_0FD6, EVEX_W_0FE6_P_1, EVEX_W_0FE6_P_2, EVEX_W_0FE6_P_3, @@ -9063,9 +9050,16 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) case 128: vindex = 0; break; + case 512: + /* This allows re-using in particular table entries where only + 128-bit operand size (VEX.L=0 / EVEX.L'L=0) are valid. */ + if (vex.evex) + { case 256: - vindex = 1; - break; + vindex = 1; + break; + } + /* Fall through. */ default: abort (); break; |