diff options
-rw-r--r-- | gas/ChangeLog | 11 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/lea16-optimize.d | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/lea16.d | 50 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/lea16.s | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/lea64-optimize.d | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/lea64.d | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/lea64.s | 8 |
9 files changed, 89 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 5926fff..e2084f8 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,16 @@ 2021-06-08 Jan Beulich <jbeulich@suse.com> + * config/tc-i386.c (optimize_disp): Write back updated value. + * testsuite/gas/i386/lea16.s, testsuite/gas/i386/lea64.s: New + cases. + * testsuite/gas/i386/lea16-optimize.d, + testsuite/gas/i386/lea64.d, testsuite/gas/i386/lea64-optimize.d: + Adjust expectations. + * testsuite/gas/i386/lea16.d: New. + * testsuite/gas/i386/i386.exp: Run new test. + +2021-06-08 Jan Beulich <jbeulich@suse.com> + * config/tc-i386.c (optimize_disp): Drop redundant masking. Re-order. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 9dbe6dc..249f1c3 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -5932,6 +5932,8 @@ optimize_disp (void) || i.types[op].bitfield.disp16) && fits_in_disp8 (op_disp)) i.types[op].bitfield.disp8 = 1; + + i.op[op].disps->X_add_number = op_disp; } else if (i.reloc[op] == BFD_RELOC_386_TLS_DESC_CALL || i.reloc[op] == BFD_RELOC_X86_64_TLSDESC_CALL) diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index db52df4..ff88bae 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -69,6 +69,7 @@ if [gas_32_check] then { run_dump_test "prefix" run_list_test "prefix32" "-al" run_dump_test "lea" + run_dump_test "lea16" run_dump_test "amd" run_dump_test "katmai" run_dump_test "jump" diff --git a/gas/testsuite/gas/i386/lea16-optimize.d b/gas/testsuite/gas/i386/lea16-optimize.d index e45b737..3c43b6c 100644 --- a/gas/testsuite/gas/i386/lea16-optimize.d +++ b/gas/testsuite/gas/i386/lea16-optimize.d @@ -45,4 +45,6 @@ Disassembly of section .text: [ ]*[0-9a-f]+:[ ]+67 8d 05 00 00 00 00[ ]+addr32 lea[ ]+0x0,%ax [ ]*[0-9a-f]+:[ ]+66 b8 00 00 00 00[ ]+mov[ ]+\$0x0,%eax [ ]*[0-9a-f]+:[ ]+b8 00 00[ ]+mov[ ]+\$0x0,%ax +[ ]*[0-9a-f]+:[ ]+8d 47 ff[ ]+lea[ ]+-0x1\(%bx\),%ax +[ ]*[0-9a-f]+:[ ]+8d 87 01 00[ ]+lea[ ]+0x1\(%bx\),%ax #pass diff --git a/gas/testsuite/gas/i386/lea16.d b/gas/testsuite/gas/i386/lea16.d new file mode 100644 index 0000000..179102a --- /dev/null +++ b/gas/testsuite/gas/i386/lea16.d @@ -0,0 +1,50 @@ +#as: -I${srcdir}/$subdir +#objdump: -dw -Mi8086 +#name: i386 16-bit LEA +#warning_output: lea.e + +.*: +file format .* + +Disassembly of section .text: + +0+ <start>: +[ ]*[0-9a-f]+:[ ]+36 67 66 8d 04 08[ ]+lea[ ]+%ss:\(%eax,%ecx(,1)?\),%eax +[ ]*[0-9a-f]+:[ ]+36 67 66 8d 04 08[ ]+lea[ ]+%ss:\(%eax,%ecx(,1)?\),%eax +[ ]*[0-9a-f]+:[ ]+67 66 8d 48 01[ ]+lea[ ]+0x1\(%eax\),%ecx +[ ]*[0-9a-f]+:[ ]+67 66 8d 88 00 00 00 00[ ]+lea[ ]+0x0\(%e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 ]+lea[ ]+0x0\(,%ecx(,1)?\),%eax +[ ]*[0-9a-f]+:[ ]+66 8d 06 01 00[ ]+lea[ ]+0x1,%eax +[ ]*[0-9a-f]+:[ ]+8d 06 02 00[ ]+lea[ ]+0x2,%ax +[ ]*[0-9a-f]+:[ ]+66 8d 06 ff ff[ ]+lea[ ]+-0x1,%eax +[ ]*[0-9a-f]+:[ ]+8d 06 fe ff[ ]+lea[ ]+-0x2,%ax +[ ]*[0-9a-f]+:[ ]+67 66 8d 05 01 00 00 00[ ]+addr32 lea[ ]+0x1,%eax +[ ]*[0-9a-f]+:[ ]+67 8d 05 02 00 00 00[ ]+addr32 lea[ ]+0x2,%ax +[ ]*[0-9a-f]+:[ ]+67 66 8d 05 ff ff ff ff[ ]+addr32 lea[ ]+0xffffffff,%eax +[ ]*[0-9a-f]+:[ ]+67 8d 05 fe ff ff ff[ ]+addr32 lea[ ]+0xfffffffe,%ax +[ ]*[0-9a-f]+:[ ]+66 8d 06 00 00[ ]+lea[ ]+0x0,%eax +[ ]*[0-9a-f]+:[ ]+8d 06 00 00[ ]+lea[ ]+0x0,%ax +[ ]*[0-9a-f]+:[ ]+67 66 8d 05 00 00 00 00[ ]+addr32 lea[ ]+0x0,%eax +[ ]*[0-9a-f]+:[ ]+67 8d 05 00 00 00 00[ ]+addr32 lea[ ]+0x0,%ax +[ ]*[0-9a-f]+:[ ]+66 8d 06 00 00[ ]+lea[ ]+0x0,%eax +[ ]*[0-9a-f]+:[ ]+8d 06 00 00[ ]+lea[ ]+0x0,%ax +[ ]*[0-9a-f]+:[ ]+8d 47 ff[ ]+lea[ ]+-0x1\(%bx\),%ax +[ ]*[0-9a-f]+:[ ]+8d 87 01 00[ ]+lea[ ]+0x1\(%bx\),%ax +#pass diff --git a/gas/testsuite/gas/i386/lea16.s b/gas/testsuite/gas/i386/lea16.s index 024a4e9..f48b05d 100644 --- a/gas/testsuite/gas/i386/lea16.s +++ b/gas/testsuite/gas/i386/lea16.s @@ -5,3 +5,6 @@ .endm .include "lea.s" + + lea 0xffff(%bx), %ax + lea -0xffff(%bx), %ax diff --git a/gas/testsuite/gas/i386/lea64-optimize.d b/gas/testsuite/gas/i386/lea64-optimize.d index 9d1c27d..75e21dd 100644 --- a/gas/testsuite/gas/i386/lea64-optimize.d +++ b/gas/testsuite/gas/i386/lea64-optimize.d @@ -68,4 +68,10 @@ Disassembly of section .text: [ ]*[0-9a-f]+:[ ]+48 c7 c0 00 00 00 00[ ]+mov[ ]+\$0x0,%rax [ ]*[0-9a-f]+:[ ]+b8 00 00 00 00[ ]+mov[ ]+\$0x0,%eax [ ]*[0-9a-f]+:[ ]+66 b8 00 00[ ]+mov[ ]+\$0x0,%ax +[ ]*[0-9a-f]+:[ ]+8d 41 ff[ ]+lea[ ]+-0x1\(%rcx\),%eax +[ ]*[0-9a-f]+:[ ]+8d 41 ff[ ]+lea[ ]+-0x1\(%rcx\),%eax +[ ]*[0-9a-f]+:[ ]+8d 41 ff[ ]+lea[ ]+-0x1\(%rcx\),%eax +[ ]*[0-9a-f]+:[ ]+8d 81 01 00 00 00[ ]+lea[ ]+0x1\(%rcx\),%eax +[ ]*[0-9a-f]+:[ ]+8d 81 01 00 00 00[ ]+lea[ ]+0x1\(%rcx\),%eax +[ ]*[0-9a-f]+:[ ]+8d 81 01 00 00 00[ ]+lea[ ]+0x1\(%rcx\),%eax #pass diff --git a/gas/testsuite/gas/i386/lea64.d b/gas/testsuite/gas/i386/lea64.d index e5b3f06..8bf2bec 100644 --- a/gas/testsuite/gas/i386/lea64.d +++ b/gas/testsuite/gas/i386/lea64.d @@ -67,4 +67,10 @@ Disassembly of section .text: [ ]*[0-9a-f]+:[ ]+48 8d 04 25 00 00 00 00[ ]+lea[ ]+0x0,%rax [ ]*[0-9a-f]+:[ ]+8d 04 25 00 00 00 00[ ]+lea[ ]+0x0,%eax [ ]*[0-9a-f]+:[ ]+66 8d 04 25 00 00 00 00[ ]+lea[ ]+0x0,%ax +[ ]*[0-9a-f]+:[ ]+67 8d 41 ff[ ]+lea[ ]+-0x1\(%ecx\),%eax +[ ]*[0-9a-f]+:[ ]+67 48 8d 41 ff[ ]+lea[ ]+-0x1\(%ecx\),%rax +[ ]*[0-9a-f]+:[ ]+8d 41 ff[ ]+lea[ ]+-0x1\(%rcx\),%eax +[ ]*[0-9a-f]+:[ ]+67 8d 81 01 00 00 00[ ]+lea[ ]+0x1\(%ecx\),%eax +[ ]*[0-9a-f]+:[ ]+67 48 8d 81 01 00 00 00[ ]+lea[ ]+0x1\(%ecx\),%rax +[ ]*[0-9a-f]+:[ ]+8d 81 01 00 00 00[ ]+lea[ ]+0x1\(%rcx\),%eax #pass diff --git a/gas/testsuite/gas/i386/lea64.s b/gas/testsuite/gas/i386/lea64.s index 1778adc..5c20062 100644 --- a/gas/testsuite/gas/i386/lea64.s +++ b/gas/testsuite/gas/i386/lea64.s @@ -82,3 +82,11 @@ start: lea (,1), %rax lea (,1), %eax lea (,1), %ax + + lea 0xffffffff(%ecx), %eax + lea 0xffffffff(%ecx), %rax + lea 0xffffffff(%rcx), %eax + + lea -0xffffffff(%ecx), %eax + lea -0xffffffff(%ecx), %rax + lea -0xffffffff(%rcx), %eax |