From f0a6222e30215d4b8ecb8124fe5ad4c3f321f8c4 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 19 Jun 2019 10:01:27 -0700 Subject: i386: Check vector length for EVEX broadcast instructions Since not all vector lengths are supported by EVEX broadcast instructions, decode them only with supported vector lengths. gas/ PR binutils/24700 * testsuite/gas/i386/disassem.s: Add test for vbroadcasti32x8 with invalid vector length. * testsuite/gas/i386/x86-64-disassem.s: Likewise. * testsuite/gas/i386/disassem.d: Updated. * testsuite/gas/i386/x86-64-disassem.d: Likewise. opcodes/ PR binutils/24700 * i386-dis-evex.h (evex_table): Update EVEX_W_0F3819_P_2, EVEX_W_0F381A_P_2, EVEX_W_0F381B_P_2, EVEX_W_0F385A_P_2 and EVEX_W_0F385B_P_2. (evex_len_table): Add EVEX_LEN_0F3819_P_2_W_0, EVEX_LEN_0F3819_P_2_W_1, EVEX_LEN_0F381A_P_2_W_0, EVEX_LEN_0F381A_P_2_W_1, EVEX_LEN_0F381B_P_2_W_0, EVEX_LEN_0F381B_P_2_W_1, EVEX_LEN_0F385A_P_2_W_0, EVEX_LEN_0F385A_P_2_W_1, EVEX_LEN_0F385B_P_2_W_0 and EVEX_LEN_0F385B_P_2_W_1. * i386-dis.c (EVEX_LEN_0F3819_P_2_W_0): New enum. (EVEX_LEN_0F3819_P_2_W_1): Likewise. (EVEX_LEN_0F381A_P_2_W_0): Likewise. (EVEX_LEN_0F381A_P_2_W_1): Likewise. (EVEX_LEN_0F381B_P_2_W_0): Likewise. (EVEX_LEN_0F381B_P_2_W_1): Likewise. (EVEX_LEN_0F385A_P_2_W_0): Likewise. (EVEX_LEN_0F385A_P_2_W_1): Likewise. (EVEX_LEN_0F385B_P_2_W_0): Likewise. (EVEX_LEN_0F385B_P_2_W_1): Likewise. --- opcodes/ChangeLog | 23 +++++++++++++ opcodes/i386-dis-evex.h | 90 +++++++++++++++++++++++++++++++++++++++++++------ opcodes/i386-dis.c | 10 ++++++ 3 files changed, 113 insertions(+), 10 deletions(-) (limited to 'opcodes') diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index b76a899..92a42ef 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,26 @@ +2019-06-19 H.J. Lu + + PR binutils/24700 + * i386-dis-evex.h (evex_table): Update EVEX_W_0F3819_P_2, + EVEX_W_0F381A_P_2, EVEX_W_0F381B_P_2, EVEX_W_0F385A_P_2 and + EVEX_W_0F385B_P_2. + (evex_len_table): Add EVEX_LEN_0F3819_P_2_W_0, + EVEX_LEN_0F3819_P_2_W_1, EVEX_LEN_0F381A_P_2_W_0, + EVEX_LEN_0F381A_P_2_W_1, EVEX_LEN_0F381B_P_2_W_0, + EVEX_LEN_0F381B_P_2_W_1, EVEX_LEN_0F385A_P_2_W_0, + EVEX_LEN_0F385A_P_2_W_1, EVEX_LEN_0F385B_P_2_W_0 and + EVEX_LEN_0F385B_P_2_W_1. + * i386-dis.c (EVEX_LEN_0F3819_P_2_W_0): New enum. + (EVEX_LEN_0F3819_P_2_W_1): Likewise. + (EVEX_LEN_0F381A_P_2_W_0): Likewise. + (EVEX_LEN_0F381A_P_2_W_1): Likewise. + (EVEX_LEN_0F381B_P_2_W_0): Likewise. + (EVEX_LEN_0F381B_P_2_W_1): Likewise. + (EVEX_LEN_0F385A_P_2_W_0): Likewise. + (EVEX_LEN_0F385A_P_2_W_1): Likewise. + (EVEX_LEN_0F385B_P_2_W_0): Likewise. + (EVEX_LEN_0F385B_P_2_W_1): Likewise. + 2019-06-17 H.J. Lu PR binutils/24691 diff --git a/opcodes/i386-dis-evex.h b/opcodes/i386-dis-evex.h index f34f8bc..e9a9d92 100644 --- a/opcodes/i386-dis-evex.h +++ b/opcodes/i386-dis-evex.h @@ -3568,18 +3568,18 @@ static const struct dis386 evex_table[][256] = { }, /* EVEX_W_0F3819_P_2 */ { - { "vbroadcastf32x2", { XM, EXxmm_mq }, 0 }, - { "vbroadcastsd", { XM, EXxmm_mq }, 0 }, + { EVEX_LEN_TABLE (EVEX_LEN_0F3819_P_2_W_0) }, + { EVEX_LEN_TABLE (EVEX_LEN_0F3819_P_2_W_1) }, }, /* EVEX_W_0F381A_P_2 */ { - { "vbroadcastf32x4", { XM, EXxmm }, 0 }, - { "vbroadcastf64x2", { XM, EXxmm }, 0 }, + { EVEX_LEN_TABLE (EVEX_LEN_0F381A_P_2_W_0) }, + { EVEX_LEN_TABLE (EVEX_LEN_0F381A_P_2_W_1) }, }, /* EVEX_W_0F381B_P_2 */ { - { "vbroadcastf32x8", { XM, EXxmmq }, 0 }, - { "vbroadcastf64x4", { XM, EXymm }, 0 }, + { EVEX_LEN_TABLE (EVEX_LEN_0F381B_P_2_W_0) }, + { EVEX_LEN_TABLE (EVEX_LEN_0F381B_P_2_W_1) }, }, /* EVEX_W_0F381E_P_2 */ { @@ -3739,13 +3739,13 @@ static const struct dis386 evex_table[][256] = { }, /* EVEX_W_0F385A_P_2 */ { - { "vbroadcasti32x4", { XM, EXxmm }, 0 }, - { "vbroadcasti64x2", { XM, EXxmm }, 0 }, + { EVEX_LEN_TABLE (EVEX_LEN_0F385A_P_2_W_0) }, + { EVEX_LEN_TABLE (EVEX_LEN_0F385A_P_2_W_1) }, }, /* EVEX_W_0F385B_P_2 */ { - { "vbroadcasti32x8", { XM, EXxmmq }, 0 }, - { "vbroadcasti64x4", { XM, EXymm }, 0 }, + { EVEX_LEN_TABLE (EVEX_LEN_0F385B_P_2_W_0) }, + { EVEX_LEN_TABLE (EVEX_LEN_0F385B_P_2_W_1) }, }, /* EVEX_W_0F3862_P_2 */ { @@ -4129,6 +4129,76 @@ static const struct dis386 evex_table[][256] = { { VEX_W_TABLE (EVEX_W_0FD6_P_2) }, }, + /* EVEX_LEN_0F3819_P_2_W_0 */ + { + { Bad_Opcode }, + { "vbroadcastf32x2", { XM, EXxmm_mq }, 0 }, + { "vbroadcastf32x2", { XM, EXxmm_mq }, 0 }, + }, + + /* EVEX_LEN_0F3819_P_2_W_1 */ + { + { Bad_Opcode }, + { "vbroadcastsd", { XM, EXxmm_mq }, 0 }, + { "vbroadcastsd", { XM, EXxmm_mq }, 0 }, + }, + + /* EVEX_LEN_0F381A_P_2_W_0 */ + { + { Bad_Opcode }, + { "vbroadcastf32x4", { XM, EXxmm }, 0 }, + { "vbroadcastf32x4", { XM, EXxmm }, 0 }, + }, + + /* EVEX_LEN_0F381A_P_2_W_1 */ + { + { Bad_Opcode }, + { "vbroadcastf64x2", { XM, EXxmm }, 0 }, + { "vbroadcastf64x2", { XM, EXxmm }, 0 }, + }, + + /* EVEX_LEN_0F381B_P_2_W_0 */ + { + { Bad_Opcode }, + { Bad_Opcode }, + { "vbroadcastf32x8", { XM, EXxmmq }, 0 }, + }, + + /* EVEX_LEN_0F381B_P_2_W_1 */ + { + { Bad_Opcode }, + { Bad_Opcode }, + { "vbroadcastf64x4", { XM, EXymm }, 0 }, + }, + + /* EVEX_LEN_0F385A_P_2_W_0 */ + { + { Bad_Opcode }, + { "vbroadcasti32x4", { XM, EXxmm }, 0 }, + { "vbroadcasti32x4", { XM, EXxmm }, 0 }, + }, + + /* EVEX_LEN_0F385A_P_2_W_1 */ + { + { Bad_Opcode }, + { "vbroadcasti64x2", { XM, EXxmm }, 0 }, + { "vbroadcasti64x2", { XM, EXxmm }, 0 }, + }, + + /* EVEX_LEN_0F385B_P_2_W_0 */ + { + { Bad_Opcode }, + { Bad_Opcode }, + { "vbroadcasti32x8", { XM, EXxmmq }, 0 }, + }, + + /* EVEX_LEN_0F385B_P_2_W_1 */ + { + { Bad_Opcode }, + { Bad_Opcode }, + { "vbroadcasti64x4", { XM, EXymm }, 0 }, + }, + /* EVEX_LEN_0F3A18_P_2_W_0 */ { { Bad_Opcode }, diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 496b8f2..c765c84 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -1938,6 +1938,16 @@ enum EVEX_LEN_0F7E_P_1, EVEX_LEN_0F7E_P_2, EVEX_LEN_0FD6_P_2, + EVEX_LEN_0F3819_P_2_W_0, + EVEX_LEN_0F3819_P_2_W_1, + EVEX_LEN_0F381A_P_2_W_0, + EVEX_LEN_0F381A_P_2_W_1, + EVEX_LEN_0F381B_P_2_W_0, + EVEX_LEN_0F381B_P_2_W_1, + EVEX_LEN_0F385A_P_2_W_0, + EVEX_LEN_0F385A_P_2_W_1, + EVEX_LEN_0F385B_P_2_W_0, + EVEX_LEN_0F385B_P_2_W_1, EVEX_LEN_0F3A18_P_2_W_0, EVEX_LEN_0F3A18_P_2_W_1, EVEX_LEN_0F3A19_P_2_W_0, -- cgit v1.1