x86: Clear modrm if not needed
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 5 Oct 2020 12:23:29 +0000 (05:23 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 5 Oct 2020 12:23:39 +0000 (05:23 -0700)
commit0e9f3bf12616b108682bb6f6e2a5ef04df9586a8
treefed8d852a0d65cf6b461151725aaa817369d2f8d
parentb58e7f729ebd85ff62a29357a01c15a29d458829
x86: Clear modrm if not needed

The MODRM byte can be checked to display the instruction name only if the
MODRM byte needed.  Clear modrm if the MODRM byte isn't needed so that
modrm field checks in putop like, modrm.mod == N with N != 0, can be done
without checking need_modrm.

gas/

PR binutils/26705
* testsuite/gas/i386/x86-64-suffix.s: Add "mov %rsp,%rbp" before
sysretq.
* testsuite/gas/i386/x86-64-suffix-intel.d: Updated.
* testsuite/gas/i386/x86-64-suffix.d: Likewise.

opcodes/

PR binutils/26705
* i386-dis.c (print_insn): Clear modrm if not needed.
(putop): Check need_modrm for modrm.mod != 3.  Don't check
need_modrm for modrm.mod == 3.
gas/ChangeLog
gas/testsuite/gas/i386/x86-64-suffix-intel.d
gas/testsuite/gas/i386/x86-64-suffix.d
gas/testsuite/gas/i386/x86-64-suffix.s
opcodes/ChangeLog
opcodes/i386-dis.c