| ▲ | defmacr0 10 hours ago |
| I would be surprised if modern CPUs didn't decode "xor eax, eax" into a set of micro-ops that simply moves from an externally invisible dedicated 0 register. These days the x86 ISA is more of an API contract than an actual representation of what the hardware internals do. |
|
| ▲ | defrost 10 hours ago | parent | next [-] |
| From TFA: The predominance of these idioms as a way to zero out a register led Intel to add special xor r, r-detection and sub r, r-detection in the instruction decoding front-end and rename the destination to an internal zero register, bypassing the execution of the instruction entirely. You can imagine that the instruction, in some sense, “takes zero cycles to execute”.
|
| |
| ▲ | rasz 7 hours ago | parent [-] | | "rename the destination to an internal zero register" That would be quite late then, 1997 Pentium 2 for general population. |
|
|
| ▲ | brigade 10 hours ago | parent | prev [-] |
| Zero micro ops to be precise, that’s handled entirely at the register rename stage with no data movement. |