Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libkern/arch/m68k Sync with libc strncpy.S 1.11: opt...



details:   https://anonhg.NetBSD.org/src/rev/7839428a7f19
branches:  trunk
changeset: 499731:7839428a7f19
user:      is <is%NetBSD.org@localhost>
date:      Mon Nov 27 22:38:33 2000 +0000

description:
Sync with libc strncpy.S 1.11: optimized code by Hiroshi Horimoto.

diffstat:

 sys/lib/libkern/arch/m68k/strncpy.S |  23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diffs (50 lines):

diff -r bbfa52677467 -r 7839428a7f19 sys/lib/libkern/arch/m68k/strncpy.S
--- a/sys/lib/libkern/arch/m68k/strncpy.S       Mon Nov 27 22:35:30 2000 +0000
+++ b/sys/lib/libkern/arch/m68k/strncpy.S       Mon Nov 27 22:38:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strncpy.S,v 1.5 1999/11/11 01:32:14 thorpej Exp $      */
+/*     $NetBSD: strncpy.S,v 1.6 2000/11/27 22:38:33 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.5 1999/11/11 01:32:14 thorpej Exp $")
+       RCSID("$NetBSD: strncpy.S,v 1.6 2000/11/27 22:38:33 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