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


Mer 15.12.10, H.J. Lu <hjl.tools@gmail.com> wrote:
> You should read IA32 SDM very carefully if you want to
> write in assembly.

I know that those instructions are different:
$ echo 'and $1,(%ebx)' | as -al | tail -1
   1 0000 832301        and $1,(%ebx)
$ echo 'andl $1,(%ebx)' | as -al | tail -1
   1 0000 832301        andl $1,(%ebx)
$ echo 'andw $1,(%ebx)' | as -al | tail -1
   1 0000 66832301      andw $1,(%ebx)
$ echo 'andb $1,(%ebx)' | as -al | tail -1
   1 0000 802301        andb $1,(%ebx)

I just checked that, as expected, the zero flag is set on "andb"
when the byte (%ebx) is zero, whatever the dword value (%ebx).

I am just reporting the inconsistency that for "mov" and "test",
the suffix is required, but for the other examples I gave
(like "and") they are not, and the AS default is not documented
in Intel reference books.
I understand that it is my problem to have assumed "or $1,(%ebx)"
would be encoded in hexadecimal as a byte operation by AS.
Now, I do not know if anything can be done about it - I did not
check if GCC always gives the suffix - I just wanted to report
the inconsistency.

Regards,
Etienne.




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