DigiNews

Tech Watch by Johan Denoyer

← Back to articles

Sure, xor’ing a register with itself is the idiom for zeroing it out, but why not sub?

Quality: 9/10 Relevance: 7/10

Summary

The Old New Thing post explains why xor reg, reg is used to zero a register on x86, highlighting that it produces shorter code than mov reg, 0 and has distinct flag behavior. It discusses historical and vendor-driven reasons for xoring to zero, mentions Itanium's NaT behavior, and includes anecdotes about early compiler influence and cross-vendor differences in zeroing instructions.

🚀 Service construit par Johan Denoyer