diff options
author | Jan Beulich <jbeulich@suse.com> | 2020-07-14 10:27:32 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2020-07-14 10:27:32 +0200 |
commit | c4de76066e9c6fa42d6f02c6519d2c6bbe0cc983 (patch) | |
tree | 95754fa24aa302befc80931de2902b22b9cda958 /opcodes | |
parent | 9ab00b61a9d7d84313b1793255a1bc63b97fd9b7 (diff) | |
download | fsf-binutils-gdb-c4de76066e9c6fa42d6f02c6519d2c6bbe0cc983.zip fsf-binutils-gdb-c4de76066e9c6fa42d6f02c6519d2c6bbe0cc983.tar.gz fsf-binutils-gdb-c4de76066e9c6fa42d6f02c6519d2c6bbe0cc983.tar.bz2 |
x86: fold VCMP_Fixup() into CMP_Fixup()
There's no reason to have two functions and two tables, when the AVX
functionality here is a proper superset of the SSE one.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 9 | ||||
-rw-r--r-- | opcodes/i386-dis-evex-prefix.h | 4 | ||||
-rw-r--r-- | opcodes/i386-dis-evex-w.h | 4 | ||||
-rw-r--r-- | opcodes/i386-dis.c | 115 |
4 files changed, 58 insertions, 74 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 0e9e75b..ed46ed2 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,14 @@ 2020-07-14 Jan Beulich <jbeulich@suse.com> + * i386-dis.c (VCMP_Fixup, VCMP): Delete. + (simd_cmp_op): Add const. + (vex_cmp_op): Move up and drop initial 8 entries. Add const. + (CMP_Fixup): Handle VEX case. + (prefix_table): Replace VCMP by CMP. + * i386-dis-evex-prefix.h, i386-dis-evex-w.h: Likewise. + +2020-07-14 Jan Beulich <jbeulich@suse.com> + * i386-dis.c (MOVBE_Fixup): Delete. (Mv): Define. (prefix_table): Use Mv for movbe entries. diff --git a/opcodes/i386-dis-evex-prefix.h b/opcodes/i386-dis-evex-prefix.h index 02dc75f..90d5be2 100644 --- a/opcodes/i386-dis-evex-prefix.h +++ b/opcodes/i386-dis-evex-prefix.h @@ -291,9 +291,9 @@ }, /* PREFIX_EVEX_0FC2 */ { - { "vcmppX", { XMask, Vex, EXx, EXxEVexS, VCMP }, PREFIX_OPCODE }, + { "vcmppX", { XMask, Vex, EXx, EXxEVexS, CMP }, PREFIX_OPCODE }, { VEX_W_TABLE (EVEX_W_0FC2_P_1) }, - { "vcmppX", { XMask, Vex, EXx, EXxEVexS, VCMP }, PREFIX_OPCODE }, + { "vcmppX", { XMask, Vex, EXx, EXxEVexS, CMP }, PREFIX_OPCODE }, { VEX_W_TABLE (EVEX_W_0FC2_P_3) }, }, /* PREFIX_EVEX_0FC4 */ diff --git a/opcodes/i386-dis-evex-w.h b/opcodes/i386-dis-evex-w.h index ac786fc..f7460ef 100644 --- a/opcodes/i386-dis-evex-w.h +++ b/opcodes/i386-dis-evex-w.h @@ -270,12 +270,12 @@ }, /* EVEX_W_0FC2_P_1 */ { - { "vcmpss", { XMask, VexScalar, EXxmm_md, EXxEVexS, VCMP }, 0 }, + { "vcmpss", { XMask, VexScalar, EXxmm_md, EXxEVexS, CMP }, 0 }, }, /* EVEX_W_0FC2_P_3 */ { { Bad_Opcode }, - { "vcmpsd", { XMask, VexScalar, EXxmm_mq, EXxEVexS, VCMP }, 0 }, + { "vcmpsd", { XMask, VexScalar, EXxmm_mq, EXxEVexS, CMP }, 0 }, }, /* EVEX_W_0FD2 */ { diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index aa36ef5..9ad7d7b 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -95,7 +95,6 @@ static void OP_Rounding (int, int); static void OP_REG_VexI4 (int, int); static void OP_VexI4 (int, int); static void PCLMUL_Fixup (int, int); -static void VCMP_Fixup (int, int); static void VPCMP_Fixup (int, int); static void VPCOM_Fixup (int, int); static void OP_0f07 (int, int); @@ -409,7 +408,6 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr) #define XMVexScalarI4 { OP_REG_VexI4, scalar_mode } #define VexI4 { OP_VexI4, 0 } #define PCLMUL { PCLMUL_Fixup, 0 } -#define VCMP { VCMP_Fixup, 0 } #define VPCMP { VPCMP_Fixup, 0 } #define VPCOM { VPCOM_Fixup, 0 } @@ -5144,10 +5142,10 @@ static const struct dis386 prefix_table[][4] = { /* PREFIX_VEX_0FC2 */ { - { "vcmpps", { XM, Vex, EXx, VCMP }, 0 }, - { "vcmpss", { XMScalar, VexScalar, EXxmm_md, VCMP }, 0 }, - { "vcmppd", { XM, Vex, EXx, VCMP }, 0 }, - { "vcmpsd", { XMScalar, VexScalar, EXxmm_mq, VCMP }, 0 }, + { "vcmpps", { XM, Vex, EXx, CMP }, 0 }, + { "vcmpss", { XMScalar, VexScalar, EXxmm_md, CMP }, 0 }, + { "vcmppd", { XM, Vex, EXx, CMP }, 0 }, + { "vcmpsd", { XMScalar, VexScalar, EXxmm_mq, CMP }, 0 }, }, /* PREFIX_VEX_0FC4 */ @@ -16111,7 +16109,7 @@ OP_3DNowSuffix (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED) mnemonicendp = obufp; } -static struct op simd_cmp_op[] = +static const struct op simd_cmp_op[] = { { STRING_COMMA_LEN ("eq") }, { STRING_COMMA_LEN ("lt") }, @@ -16123,6 +16121,34 @@ static struct op simd_cmp_op[] = { STRING_COMMA_LEN ("ord") } }; +static const struct op vex_cmp_op[] = +{ + { STRING_COMMA_LEN ("eq_uq") }, + { STRING_COMMA_LEN ("nge") }, + { STRING_COMMA_LEN ("ngt") }, + { STRING_COMMA_LEN ("false") }, + { STRING_COMMA_LEN ("neq_oq") }, + { STRING_COMMA_LEN ("ge") }, + { STRING_COMMA_LEN ("gt") }, + { STRING_COMMA_LEN ("true") }, + { STRING_COMMA_LEN ("eq_os") }, + { STRING_COMMA_LEN ("lt_oq") }, + { STRING_COMMA_LEN ("le_oq") }, + { STRING_COMMA_LEN ("unord_s") }, + { STRING_COMMA_LEN ("neq_us") }, + { STRING_COMMA_LEN ("nlt_uq") }, + { STRING_COMMA_LEN ("nle_uq") }, + { STRING_COMMA_LEN ("ord_s") }, + { STRING_COMMA_LEN ("eq_us") }, + { STRING_COMMA_LEN ("nge_uq") }, + { STRING_COMMA_LEN ("ngt_uq") }, + { STRING_COMMA_LEN ("false_os") }, + { STRING_COMMA_LEN ("neq_os") }, + { STRING_COMMA_LEN ("ge_oq") }, + { STRING_COMMA_LEN ("gt_oq") }, + { STRING_COMMA_LEN ("true_us") }, +}; + static void CMP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED) { @@ -16140,6 +16166,18 @@ CMP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED) sprintf (p, "%s%s", simd_cmp_op[cmp_type].name, suffix); mnemonicendp += simd_cmp_op[cmp_type].len; } + else if (need_vex + && cmp_type < ARRAY_SIZE (simd_cmp_op) + ARRAY_SIZE (vex_cmp_op)) + { + char suffix [3]; + char *p = mnemonicendp - 2; + suffix[0] = p[0]; + suffix[1] = p[1]; + suffix[2] = '\0'; + cmp_type -= ARRAY_SIZE (simd_cmp_op); + sprintf (p, "%s%s", vex_cmp_op[cmp_type].name, suffix); + mnemonicendp += vex_cmp_op[cmp_type].len; + } else { /* We have a reserved extension byte. Output it directly. */ @@ -16597,69 +16635,6 @@ OP_XMM_Vex (int bytemode, int sizeflag) OP_XMM (bytemode, sizeflag); } -static struct op vex_cmp_op[] = -{ - { STRING_COMMA_LEN ("eq") }, - { STRING_COMMA_LEN ("lt") }, - { STRING_COMMA_LEN ("le") }, - { STRING_COMMA_LEN ("unord") }, - { STRING_COMMA_LEN ("neq") }, - { STRING_COMMA_LEN ("nlt") }, - { STRING_COMMA_LEN ("nle") }, - { STRING_COMMA_LEN ("ord") }, - { STRING_COMMA_LEN ("eq_uq") }, - { STRING_COMMA_LEN ("nge") }, - { STRING_COMMA_LEN ("ngt") }, - { STRING_COMMA_LEN ("false") }, - { STRING_COMMA_LEN ("neq_oq") }, - { STRING_COMMA_LEN ("ge") }, - { STRING_COMMA_LEN ("gt") }, - { STRING_COMMA_LEN ("true") }, - { STRING_COMMA_LEN ("eq_os") }, - { STRING_COMMA_LEN ("lt_oq") }, - { STRING_COMMA_LEN ("le_oq") }, - { STRING_COMMA_LEN ("unord_s") }, - { STRING_COMMA_LEN ("neq_us") }, - { STRING_COMMA_LEN ("nlt_uq") }, - { STRING_COMMA_LEN ("nle_uq") }, - { STRING_COMMA_LEN ("ord_s") }, - { STRING_COMMA_LEN ("eq_us") }, - { STRING_COMMA_LEN ("nge_uq") }, - { STRING_COMMA_LEN ("ngt_uq") }, - { STRING_COMMA_LEN ("false_os") }, - { STRING_COMMA_LEN ("neq_os") }, - { STRING_COMMA_LEN ("ge_oq") }, - { STRING_COMMA_LEN ("gt_oq") }, - { STRING_COMMA_LEN ("true_us") }, -}; - -static void -VCMP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED) -{ - unsigned int cmp_type; - - FETCH_DATA (the_info, codep + 1); - cmp_type = *codep++ & 0xff; - if (cmp_type < ARRAY_SIZE (vex_cmp_op)) - { - char suffix [3]; - char *p = mnemonicendp - 2; - suffix[0] = p[0]; - suffix[1] = p[1]; - suffix[2] = '\0'; - sprintf (p, "%s%s", vex_cmp_op[cmp_type].name, suffix); - mnemonicendp += vex_cmp_op[cmp_type].len; - } - else - { - /* We have a reserved extension byte. Output it directly. */ - scratchbuf[0] = '$'; - print_operand_value (scratchbuf + 1, 1, cmp_type); - oappend_maybe_intel (scratchbuf); - scratchbuf[0] = '\0'; - } -} - static void VPCMP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED) |