A quick question regarding a movzwl instruction which do not behave as I expected.

here is the disassembled code:

movzwl (%rax),%eax

Before the instruction, rax is 0x7fffffffe410 and point to 0x5 After the instruction, I would expect eax to be 0x5 (which is the case), but I would not expect that the upper bits of rax be cleared too... However, when debugging, rax values 0x5...

I thought that movzwl would only clear the upper bits of eax, but not the rax ones. Could you explain?

Thank you very very much for your help!

enter image description here

  • "I thought that ..": Did you check the official Intel documentation?
    – Jongware
    Dec 28 '17 at 12:31

This is a somewhat tricky part of the x64 instruction set and is not mentioned in descriptions of individual instructions but only as a sidenote in the general introduction section. Here's a good answer on it:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.