x86: harmonize disp with imm handling
authorJan Beulich <jbeulich@suse.com>
Tue, 15 Jun 2021 05:59:44 +0000 (07:59 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 15 Jun 2021 05:59:44 +0000 (07:59 +0200)
commita50187b2c6c28be79a32332e06a572cf08683de3
tree0e7b6cce1e8a7723756955f6d62de2df3f0950c5
parent86f041462ec31a02efbcecdce8ee52ed2f340a68
x86: harmonize disp with imm handling

Certain disp values may trigger "... shortened to ..." warnings when
equivalent imm ones don't. In some of the cases there are also
differences (for non-64-bit code) between BFD64 and !BFD64 builds. The
resulting encodings (i.e. use [or not] of the shorter disp8 / imm8
forms) are also different in some cases. Make this handling consistent.

Note that using equivalent 16-bit mode displacements / immediates
continues to expose entirely different behavior (see the disp-imm-16
testcase added by an earlier patch). This may want to be the subject of
further changes, but it'll then quickly become obvious that e.g. keying
use of extend_to_32bit_address() to non-64-bit mode isn't appropriate
either: Once we allow wrapping operands, we would better do so
consistently, in which case all of this would need to become dependent
upon address or operand size instead of mode.
gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/gas/i386/disp-imm-32.d [new file with mode: 0644]
gas/testsuite/gas/i386/disp-imm-32.s [new file with mode: 0644]
gas/testsuite/gas/i386/i386.exp