From b23bac360005fe9d367d735a14faed192f6d37c2 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 20 Aug 1999 11:59:19 +0000 Subject: [PATCH] *gas/config/tc-i386.c: Fix errors in displacement size when automatically inferring an address prefex. --- gas/ChangeLog | 5 +++++ gas/config/tc-i386.c | 8 ++++++++ gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/i386/general.l | 15 +++++++++++---- gas/testsuite/gas/i386/general.s | 8 ++++++++ 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 12d2d4f83b0..052d7465d24 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +1999-08-20 Alan Modra + + * config/tc-i386.c (i386_index_check): Fix the displacement size + when INFER_ADDR_PREFIX. + 1999-08-18 Nick Clifton * config/tc-arm.c (md_apply_fix3): If an offset is invalid, diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 22b5d5d7614..a2c0bcc4d6e 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -3115,6 +3115,14 @@ i386_index_check (operand_string) { i.prefix[ADDR_PREFIX] = ADDR_PREFIX_OPCODE; i.prefixes += 1; + /* Change the size of any displacement too. At most one of + Disp16 or Disp32 is set. + FIXME. There doesn't seem to be any real need for separate + Disp16 and Disp32 flags. The same goes for Imm16 and Imm32. + Removing them would probably clean up the code quite a lot. + */ + if (i.types[this_operand] & (Disp16|Disp32)) + i.types[this_operand] ^= (Disp16|Disp32); fudged = 1; goto tryprefix; } diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 84663de3a9f..aa5b76170d5 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +1999-08-20 Alan Modra + + * gas/i386/general.s, gas/i386/general.l: Add .code16gcc + displacement checks with auto address prefix. + 1999-08-17 H.J. Lu * gas/elf/elf.exp: Expected to fail on alpha*-*-*. diff --git a/gas/testsuite/gas/i386/general.l b/gas/testsuite/gas/i386/general.l index 68f660030cc..e07e7664c18 100644 --- a/gas/testsuite/gas/i386/general.l +++ b/gas/testsuite/gas/i386/general.l @@ -200,7 +200,14 @@ 147 0137 89341D00 000000 mov %esi,\(,%ebx,1\) 148 013e 80250000 00007F andb \$~0x80,foo 149 - 150 # Force a good alignment. - 151 0145 00000000 00000000[ ]*.p2align 4,0 - 151 000000 - + 150 #check 16-bit code auto address prefix + 151 .code16gcc + 152 0145 67668D95 00FFFFFF leal -256\(%ebp\),%edx + 153 014d 6788857F FFFFFF mov %al,-129\(%ebp\) + 154 0154 67886580 mov %ah,-128\(%ebp\) + 155 0158 67668D9D 20F9FFFF leal -1760\(%ebp\),%ebx + 156 0160 67668984 248C0000 movl %eax,140\(%esp\) + 156 00 + 157 + 158 # Force a good alignment. + 159 0169 00000000 000000[ ]*.p2align 4,0 diff --git a/gas/testsuite/gas/i386/general.s b/gas/testsuite/gas/i386/general.s index cbe037300d8..b96b68d359c 100644 --- a/gas/testsuite/gas/i386/general.s +++ b/gas/testsuite/gas/i386/general.s @@ -147,5 +147,13 @@ mov %esi,(,%ebx,1) andb $~0x80,foo +#check 16-bit code auto address prefix +.code16gcc + leal -256(%ebp),%edx + mov %al,-129(%ebp) + mov %ah,-128(%ebp) + leal -1760(%ebp),%ebx + movl %eax,140(%esp) + # Force a good alignment. .p2align 4,0 -- 2.30.2