When adding an immediate value into a register, how does the assembler first zero out the register? For example, if I have a register value of:
%rax 0x00007fffffffe450
And I do:
mov $1, %rax
It effectively does either:
movzbq $1, %rax
Or:
mov $0x0000000000000001, %rax
As it clears out the upper bits to fit into the register. Is this done by the assembler when compiling or the cpu, or where/how does this occur?
As a sort of meta question (not directly related to the question above), I do have a bit of a hard time searching for duplicate asm questions as the titles often seem to be very specific. What would be the best way to search for these?