AMD 250 Manuale Utente
Chapter 8
Integer Optimizations
169
Software Optimization Guide for AMD64 Processors
25112
Rev. 3.06
September 2005
8.4
Using XOR to Clear Integer Registers
Optimization
To clear an integer register to all zeros, use the XOR instruction to exclusive OR the register with
itself, as shown below.
itself, as shown below.
Rationale
AMD Athlon 64 and AMD Opteron processors are able to avoid the false read dependency on the
XOR instruction.
XOR instruction.
Examples
Acceptable
mov
reg, 0
Preferred
xor
reg, reg