Is mov %esi, %esi a no-op or not on x86-64?
mov %esi, %esi
zeros out the high 32 bits of %rsi, and is therefore not a no-op on x86_64.
See Why do x86-64 instructions on 32-bit registers zero the upper part of the full 64-bit register?
#include <stdio.h>
int main(int argc, char * argv[])
{
void * reg_rsi = 0;
asm (
"movq $0x1234567812345678, %%rsi;\n"
"movl %%esi, %%esi;\n"
"movq %%rsi, %0;\n"
: "=r" (reg_rsi)
: /* no inputs */
: /* no clobbered */
);
printf("reg_rsi = %p\n", reg_rsi);
return 0;
}
This gives "reg_rsi = 0x12345678" for my x86_64 machine.