summaryrefslogtreecommitdiffstats
path: root/sys/lib/libkern
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2013-06-11 20:05:53 +0000
committerkettenis <kettenis@openbsd.org>2013-06-11 20:05:53 +0000
commitf9e6fe1103bcaa3b45f1547ee2759c976945fbad (patch)
tree092390594bc8be4cf22196eae70d9eb93fc27750 /sys/lib/libkern
parentTurn the allocation of GEM objects upside down and make the driver (diff)
downloadwireguard-openbsd-f9e6fe1103bcaa3b45f1547ee2759c976945fbad.tar.xz
wireguard-openbsd-f9e6fe1103bcaa3b45f1547ee2759c976945fbad.zip
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')
-rw-r--r--sys/lib/libkern/arch/hppa64/bcopy.m418
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',