I am learning assembly and reading "Computer Systems: A programmer's perspective". In Practice Problem 3.3, it says movl %eax,%rdx
will generate an error. The answer keys says movl %eax,%dx Destination operand incorrect size
. I am not sure if this is a typo or not, but my question is: is movl %eax,%rdx
a legal instruction? I think it is moving the 32 bits in %eax
with zero extension to %rdx
, which will not be generated as movzql
since
an instruction generating a 4-byte value with a register as the destination will fill the upper 4 bytes with zeros` (from the book).
I tried to write some C code to generate it, but I always get movslq %eax, %rdx
(GCC 4.8.5 -Og). I am completely confused.