diff options
author | Jan Beulich <jbeulich@suse.com> | 2021-06-15 07:59:44 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2021-06-15 07:59:44 +0200 |
commit | a50187b2c6c28be79a32332e06a572cf08683de3 (patch) | |
tree | 0e7b6cce1e8a7723756955f6d62de2df3f0950c5 /gas/testsuite | |
parent | 86f041462ec31a02efbcecdce8ee52ed2f340a68 (diff) | |
download | gdb-a50187b2c6c28be79a32332e06a572cf08683de3.zip gdb-a50187b2c6c28be79a32332e06a572cf08683de3.tar.gz gdb-a50187b2c6c28be79a32332e06a572cf08683de3.tar.bz2 |
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.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/i386/disp-imm-32.d | 21 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/disp-imm-32.s | 17 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 3 |
3 files changed, 41 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/disp-imm-32.d b/gas/testsuite/gas/i386/disp-imm-32.d new file mode 100644 index 0000000..dc712b9 --- /dev/null +++ b/gas/testsuite/gas/i386/disp-imm-32.d @@ -0,0 +1,21 @@ +#objdump: -dw +#name: i386 displacements / immediates (32-bit) + +.*: +file format .* + +Disassembly of section .text: + +0+ <disp_imm>: +[ ]*[a-f0-9]+: 8b 40 01 mov 0x1\(%eax\),%eax +[ ]*[a-f0-9]+: 62 f1 7c 48 28 40 01 vmovaps 0x40\(%eax\),%zmm0 +[ ]*[a-f0-9]+: 83 c1 01 add \$0x1,%ecx +[ ]*[a-f0-9]+: 8b 00 mov \(%eax\),%eax +[ ]*[a-f0-9]+: 62 f1 7c 48 28 00 vmovaps \(%eax\),%zmm0 +[ ]*[a-f0-9]+: 83 c1 00 add \$0x0,%ecx +[ ]*[a-f0-9]+: 8b 40 ff mov -0x1\(%eax\),%eax +[ ]*[a-f0-9]+: 62 f1 7c 48 28 40 ff vmovaps -0x40\(%eax\),%zmm0 +[ ]*[a-f0-9]+: 83 c1 ff add \$0xffffffff,%ecx +[ ]*[a-f0-9]+: 8b 40 01 mov 0x1\(%eax\),%eax +[ ]*[a-f0-9]+: 62 f1 7c 48 28 40 01 vmovaps 0x40\(%eax\),%zmm0 +[ ]*[a-f0-9]+: 83 c1 01 add \$0x1,%ecx +#pass diff --git a/gas/testsuite/gas/i386/disp-imm-32.s b/gas/testsuite/gas/i386/disp-imm-32.s new file mode 100644 index 0000000..5145d60 --- /dev/null +++ b/gas/testsuite/gas/i386/disp-imm-32.s @@ -0,0 +1,17 @@ + .text +disp_imm: + mov -0xffffffff(%eax), %eax + vmovaps -0xffffffc0(%eax), %zmm0 + add $-0xffffffff, %ecx + + mov -0xffffffff-1(%eax), %eax + vmovaps -0xffffffc0-0x40(%eax), %zmm0 + add $-0xffffffff-1, %ecx + + mov -0xffffffff-2(%eax), %eax + vmovaps -0xffffffc0-0x80(%eax), %zmm0 + add $-0xffffffff-2, %ecx + + mov -0x1ffffffff(%eax), %eax + vmovaps -0x1ffffffc0(%eax), %zmm0 + add $-0x1ffffffff, %ecx diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 4112a1d..8f41778 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -88,6 +88,9 @@ if [gas_32_check] then { run_dump_test "disp-intel" run_dump_test "disp32" run_list_test "disp-imm-16" + if { [gas_bfd64_check] } { + run_dump_test "disp-imm-32" + } run_dump_test "vmx" run_dump_test "vmfunc" run_dump_test "smx" |