This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ia32 suffix inconsistency


On Wed, Dec 15, 2010 at 3:11 AM, Etienne Lorrain
<etienne_lorrain@yahoo.fr> wrote:
> Hello,
>
> Just a small detail I think I have to report, with:
> GNU assembler (GNU Binutils for Debian) 2.20.1-system.20100303
> This assembler was configured for a target of `i486-linux-gnu'
> It is not a regression, i.e. same behaviour for years.
>
> We have to postfix 'l' (or 'w' or 'b') when using a simple 'mov' or 'test':
> $ echo 'mov $1,(%ebx)' | as
> {standard input}: Assembler messages:
> {standard input}:1: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
> $ echo 'movl $1,(%ebx)' | as
> $ echo 'test $1,(%ebx)' | as
> {standard input}: Assembler messages:
> {standard input}:1: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
> $

Those insns don't extend immX to 32bit/64bit.

> but other instructions like and/cmp/xor/or should also need such suffix, isn't it?
> $ echo 'and $1,(%ebx)' | as
> $ echo 'cmp $1,(%ebx)' | as
> $ echo 'xor $1,(%ebx)' | as
> $ echo 'or $1,(%ebx)' | as

Those insns extend immX to 32bit first.

> I am not sure for 'or' because the access length may be optimised by the
> size of the constant, but then the 'test' should be the same.
> Note that optimising 'orl $0,(%ebx)' to 'orb $0,(%ebx)' is incorrect
> because the zero flag is not set in the same conditions, same for
> an 'xor' with any constant value.
>

I don't quite follow you.

or $1,(%ebx)

has the same result as

or $0x00000001,(%ebx)

Both apply to 32bit memory.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]