3 ms·
> It turns out that xor eax, eax is assigned to opcode 0x90, which is better known to most people as NOP. This can't be true, since xoring a register with itse
by msla 8y ago
> It turns out that xor eax, eax is assigned to opcode 0x90, which is better known to most people as NOP.
This can't be true, since xoring a register with itself zeroes that register, and zeroing a register can't possibly be a general NOP instruction.
XOR also sets flags, another thing NOPs can't do.
- simcop2387 8y agoThat's because it's actually xchg eax, eax not xor eax, eax.
- CalChris 8y agoxor eax,eax is a zero (or dependency breaking) idiom. Zero idioms are detected and removed by the renamer. So they have no execution latency.