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/sh5 Add native optimised assembler vers...



details:   https://anonhg.NetBSD.org/src/rev/9f72ccae7f52
branches:  trunk
changeset: 538319:9f72ccae7f52
user:      scw <scw%NetBSD.org@localhost>
date:      Thu Oct 17 11:53:32 2002 +0000

description:
Add native optimised assembler versions of some libkern routines.
The memcpy routine is courtesy of SuperH, with some tweaks by me.

XXX: There is room for further optimisation in some of these routines.

diffstat:

 sys/lib/libkern/arch/sh5/Makefile.inc  |   20 +-
 sys/lib/libkern/arch/sh5/imax.S        |   49 ++++++++
 sys/lib/libkern/arch/sh5/imin.S        |   49 ++++++++
 sys/lib/libkern/arch/sh5/lmax.S        |   51 ++++++++
 sys/lib/libkern/arch/sh5/lmin.S        |   51 ++++++++
 sys/lib/libkern/arch/sh5/max.S         |   49 ++++++++
 sys/lib/libkern/arch/sh5/memcpy.S      |  194 +++++++++++++++++++++++++++++++++
 sys/lib/libkern/arch/sh5/memset.S      |  170 ++++++++++++++++++++++++++++
 sys/lib/libkern/arch/sh5/min.S         |   49 ++++++++
 sys/lib/libkern/arch/sh5/random.S      |   98 ++++++++++++++++
 sys/lib/libkern/arch/sh5/scanc.S       |   62 ++++++++++
 sys/lib/libkern/arch/sh5/skpc.S        |   62 ++++++++++
 sys/lib/libkern/arch/sh5/strcasecmp.S  |  103 +++++++++++++++++
 sys/lib/libkern/arch/sh5/strcat.S      |   66 +++++++++++
 sys/lib/libkern/arch/sh5/strchr.S      |   62 ++++++++++
 sys/lib/libkern/arch/sh5/strcmp.S      |   64 ++++++++++
 sys/lib/libkern/arch/sh5/strcpy.S      |   60 ++++++++++
 sys/lib/libkern/arch/sh5/strlen.S      |   60 ++++++++++
 sys/lib/libkern/arch/sh5/strncasecmp.S |  107 ++++++++++++++++++
 sys/lib/libkern/arch/sh5/strncmp.S     |   68 +++++++++++
 sys/lib/libkern/arch/sh5/strncpy.S     |   67 +++++++++++
 sys/lib/libkern/arch/sh5/strrchr.S     |   63 ++++++++++
 sys/lib/libkern/arch/sh5/ulmax.S       |   51 ++++++++
 sys/lib/libkern/arch/sh5/ulmin.S       |   51 ++++++++
 24 files changed, 1716 insertions(+), 10 deletions(-)

diffs (truncated from 1826 to 300 lines):

diff -r 20f6c0118577 -r 9f72ccae7f52 sys/lib/libkern/arch/sh5/Makefile.inc
--- a/sys/lib/libkern/arch/sh5/Makefile.inc     Thu Oct 17 11:36:39 2002 +0000
+++ b/sys/lib/libkern/arch/sh5/Makefile.inc     Thu Oct 17 11:53:32 2002 +0000
@@ -1,14 +1,14 @@
-#      $NetBSD: Makefile.inc,v 1.2 2002/09/21 17:45:17 chs Exp $
+#      $NetBSD: Makefile.inc,v 1.3 2002/10/17 11:53:32 scw Exp $
 
 SRCS+= __assert.c __main.c \
-       ffs.c \
-       imax.c imin.c \
-       lmax.c lmin.c \
-       max.c memchr.c memcmp.c memcpy.c memmove.c memset.c min.c \
-       scanc.c skpc.c \
-       strcat.c strcmp.c strcpy.c strlen.c strcasecmp.c strncasecmp.c \
-       strncmp.c strncpy.c strtoul.c \
-       random.c \
-       ulmax.c ulmin.c \
+       imax.S imin.S \
+       lmax.S lmin.S \
+       max.S memchr.c memcmp.c memcpy.S memmove.c memset.S min.S \
+       scanc.S skpc.S \
+       strcat.S strchr.S strcmp.S strcpy.S strlen.S \
+       strncmp.S strncpy.S strrchr.S strtoul.c \
+       strcasecmp.S strncasecmp.S \
+       random.S \
+       ulmax.S ulmin.S \
        sdivsi3.S udivsi3.S
 
diff -r 20f6c0118577 -r 9f72ccae7f52 sys/lib/libkern/arch/sh5/imax.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libkern/arch/sh5/imax.S   Thu Oct 17 11:53:32 2002 +0000
@@ -0,0 +1,49 @@
+/*     $NetBSD: imax.S,v 1.1 2002/10/17 11:53:32 scw Exp $     */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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>
+
+/*
+ * int imax(int a, int b)
+ */
+ENTRY(imax)
+       ptabs/l r18, tr0
+       add.l   r2, r63, r2
+       add.l   r3, r63, r3
+       cmpgt   r3, r2, r0
+       cmvne   r0, r3, r2
+       blink   tr0, r63
diff -r 20f6c0118577 -r 9f72ccae7f52 sys/lib/libkern/arch/sh5/imin.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libkern/arch/sh5/imin.S   Thu Oct 17 11:53:32 2002 +0000
@@ -0,0 +1,49 @@
+/*     $NetBSD: imin.S,v 1.1 2002/10/17 11:53:32 scw Exp $     */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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>
+
+/*
+ * int imin(int a, int b)
+ */
+ENTRY(imin)
+       ptabs/l r18, tr0
+       add.l   r2, r63, r2
+       add.l   r3, r63, r3
+       cmpgt   r2, r3, r0
+       cmvne   r0, r3, r2
+       blink   tr0, r63
diff -r 20f6c0118577 -r 9f72ccae7f52 sys/lib/libkern/arch/sh5/lmax.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libkern/arch/sh5/lmax.S   Thu Oct 17 11:53:32 2002 +0000
@@ -0,0 +1,51 @@
+/*     $NetBSD: lmax.S,v 1.1 2002/10/17 11:53:32 scw Exp $     */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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>
+
+/*
+ * long lmax(long a, long b)
+ */
+ENTRY(lmax)
+       ptabs/l r18, tr0
+#ifndef _LP64
+       add.l   r2, r63, r2
+       add.l   r3, r63, r3
+#endif
+       cmpgt   r3, r2, r0
+       cmvne   r0, r3, r2
+       blink   tr0, r63
diff -r 20f6c0118577 -r 9f72ccae7f52 sys/lib/libkern/arch/sh5/lmin.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libkern/arch/sh5/lmin.S   Thu Oct 17 11:53:32 2002 +0000
@@ -0,0 +1,51 @@
+/*     $NetBSD: lmin.S,v 1.1 2002/10/17 11:53:32 scw Exp $     */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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>
+
+/*
+ * long lmin(long a, long b)
+ */
+ENTRY(lmin)
+       ptabs/l r18, tr0
+#ifndef _LP64
+       add.l   r2, r63, r2
+       add.l   r3, r63, r3
+#endif
+       cmpgt   r2, r3, r0
+       cmvne   r0, r3, r2
+       blink   tr0, r63
diff -r 20f6c0118577 -r 9f72ccae7f52 sys/lib/libkern/arch/sh5/max.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libkern/arch/sh5/max.S    Thu Oct 17 11:53:32 2002 +0000
@@ -0,0 +1,49 @@
+/*     $NetBSD: max.S,v 1.1 2002/10/17 11:53:32 scw Exp $      */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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>
+
+/*
+ * unsigned int max(usigned int a, unsigned int b)
+ */
+ENTRY(max)
+       ptabs/l r18, tr0
+       addz.l  r2, r63, r2
+       addz.l  r3, r63, r3
+       cmpgtu  r3, r2, r0
+       cmvne   r0, r3, r2
+       blink   tr0, r63
diff -r 20f6c0118577 -r 9f72ccae7f52 sys/lib/libkern/arch/sh5/memcpy.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libkern/arch/sh5/memcpy.S Thu Oct 17 11:53:32 2002 +0000



Home | Main Index | Thread Index | Old Index