I test the code below, and wonder why that when we affect edx, the whole rdx would change? But why does the same thing not happen to dx v.s? rdx? Is that a feature? Why?
#include <stdio.h>
int main(){
__asm__("mov $18446744073709551615, %rdx\n\t");
__asm__("mov $1, %dx\n\t"); // 0xffffffffffff0001
__asm__("mov $18446744073709551615, %rdx\n\t");
__asm__("mov $1, %edx\n\t"); // 0x1
__asm__("mov $18446744073709551615, %rdx\n\t");
__asm__("xor %edx, %edx\n\t"); // 0x1
__asm__("mov $18446744073709551615, %rdx\n\t");
__asm__("xor %dx, %dx\n\t"); // 0xffffffffffff0000
}