x86: consolidate Disp<NN> handling a little
authorJan Beulich <jbeulich@suse.com>
Fri, 27 Dec 2019 08:22:03 +0000 (09:22 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 27 Dec 2019 08:22:03 +0000 (09:22 +0100)
commit48bcea9f48cce70005307befbc604de3618bbaf7
tree2b20e4d4a13c36eec40a4f299437715bd64d33f5
parent4d4eaa30055138112bd17ed6933f2da39760d9e6
x86: consolidate Disp<NN> handling a little

In memory operand addressing, which forms of displacement are permitted
besides Disp8 is pretty clearly limited
- outside of 64-bit mode, Disp16 or Disp32 only, depending on address
  size (MPX being special in not allowing Disp16),
- in 64-bit mode, Disp32s or Disp64 without address size override, and
  solely Disp32 with one.
Adjust assembler and i386-gen to match this, observing that templates
already get adjusted before trying to match them against input depending
on the presence of an address size prefix.

This adjustment logic gets extended to all cases, as certain DispNN
values should also be dropped when there's no such prefix. In fact
behavior of the assembler, perhaps besides the exact diagnostics wording,
should not differ between there being templates applicable to 64-bit and
non-64-bit at the same time, or there being fully separate sets of
templates, with their DispNN settings already reduced accordingly.

This adjustment logic further gets guarded such that there wouldn't be
and Disp<N> conversion based on address size prefix when this prefix
doesn't control the width of the displacement (on branches other than
absolute ones).

These adjustments then also allow folding two MOV templates, which had
been split between 64-bit and non-64-bits variants so far.

Once in this area also
- drop the bogus DispNN from JumpByte templates, leaving just the
  correct Disp8 there (compensated by i386_finalize_displacement()
  now setting Disp8 on their operands),
- add the missing Disp32S to XBEGIN.

Note that the changes make it necessary to temporarily mark a test as
XFAIL; this will get taken care of by a subsequent patch. The failing
parts are entirely bogus and will get replaced.
gas/ChangeLog
gas/config/tc-i386-intel.c
gas/config/tc-i386.c
gas/testsuite/gas/i386/i386.exp
opcodes/ChangeLog
opcodes/i386-gen.c
opcodes/i386-opc.tbl
opcodes/i386-tbl.h
This page took 0.026687 seconds and 4 git commands to generate.