ia32 suffix inconsistency

H.J. Lu hjl.tools@gmail.com
Wed Dec 15 17:28:00 GMT 2010


On Wed, Dec 15, 2010 at 8:55 AM, Etienne Lorrain
<etienne_lorrain@yahoo.fr> wrote:
> 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.

Intel SDM isn't an assembly manual. If the default operand size
isn't documented in gas manual, please file a bug.

> I understand that it is my problem to have assumed "or $1,(%ebx)"
> would be encoded in hexadecimal as a byte operation by AS.

That is is what Intel SDM is for.

-- 
H.J.



More information about the Binutils mailing list