I'm not the most experienced build programmer, and I came across the instructions "cqo", "cdq" and "cwd", which are all valid for building x86_64.
I was wondering if there are advantages to using cdq or cwd when working with lower values. Is there a difference in performance?
EDIT: Initially, I began to study this when calculating the absolute value for single-digit numbers.
For example, if we have a value of -9 in al:
cwd
xor al,dl
sub al,dl
vs. Having it as a 32-bit value and computing
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 from -9 to 9, then they all look the same.