Re:XOR'ing a register with itself is the idiom for zeroing i...
by flohofwoe on Wednesday April 22, 2026 @04:06AM
(#47860551)
Some CPUs have a special register hardwired to zero, so that would basically give you the special `mov r,0` instruction (except that '0' wouldn't be an immediate value, but the special zero-register).
> the processors started short-circuiting xor <register>,<register> much later.
There is no "short-circuiting", it's a regular ALU instruction like all the others. E.g. the "use xor to zero register" does not have require any special case handling, it's just as fast or slow as other ALU instructions (with the exception of mul/div of course).
> the processors started short-circuiting xor <register>,<register> much later.
There is no "short-circuiting", it's a regular ALU instruction like all the others. E.g. the "use xor to zero register" does not have require any special case handling, it's just as fast or slow as other ALU instructions (with the exception of mul/div of course).