Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/arch/m68k/string Use dbeq loops, code submitted by ...
details: https://anonhg.NetBSD.org/src/rev/bbfa52677467
branches: trunk
changeset: 499730:bbfa52677467
user: is <is%NetBSD.org@localhost>
date: Mon Nov 27 22:35:30 2000 +0000
description:
Use dbeq loops, code submitted by Hiroshi Horimoto in PR 3223, integrated
and tested by Allen Briggs.
Needs 1/3 less time on 68030, 45% less time on 68040.
XXX On 68060, 1/2 less time for the padding part, but 40% more time on the
copy part. I've stared at the 68060 User Manual, but can't understand why;
must be some wierd (branch) cache interaction.
diffstat:
lib/libc/arch/m68k/string/strncpy.S | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diffs (50 lines):
diff -r daf8ceba23be -r bbfa52677467 lib/libc/arch/m68k/string/strncpy.S
--- a/lib/libc/arch/m68k/string/strncpy.S Mon Nov 27 22:29:26 2000 +0000
+++ b/lib/libc/arch/m68k/string/strncpy.S Mon Nov 27 22:35:30 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: strncpy.S,v 1.10 1999/10/25 23:48:16 thorpej Exp $ */
+/* $NetBSD: strncpy.S,v 1.11 2000/11/27 22:35:30 is Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -43,7 +43,7 @@
#if 0
RCSID("from: @(#)strncpy.s 5.1 (Berkeley) 5/12/90")
#else
- RCSID("$NetBSD: strncpy.S,v 1.10 1999/10/25 23:48:16 thorpej Exp $")
+ RCSID("$NetBSD: strncpy.S,v 1.11 2000/11/27 22:35:30 is Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
@@ -53,18 +53,25 @@
jeq Lscdone | nothing to do
movl %sp@(8),%a0 | a0 = fromaddr
movl %d0,%a1 | a1 = toaddr
+ subql #1,%d1
Lscloop:
movb %a0@+,%a1@+ | copy a byte
- jeq Lscploop | copied null, go pad if necessary
- subql #1,%d1 | adjust count
- jne Lscloop | more room, keep going
+ dbeq %d1,Lscloop | loop through low word of d1
+ jeq Lscpadding | copied null, padding if necessary
+ clrw %d1 | clear low word of d1
+ subql #1,%d1 | adjust count for long copies
+ jcc Lscloop | more room, keep going
Lscdone:
#ifdef __SVR4_ABI__
moveal %d0,%a0
#endif
rts
+
Lscploop:
- subql #1,%d1 | adjust count
- jeq Lscdone | no more room, all done
clrb %a1@+ | clear a byte
- jra Lscploop | keep going
+ dbra %d1,Lscploop | keep going
+ clrw %d1
+Lscpadding:
+ subql #1,%d1
+ jcc Lscploop
+ jra Lscdone
Home |
Main Index |
Thread Index |
Old Index