diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2013-06-11 20:05:54 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2013-06-11 20:05:54 +0000 |
commit | 5a52fb369243b6b2f1d8133d66d753c4117cf2b8 (patch) | |
tree | 9b69ae5ce65e29dc248dac095dc86fe40ad25809 /sys/lib/libkern/arch | |
parent | 87b7f5485d65e49681d5f9ad0c62b0961ede6540 (diff) |
Optimize memcpy(9) by always doing a forward copy; it should never be used
for overlapping copies. Attempt to be instruction cache friendly by turning
things around and make memcpy(9) use the forward copy branch of memmove(9),
and implement bcopy(9) by swapping its arguments and dropping into memmove(9).
Same change as the one just made to for hppa.
Diffstat (limited to 'sys/lib/libkern/arch')
-rw-r--r-- | sys/lib/libkern/arch/hppa64/bcopy.m4 | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/lib/libkern/arch/hppa64/bcopy.m4 b/sys/lib/libkern/arch/hppa64/bcopy.m4 index 977ece174c5..c2608e993d1 100644 --- a/sys/lib/libkern/arch/hppa64/bcopy.m4 +++ b/sys/lib/libkern/arch/hppa64/bcopy.m4 @@ -1,4 +1,4 @@ -define(_rcsid,``$OpenBSD: bcopy.m4,v 1.9 2011/11/27 21:02:10 kettenis Exp $'')dnl +define(_rcsid,``$OpenBSD: bcopy.m4,v 1.10 2013/06/11 20:05:53 kettenis Exp $'')dnl dnl dnl dnl This is the source file for bcopy.S, spcopy.S @@ -183,22 +183,22 @@ L($1, done) ' ifelse(NAME, `bcopy', ` -LEAF_ENTRY(memcpy) -ALTENTRY(memmove) +LEAF_ENTRY(bcopy) +ALTENTRY(ovbcopy) copy %arg0, %ret0 copy %arg1, %arg0 copy %ret0, %arg1 -ALTENTRY(ovbcopy) -ALTENTRY(bcopy) - cmpb,*>,n %arg1, %arg0, L(bcopy, reverse) - hppa_copy(bcopy_f, %sr0, %arg0, %sr0, %arg1, %arg2, `+') +ALTENTRY(memmove) + cmpb,*>,n %arg0, %arg1, L(bcopy, reverse) +ALTENTRY(memcpy) + hppa_copy(bcopy_f, %sr0, %arg1, %sr0, %arg0, %arg2, `+') bv %r0(%rp) nop L(bcopy, reverse) - hppa_copy(bcopy_r, %sr0, %arg0, %sr0, %arg1, %arg2, `-') + hppa_copy(bcopy_r, %sr0, %arg1, %sr0, %arg0, %arg2, `-') bv %r0(%rp) nop -EXIT(memcpy) +EXIT(bcopy) ')dnl dnl ifelse(NAME, `spcopy', |