NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

memove performance of NetBSD



Hi ,
I am using NetBSD 3.1 ,I have some issues with the performance of memmove().

The memmove() implementation in NetBSD has the following algorithm
<1> If the source is aligned then copy 8*4 bytes at a time to destination
<2> If the source is unaligned then the copy is done byte by byte

The code snippet for <2> is as below

<bcopy.S>

:
76         /*
177          *      Copy from unaligned source to aligned dest.
178          */
179 5:      # destaligned
180         andi    t0,SIZEREG,3            # t0 = bytecount mod 4
181         subu    a3,SIZEREG,t0           # number of words to transfer
182         beq     a3,zero,3b
183         nop
184         move    SIZEREG,t0              # this many to do after we are done
185         addu    a3,SRCREG,a3            # stop point
186
187 1:
188         LWHI    t3,0(SRCREG)
189         LWLO    t3,3(SRCREG)
190         addi    SRCREG,4
191         sw      t3,0(DSTREG)
192         bne     SRCREG,a3,1b
193         addi    DSTREG,4
194
195         j       3b
196         nop

Due to which the performance of memmove() degrades when the source is unaligned.

I feel the algorithm could be changed as below:

<2> If the source is unaligned then copy the only some bytes of source
to destination so that source is at an aligned address, then copy 8*4
bytes at a time.

The above step could increase the performance of memmove() for
unaligned source address.

Please let me know your opinion on my views.

Thanks & Regards,
Channa


Home | Main Index | Thread Index | Old Index