diff options
author | Jan Beulich <jbeulich@suse.com> | 2020-07-14 10:25:43 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2020-07-14 10:25:43 +0200 |
commit | 2875b28aa871395dc17182f0bacfe40a68b1ad05 (patch) | |
tree | 04b4b40fe7eef3f39af852088239560621923702 /opcodes | |
parent | e184e6110e2836bb0ec712e380dbcac402fe4056 (diff) | |
download | fsf-binutils-gdb-2875b28aa871395dc17182f0bacfe40a68b1ad05.zip fsf-binutils-gdb-2875b28aa871395dc17182f0bacfe40a68b1ad05.tar.gz fsf-binutils-gdb-2875b28aa871395dc17182f0bacfe40a68b1ad05.tar.bz2 |
x86: avoid attaching suffix to register-only CRC32
Just like other insns with GPR operands, CRC32 with only register
operands should not get a suffix added unless in suffix-always mode.
Do away with CRC32_Fixup() altogether, using other more generic logic
instead.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 5 | ||||
-rw-r--r-- | opcodes/i386-dis.c | 77 |
2 files changed, 7 insertions, 75 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 4ac10ce..42a2cc6 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,10 @@ 2020-07-14 Jan Beulich <jbeulich@suse.com> + * i386-dis.c (CRC32_Fixup): Delete. + (prefix_table): Use Eb/Ev for crc32 entries. + +2020-07-14 Jan Beulich <jbeulich@suse.com> + * i386-dis.c (OP_E_register, OP_G, OP_REG, CRC32_Fixup): Conditionalize invocations of "USED_REX (0)". diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 4940c8a..3199a17 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -115,7 +115,6 @@ static void HLE_Fixup2 (int, int); static void HLE_Fixup3 (int, int); static void CMPXCHG8B_Fixup (int, int); static void XMM_Fixup (int, int); -static void CRC32_Fixup (int, int); static void FXSAVE_Fixup (int, int); static void PCMPESTR_Fixup (int, int); @@ -4426,7 +4425,7 @@ static const struct dis386 prefix_table[][4] = { { "movbeS", { Gv, { MOVBE_Fixup, v_mode } }, PREFIX_OPCODE }, { Bad_Opcode }, { "movbeS", { Gv, { MOVBE_Fixup, v_mode } }, PREFIX_OPCODE }, - { "crc32", { Gdq, { CRC32_Fixup, b_mode } }, PREFIX_OPCODE }, + { "crc32A", { Gdq, Eb }, PREFIX_OPCODE }, }, /* PREFIX_0F38F1 */ @@ -4434,7 +4433,7 @@ static const struct dis386 prefix_table[][4] = { { "movbeS", { { MOVBE_Fixup, v_mode }, Gv }, PREFIX_OPCODE }, { Bad_Opcode }, { "movbeS", { { MOVBE_Fixup, v_mode }, Gv }, PREFIX_OPCODE }, - { "crc32", { Gdq, { CRC32_Fixup, v_mode } }, PREFIX_OPCODE }, + { "crc32Q", { Gdq, Ev }, PREFIX_OPCODE }, }, /* PREFIX_0F38F5 */ @@ -16370,78 +16369,6 @@ XMM_Fixup (int reg, int sizeflag ATTRIBUTE_UNUSED) } static void -CRC32_Fixup (int bytemode, int sizeflag) -{ - /* Add proper suffix to "crc32". */ - char *p = mnemonicendp; - - switch (bytemode) - { - case b_mode: - if (intel_syntax) - goto skip; - - *p++ = 'b'; - break; - case v_mode: - if (intel_syntax) - goto skip; - - USED_REX (REX_W); - if (rex & REX_W) - *p++ = 'q'; - else - { - if (sizeflag & DFLAG) - *p++ = 'l'; - else - *p++ = 'w'; - used_prefixes |= (prefixes & PREFIX_DATA); - } - break; - default: - oappend (INTERNAL_DISASSEMBLER_ERROR); - break; - } - mnemonicendp = p; - *p = '\0'; - - skip: - if (modrm.mod == 3) - { - int add; - - /* Skip mod/rm byte. */ - MODRM_CHECK; - codep++; - - USED_REX (REX_B); - add = (rex & REX_B) ? 8 : 0; - if (bytemode == b_mode) - { - if (modrm.rm & 4) - USED_REX (0); - if (rex) - oappend (names8rex[modrm.rm + add]); - else - oappend (names8[modrm.rm + add]); - } - else - { - USED_REX (REX_W); - if (rex & REX_W) - oappend (names64[modrm.rm + add]); - else if ((prefixes & PREFIX_DATA)) - oappend (names16[modrm.rm + add]); - else - oappend (names32[modrm.rm + add]); - } - } - else - OP_E (bytemode, sizeflag); -} - -static void FXSAVE_Fixup (int bytemode, int sizeflag) { /* Add proper suffix to "fxsave" and "fxrstor". */ |