Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/arch/sparc64/string now live in common/lib/libc/arc...
details: https://anonhg.NetBSD.org/src/rev/17bd40de4abd
branches: trunk
changeset: 785501:17bd40de4abd
user: christos <christos%NetBSD.org@localhost>
date: Sun Mar 17 00:43:45 2013 +0000
description:
now live in common/lib/libc/arch/sparc64/string
diffstat:
lib/libc/arch/sparc64/string/memcpy.S | 1963 ---------------------------------
lib/libc/arch/sparc64/string/memset.S | 196 ---
2 files changed, 0 insertions(+), 2159 deletions(-)
diffs (truncated from 2167 to 300 lines):
diff -r 40594510ec17 -r 17bd40de4abd lib/libc/arch/sparc64/string/memcpy.S
--- a/lib/libc/arch/sparc64/string/memcpy.S Sun Mar 17 00:42:31 2013 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1963 +0,0 @@
-/* $NetBSD: memcpy.S,v 1.5 2011/07/12 07:51:33 mrg Exp $ */
-
-/*
- * Copyright (c) 2001 Eduardo E. Horvath
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * 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 by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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>
-#ifndef _LOCORE
-#define _LOCORE
-#endif
-#include <machine/ctlreg.h>
-#include <machine/frame.h>
-#include <machine/psl.h>
-
-#if defined(LIBC_SCCS) && !defined(lint)
- RCSID("$NetBSD: memcpy.S,v 1.5 2011/07/12 07:51:33 mrg Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-#define EMPTY nop
-#define NOTREACHED ta 1
-
-#define BCOPY_SMALL 16
-#define BLOCK_SIZE SPARC64_BLOCK_SIZE
-#define BLOCK_ALIGN SPARC64_BLOCK_ALIGN
-
-#if 0
-#define ASI_STORE ASI_BLK_COMMIT_P
-#else
-#define ASI_STORE ASI_BLK_P
-#endif
-
-#ifndef _ALIGN
-#define _ALIGN .align 8
-#endif
-
-#if 1
-/*
- * kernel bcopy/memcpy
- * Assumes regions do not overlap; has no useful return value.
- *
- * Must not use %g7 (see copyin/copyout above).
- */
-ENTRY(memcpy) /* dest, src, size */
- /*
- * Swap args for bcopy. Gcc generates calls to memcpy for
- * structure assignments.
- */
- mov %o0, %o3
- mov %o1, %o0
- mov %o3, %o1
-#endif
-ENTRY(bcopy) /* src, dest, size */
-#ifdef DEBUG
- set pmapdebug, %o4
- ld [%o4], %o4
- btst 0x80, %o4 ! PDB_COPY
- bz,pt %icc, 3f
- nop
- save %sp, -CC64FSZ, %sp
- mov %i0, %o1
- set 2f, %o0
- mov %i1, %o2
- call printf
- mov %i2, %o3
-! ta 1; nop
- restore
- .data
-2: .asciz "bcopy(%p->%p,%x)\n"
- _ALIGN
- .text
-3:
-#endif
- /*
- * Check for overlaps and punt.
- *
- * If src <= dest <= src+len we have a problem.
- */
-
- sub %o1, %o0, %o3
-
- cmp %o3, %o2
- blu,pn %xcc, Lovbcopy
- cmp %o2, BCOPY_SMALL
-Lbcopy_start:
- bge,pt %xcc, 2f ! if >= this many, go be fancy.
- cmp %o2, 256
-
- mov %o1, %o5 ! Save memcpy return value
- /*
- * Not much to copy, just do it a byte at a time.
- */
- deccc %o2 ! while (--len >= 0)
- bl 1f
- EMPTY
-0:
- inc %o0
- ldsb [%o0 - 1], %o4 ! (++dst)[-1] = *src++;
- stb %o4, [%o1]
- deccc %o2
- bge 0b
- inc %o1
-1:
- retl
- mov %o5, %o0
- NOTREACHED
-
- /*
- * Overlapping bcopies -- punt.
- */
-Lovbcopy:
-
- /*
- * Since src comes before dst, and the regions might overlap,
- * we have to do the copy starting at the end and working backwards.
- *
- * We could optimize this, but it almost never happens.
- */
- mov %o1, %o5 ! Retval
- add %o2, %o0, %o0 ! src += len
- add %o2, %o1, %o1 ! dst += len
-
- deccc %o2
- bl,pn %xcc, 1f
- dec %o0
-0:
- dec %o1
- ldsb [%o0], %o4
- dec %o0
-
- deccc %o2
- bge,pt %xcc, 0b
- stb %o4, [%o1]
-1:
- retl
- mov %o5, %o0
-
- /*
- * Plenty of data to copy, so try to do it optimally.
- */
-2:
-#if 1
- ! If it is big enough, use VIS instructions
- bge Lbcopy_block
- nop
-#endif
-Lbcopy_fancy:
-
- !!
- !! First align the output to a 8-byte entity
- !!
-
- save %sp, -CC64FSZ, %sp
-
- mov %i0, %o0
- mov %i1, %o1
-
- mov %i2, %o2
- btst 1, %o1
-
- bz,pt %icc, 4f
- btst 2, %o1
- ldub [%o0], %o4 ! Load 1st byte
-
- deccc 1, %o2
- ble,pn %xcc, Lbcopy_finish ! XXXX
- inc 1, %o0
-
- stb %o4, [%o1] ! Store 1st byte
- inc 1, %o1 ! Update address
- btst 2, %o1
-4:
- bz,pt %icc, 4f
-
- btst 1, %o0
- bz,a 1f
- lduh [%o0], %o4 ! Load short
-
- ldub [%o0], %o4 ! Load bytes
-
- ldub [%o0+1], %o3
- sllx %o4, 8, %o4
- or %o3, %o4, %o4
-
-1:
- deccc 2, %o2
- ble,pn %xcc, Lbcopy_finish ! XXXX
- inc 2, %o0
- sth %o4, [%o1] ! Store 1st short
-
- inc 2, %o1
-4:
- btst 4, %o1
- bz,pt %xcc, 4f
-
- btst 3, %o0
- bz,a,pt %xcc, 1f
- lduw [%o0], %o4 ! Load word -1
-
- btst 1, %o0
- bz,a,pt %icc, 2f
- lduh [%o0], %o4
-
- ldub [%o0], %o4
-
- lduh [%o0+1], %o3
- sllx %o4, 16, %o4
- or %o4, %o3, %o4
-
- ldub [%o0+3], %o3
- sllx %o4, 8, %o4
- ba,pt %icc, 1f
- or %o4, %o3, %o4
-
-2:
- lduh [%o0+2], %o3
- sllx %o4, 16, %o4
- or %o4, %o3, %o4
-
-1:
- deccc 4, %o2
- ble,pn %xcc, Lbcopy_finish ! XXXX
- inc 4, %o0
-
- st %o4, [%o1] ! Store word
- inc 4, %o1
-4:
- !!
- !! We are now 32-bit aligned in the dest.
- !!
-Lbcopy__common:
-
- and %o0, 7, %o4 ! Shift amount
- andn %o0, 7, %o0 ! Source addr
-
- brz,pt %o4, Lbcopy_noshift8 ! No shift version...
-
- sllx %o4, 3, %o4 ! In bits
- mov 8<<3, %o3
-
- ldx [%o0], %l0 ! Load word -1
- sub %o3, %o4, %o3 ! Reverse shift
- deccc 16*8, %o2 ! Have enough room?
-
- sllx %l0, %o4, %l0
- bl,pn %xcc, 2f
- and %o3, 0x38, %o3
-Lbcopy_unrolled8:
-
- /*
- * This is about as close to optimal as you can get, since
- * the shifts require EU0 and cannot be paired, and you have
- * 3 dependent operations on the data.
- */
-
-! ldx [%o0+0*8], %l0 ! Already done
-! sllx %l0, %o4, %l0 ! Already done
- ldx [%o0+1*8], %l1
- ldx [%o0+2*8], %l2
- ldx [%o0+3*8], %l3
- ldx [%o0+4*8], %l4
- ldx [%o0+5*8], %l5
- ldx [%o0+6*8], %l6
-#if 1
Home |
Main Index |
Thread Index |
Old Index