Mail Archives: djgpp/1999/02/12/10:02:24
Paul Derbyshire wrote:
>
> I notice gcc zeroes eax using
>
> xorl %eax, %eax
>
> rather than
>
> movl $0, %eax
>
> Is the xorl faster or more pipelinable or something? Seems
> counterintuitive. :-)
The xorl is a two byte instruction, the movl is a five
byte instruction. If they were the same speed then it
is likely that using the shorter instruction will
result in slightly faster overall execution because
(averaged over several instances) it will reduce the
number of cache misses.
On some CPU's they simply are the same speed (before
considering the cache miss issue). On other CPU's this
question has generated a lot of discussion in
comp.lang.asm.x86, and it seems likely that on some
CPU's under some conditions the movl would be faster.
(I am not certain of that). Check dejanews, if you
want to read all the discussion on that topic.
--
http://www.erols.com/johnfine/
http://www.geocities.com/SiliconValley/Peaks/8600/
- Raw text -