summaryrefslogtreecommitdiffstats
path: root/sys/lib/libkern/arch
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2013-06-11 18:13:38 +0000
committerkettenis <kettenis@openbsd.org>2013-06-11 18:13:38 +0000
commit4de1a47a534449ce30838a9714c4b07eea117738 (patch)
treeb4e354992a53bfe6df6437af27f6a98da1b3f12a /sys/lib/libkern/arch
parentportable memmove(), for if an architecture lacks a custom optimized (diff)
downloadwireguard-openbsd-4de1a47a534449ce30838a9714c4b07eea117738.tar.xz
wireguard-openbsd-4de1a47a534449ce30838a9714c4b07eea117738.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). ok deraadt@
Diffstat (limited to 'sys/lib/libkern/arch')
-rw-r--r--sys/lib/libkern/arch/hppa/bcopy.m418
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/lib/libkern/arch/hppa/bcopy.m4 b/sys/lib/libkern/arch/hppa/bcopy.m4
index 6eeeec0b326..c40df123d0b 100644
--- a/sys/lib/libkern/arch/hppa/bcopy.m4
+++ b/sys/lib/libkern/arch/hppa/bcopy.m4
@@ -1,4 +1,4 @@
-define(_rcsid,``$OpenBSD: bcopy.m4,v 1.19 2011/11/27 12:56:18 kettenis Exp $'')dnl
+define(_rcsid,``$OpenBSD: bcopy.m4,v 1.20 2013/06/11 18:13:38 kettenis Exp $'')dnl
dnl
dnl
dnl This is the source file for bcopy.S, spcopy.S
@@ -194,22 +194,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)
- comb,>,n arg1, arg0, L(bcopy, reverse)
- hppa_copy(bcopy_f, sr0, arg0, sr0, arg1, arg2, `+')
+ALTENTRY(memmove)
+ comb,>,n arg0, arg1, L(bcopy, reverse)
+ALTENTRY(memcpy)
+ hppa_copy(bcopy_f, sr0, arg1, sr0, arg0, arg2, `+')
bv 0(rp)
nop
L(bcopy, reverse)
- hppa_copy(bcopy_r, sr0, arg0, sr0, arg1, arg2, `-')
+ hppa_copy(bcopy_r, sr0, arg1, sr0, arg0, arg2, `-')
bv 0(rp)
nop
-EXIT(memcpy)
+EXIT(bcopy)
')dnl
dnl
ifelse(NAME, `spcopy',