I'm not the most experienced assembly programmer, and I ran into the "cqo", "cdq" and "cwd" instructions, which are all valid x86_64 assembly.
I was wondering if there are any advantages of using cdq or cwd, when operating on smaller values. Is there is some difference in performance?
EDIT: Originally started looking into this, when calculating absolute value for one digit numbers.
For example if we have -9 value in al:
cwd
xor al,dl
sub al,dl
vs. Having it as a 32 bit value and calculating
cdq
xor eax,edx
sub eax,edx
or if we have a 64 bit value for -9
cqo
xor rax,rdx
sub rax,rdx
If the original value is 64 bits and consists of a value -9 to 9, effectively they all seem the same.