Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libc/arch/x86_64/sys



On Sat, Mar 15, 2003 at 04:04:24PM +0100, Jaromir Dolecek wrote:
> Does movl really zero extend? According to 80386 docs I read recently,
> movb/movw don't touch the upper part of the resiter, i.e. for example
> movb $1, %al wouldn't change %ah part and leave old contents there.
> Is x86_64 different, and does it zero the upper part of register instead?

In long (64 bit) mode:

        * movw and movb touch the lower 16 and 8 bits, respectively,
          to be backward compatible.
        * movl gets zero-extended (upper 32 bits are zeroed out)
        * movq does the full 64 bits. For immediate movq instructions,
          there is only a 32 bit value in the instruction, which gets
          sign-extended.
        * The exception to the above is movabsq imm,reg which does have
          a full 64 bit immediate value

- Frank



Home | Main Index | Thread Index | Old Index