summaryrefslogtreecommitdiff
path: root/sys/lib/libkern/arch/hppa/bcopy.m4
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-06-11 18:13:39 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-06-11 18:13:39 +0000
commit054b6110aa053cb779cfb42731aa959e581f1eca (patch)
tree91ea1879708adad7663d71b6e2cee2baf31fc408 /sys/lib/libkern/arch/hppa/bcopy.m4
parentfd64effcde8f3a8d6f04f8a84a5f2e86f03b20f8 (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). ok deraadt@
Diffstat (limited to 'sys/lib/libkern/arch/hppa/bcopy.m4')
-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',