Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libc/arch x86 uses the C versions of bcmp() and m...



details:   https://anonhg.NetBSD.org/src/rev/162a0b0f8488
branches:  trunk
changeset: 744236:162a0b0f8488
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Jan 27 22:09:21 2020 +0000

description:
x86 uses the C versions of bcmp() and memcmp() now.

diffstat:

 common/lib/libc/arch/i386/string/memcmp.S   |  48 --------------------
 common/lib/libc/arch/x86_64/string/bcmp.S   |  67 -----------------------------
 common/lib/libc/arch/x86_64/string/memcmp.S |  40 -----------------
 3 files changed, 0 insertions(+), 155 deletions(-)

diffs (167 lines):

diff -r 480fff8a6cf8 -r 162a0b0f8488 common/lib/libc/arch/i386/string/memcmp.S
--- a/common/lib/libc/arch/i386/string/memcmp.S Mon Jan 27 22:08:08 2020 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc%NetBSD.org@localhost>.
- * Public domain.
- */
-
-#include <machine/asm.h>
-
-#if defined(LIBC_SCCS)
-       RCSID("$NetBSD: memcmp.S,v 1.3 2014/03/22 19:38:46 jakllsch Exp $")
-#endif
-
-ENTRY(memcmp)
-       pushl   %edi
-       pushl   %esi
-       movl    12(%esp),%edi
-       movl    16(%esp),%esi
-
-       movl    20(%esp),%ecx           /* compare by words */
-       shrl    $2,%ecx
-       repe
-       cmpsl
-       jne     L5                      /* do we match so far? */
-
-       movl    20(%esp),%ecx           /* compare remainder by bytes */
-       andl    $3,%ecx
-       repe
-       cmpsb
-       jne     L6                      /* do we match? */
-
-       xorl    %eax,%eax               /* we match, return zero        */
-       popl    %esi
-       popl    %edi
-       ret
-
-L5:    movl    $4,%ecx                 /* We know that one of the next */
-       subl    %ecx,%edi               /* four pairs of bytes do not   */
-       subl    %ecx,%esi               /* match.                       */
-       repe
-       cmpsb
-L6:    xorl    %eax,%eax               /* Perform unsigned comparison  */
-       movb    -1(%edi),%al
-       xorl    %edx,%edx
-       movb    -1(%esi),%dl
-       subl    %edx,%eax
-       popl    %esi
-       popl    %edi
-       ret
-END(memcmp)
diff -r 480fff8a6cf8 -r 162a0b0f8488 common/lib/libc/arch/x86_64/string/bcmp.S
--- a/common/lib/libc/arch/x86_64/string/bcmp.S Mon Jan 27 22:08:08 2020 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*     $NetBSD: bcmp.S,v 1.4 2020/01/15 10:56:49 ad Exp $      */
-
-/*-
- * Copyright (c) 2020 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Andrew Doran.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-
-#if defined(LIBC_SCCS)
-       RCSID("$NetBSD: bcmp.S,v 1.4 2020/01/15 10:56:49 ad Exp $")
-#endif
-
-ENTRY(bcmp)
-       movq    %rdx, %rcx      /* compare by longs, equality only */
-       shrq    $3, %rcx
-       jz      2f
-1:
-       movq    (%rdi), %rax
-       cmpq    %rax, (%rsi)
-       jne     5f
-       decq    %rcx
-       leaq    8(%rdi), %rdi
-       leaq    8(%rsi), %rsi
-       jnz     1b
-2:
-       andl    $7, %edx
-       jz      4f
-3:
-       movb    (%rdi), %al     /* compare by chars, equality only */
-       cmpb    %al, (%rsi)
-       jne     5f
-       decl    %edx
-       leaq    1(%rdi), %rdi
-       leaq    1(%rsi), %rsi
-       jnz     3b
-4:
-       xorl    %eax, %eax
-       ret
-5:
-       movl    $1, %eax
-       ret
-END(bcmp)
diff -r 480fff8a6cf8 -r 162a0b0f8488 common/lib/libc/arch/x86_64/string/memcmp.S
--- a/common/lib/libc/arch/x86_64/string/memcmp.S       Mon Jan 27 22:08:08 2020 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc%NetBSD.org@localhost>.
- * Public domain.
- * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl%wasabisystems.com@localhost>
- */
-
-#include <machine/asm.h>
-
-#if defined(LIBC_SCCS)
-       RCSID("$NetBSD: memcmp.S,v 1.5 2020/01/16 09:23:43 ad Exp $")
-#endif
-
-ENTRY(memcmp)
-       movq    %rdx,%rcx               /* compare by longs */
-       shrq    $3,%rcx
-       repe
-       cmpsq
-       jne     L5                      /* do we match so far? */
-
-       movq    %rdx,%rcx               /* compare remainder by bytes */
-       andq    $7,%rcx
-       repe
-       cmpsb
-       jne     L6                      /* do we match? */
-
-       xorl    %eax,%eax               /* we match, return zero        */
-       ret
-
-L5:    movl    $8,%ecx                 /* We know that one of the next */
-       subq    %rcx,%rdi               /* eight pairs of bytes do not  */
-       subq    %rcx,%rsi               /* match.                       */
-       repe
-       cmpsb
-L6:    xorl    %eax,%eax               /* Perform unsigned comparison  */
-       movb    -1(%rdi),%al
-       xorl    %edx,%edx
-       movb    -1(%rsi),%dl
-       subl    %edx,%eax
-       ret
-END(memcmp)



Home | Main Index | Thread Index | Old Index