Re: Ideas for reducing memory copying and zeroing times (fwd)

Tom May (tommay@eskimo.com)
Thu, 25 Apr 1996 08:57:39 -0700


Jamie Lokier <jamie@rebellion.co.uk> writes:

>Linus writes:
>
>> No, the fastest, and shortest way to do it is
>>
>> .. dest in %edi ..
>> movl $1024,%ecx
>> xorl %eax,%eax
>> rep; stosl
>
>According to a 486 book nearby, `rep stosl' takes 5 cycles per write, if
>the memory is fast enough to keep up.

Look it up under "rep", not "stosd". The 486 book says it takes 4
cycles when used with rep. Compare that to "movsd" which takes only
three (go figure). Makes me think it would be interesting (but
possibly not useful) to do timings on something like this:

movl %edi,%esi
addl $4,%edi
xorl %eax,%eax
movl $1020,%ecx
movl %eax,(%esi)
rep; movsl

which is how we had to do it way back when on the Z80.

Tom.