x86: Update register operand check for AddrPrefixOpReg
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 3 Oct 2020 11:23:55 +0000 (04:23 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 3 Oct 2020 11:24:05 +0000 (04:24 -0700)
commitb3a3496f83a14ad226790725c8e3ed9777fe2899
tree013a3f6f00f3622c454cae156daf7f9e441b7a9b
parent1fa1262d5a865a0f52c381f6465a3965e95c7904
x86: Update register operand check for AddrPrefixOpReg

When the address size prefix applies to both the memory and the register
operand, we need to extract the address size prefix from the register
operand if the memory operand has no real registers, like symbol, DISP
or symbol(%rip).

NB: GCC always generates symbol(%rip) for RIP-relative addressing for
both x32 and x86-64.

Move the .code16 tests in movdir.s to movdir-16bit to show the correct
output from objdump.

PR gas/26685
* config/tc-i386.c (process_suffix): Also check the register
operand for the address size prefix if the memory operand has
no real registers.
* testsuite/gas/i386/enqcmd-16bit.d: New file.
* testsuite/gas/i386/enqcmd-16bit.s: Likewise.
* testsuite/gas/i386/movdir-16bit.d: Likewise.
* testsuite/gas/i386/movdir-16bit.s: Likewise.
* testsuite/gas/i386/enqcmd.s: Add tests with symbol and DISP.
* testsuite/gas/i386/x86-64-enqcmd.s: Likewise.
* testsuite/gas/i386/x86-64-movdir.s: Likewise.
* testsuite/gas/i386/movdir.s: Add tests with symbol and DISP.
Remove the .code16 test.
* testsuite/gas/i386/i386.exp: Run movdir-16bit and enqcmd-16bit.
* testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated.
* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
* testsuite/gas/i386/x86-64-movdir.d: Likewise.
* testsuite/gas/i386/enqcmd-intel.d: Likewise.
* testsuite/gas/i386/enqcmd.d: Likewise.
* testsuite/gas/i386/movdir-intel.d: Likewise.
* testsuite/gas/i386/movdir.d: Likewise.
* testsuite/gas/i386/x86-64-enqcmd-intel.d: Likewise.
* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
* testsuite/gas/i386/x86-64-movdir.d: Likewise.
19 files changed:
gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/gas/i386/enqcmd-16bit.d [new file with mode: 0644]
gas/testsuite/gas/i386/enqcmd-16bit.s [new file with mode: 0644]
gas/testsuite/gas/i386/enqcmd-intel.d
gas/testsuite/gas/i386/enqcmd.d
gas/testsuite/gas/i386/enqcmd.s
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/movdir-16bit.d [new file with mode: 0644]
gas/testsuite/gas/i386/movdir-16bit.s [new file with mode: 0644]
gas/testsuite/gas/i386/movdir-intel.d
gas/testsuite/gas/i386/movdir.d
gas/testsuite/gas/i386/movdir.s
gas/testsuite/gas/i386/x86-64-enqcmd-intel.d
gas/testsuite/gas/i386/x86-64-enqcmd.d
gas/testsuite/gas/i386/x86-64-enqcmd.s
gas/testsuite/gas/i386/x86-64-movdir-intel.d
gas/testsuite/gas/i386/x86-64-movdir.d
gas/testsuite/gas/i386/x86-64-movdir.s