In x86-64, 32-bit instructions implicitly zero-extend: bits 32-63 are cleared (to avoid false dependencies). So sometimes that’s why you’ll see odd-looking instructions. (Is mov %esi, %esi a no-op or not on x86-64?)
However, in this case the previous mov
-load is also 32-bit so the high half of %rax
is already cleared. The mov %eax, %eax
appears to be redundant, apparently just a GCC missed optimization.