Re: No difference on my machine




Nathan and Frank in discussion about:

[Comparing 'xor eax, eax' with 'mov eax, 0' from the CLAX thread:]

Good one, Nathan! No difference on my P4, that I can notice. Replacing
"dec" with "sub" gives a big speedup, though...

Just tried with "sub" and it took a second longer in all but one run.

There shouldn't be a difference on any x86 except that xor eax,eax
is shorter and this will affect the code alignment after it.
So a replacment may sometimes (like the example in CLAX) slow down.

I cannot confirm that add/sub-1 is any faster than inc/dec on AMDs.
It again is of different size and may therefore affect timing like above.

__
wolfgang



.



Relevant Pages

  • Re: Clever ways to hide a compare
    ... > | Examples to compare AX with DX on an x86: ... OR and XOR will always clear the Carry-flag on my x86 CPUs. ... look they should, especially the NEG opcode. ...
    (comp.lang.asm.x86)
  • Re: No difference on my machine
    ... is shorter and this will affect the code alignment after it. ... So a replacment may sometimes (like the example in CLAX) slow down ...
    (alt.lang.asm)
  • Re: No difference on my machine
    ... is shorter and this will affect the code alignment after it. ... So a replacment may sometimes (like the example in CLAX) slow down ...
    (alt.lang.asm)
  • Re: Set a register to 0
    ... > xor bx,bx is coded one byte shorter... ... > register, there's no dependency on most processors for the xor ...
    (comp.lang.asm.x86)
  • Re: Set a register to 0
    ... > xor bx,bx is coded one byte shorter... ... > register, there's no dependency on most processors for the xor ...
    (alt.lang.asm)