Alana Radesch
February 1st, 2005, 01:02 PM
I have assembly routine in my code where main loop for function is:
label: mov ecx,[esi+ebx]
adc [edi+ebx],ecx
lea ebx,[ebx+4]
dec eax
jnz label
Timing (with 'rdtsc') showed this loop running at 10,5 cycles per loop.
This is running slower than reference code in C++ (optimized speed) running at 6.6 cycles per loop. This C++ code is 15 instructions per loop (3 times as much as asm loop) ???
My calculations say this asm loop should run at 4.4 cycles per loop. but it is not. it is 10.5.
If I change ADC to ADD, loop indeed takes 4.4cycles. Why is ADC so slow ? It should be same speed as ADD no ?
label: mov ecx,[esi+ebx]
adc [edi+ebx],ecx
lea ebx,[ebx+4]
dec eax
jnz label
Timing (with 'rdtsc') showed this loop running at 10,5 cycles per loop.
This is running slower than reference code in C++ (optimized speed) running at 6.6 cycles per loop. This C++ code is 15 instructions per loop (3 times as much as asm loop) ???
My calculations say this asm loop should run at 4.4 cycles per loop. but it is not. it is 10.5.
If I change ADC to ADD, loop indeed takes 4.4cycles. Why is ADC so slow ? It should be same speed as ADD no ?