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/i386 Avoid redundant memory access.



details:   https://anonhg.NetBSD.org/src/rev/e01f191ae421
branches:  trunk
changeset: 533836:e01f191ae421
user:      kent <kent%NetBSD.org@localhost>
date:      Wed Jul 10 06:02:09 2002 +0000

description:
Avoid redundant memory access.

diffstat:

 sys/lib/libkern/arch/i386/bcopy.S |  20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diffs (62 lines):

diff -r e05ad1222004 -r e01f191ae421 sys/lib/libkern/arch/i386/bcopy.S
--- a/sys/lib/libkern/arch/i386/bcopy.S Wed Jul 10 06:01:51 2002 +0000
+++ b/sys/lib/libkern/arch/i386/bcopy.S Wed Jul 10 06:02:09 2002 +0000
@@ -36,7 +36,7 @@
 #include <machine/asm.h>
 
 #if defined(LIBC_SCCS)
-       RCSID("$NetBSD: bcopy.S,v 1.2 1998/02/22 08:14:57 mycroft Exp $")
+       RCSID("$NetBSD: bcopy.S,v 1.3 2002/07/10 06:02:09 kent Exp $")
 #endif
 
        /*
@@ -58,26 +58,25 @@
 #if defined(MEMCOPY) || defined(MEMMOVE)
        movl    12(%esp),%edi
        movl    16(%esp),%esi
+       movl    %edi,%eax       /* return value */
 #else
        movl    12(%esp),%esi
        movl    16(%esp),%edi
 #endif
        movl    20(%esp),%ecx
-       movl    %edi,%eax
-       subl    %esi,%eax
-       cmpl    %ecx,%eax       /* overlapping? */
+       movl    %edi,%edx
+       subl    %esi,%edx
+       cmpl    %ecx,%edx       /* overlapping? */
+       movl    %ecx,%edx
        jb      1f
        cld                     /* nope, copy forwards. */
        shrl    $2,%ecx         /* copy by words */
        rep
        movsl
-       movl    20(%esp),%ecx
+       movl    %edx,%ecx
        andl    $3,%ecx         /* any bytes left? */
        rep
        movsb
-#if defined(MEMCOPY) || defined(MEMMOVE)
-       movl    12(%esp),%eax
-#endif
        popl    %edi
        popl    %esi
        ret
@@ -90,15 +89,12 @@
        decl    %esi
        rep
        movsb
-       movl    20(%esp),%ecx   /* copy remainder by words */
+       movl    %edx,%ecx       /* copy remainder by words */
        shrl    $2,%ecx
        subl    $3,%esi
        subl    $3,%edi
        rep
        movsl
-#if defined(MEMCOPY) || defined(MEMMOVE)
-       movl    12(%esp),%eax
-#endif
        popl    %edi
        popl    %esi
        cld



Home | Main Index | Thread Index | Old Index