bcmp.S revision 1.3 1 /* $NetBSD: bcmp.S,v 1.3 2020/05/05 06:20:55 skrll Exp $ */
2
3 /* $OpenBSD: bcmp.S,v 1.3 2001/06/04 23:14:02 mickey Exp $ */
4
5 /*
6 * Copyright 1996 1995 by Open Software Foundation, Inc.
7 * All Rights Reserved
8 *
9 * Permission to use, copy, modify, and distribute this software and
10 * its documentation for any purpose and without fee is hereby granted,
11 * provided that the above copyright notice appears in all copies and
12 * that both the copyright notice and this permission notice appear in
13 * supporting documentation.
14 *
15 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
17 * FOR A PARTICULAR PURPOSE.
18 *
19 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
22 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
23 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 */
25 /*
26 * (c) Copyright 1988 HEWLETT-PACKARD COMPANY
27 *
28 * To anyone who acknowledges that this file is provided "AS IS"
29 * without any express or implied warranty:
30 * permission to use, copy, modify, and distribute this file
31 * for any purpose is hereby granted without fee, provided that
32 * the above copyright notice and this notice appears in all
33 * copies, and that the name of Hewlett-Packard Company not be
34 * used in advertising or publicity pertaining to distribution
35 * of the software without specific, written prior permission.
36 * Hewlett-Packard Company makes no representations about the
37 * suitability of this software for any purpose.
38 */
39 /*
40 * Copyright (c) 1990,1991,1994 The University of Utah and
41 * the Computer Systems Laboratory (CSL). All rights reserved.
42 *
43 * THE UNIVERSITY OF UTAH AND CSL PROVIDE THIS SOFTWARE IN ITS "AS IS"
44 * CONDITION, AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
45 * WHATSOEVER RESULTING FROM ITS USE.
46 *
47 * CSL requests users of this software to return to csl-dist (at) cs.utah.edu any
48 * improvements that they make and grant CSL redistribution rights.
49 *
50 * Utah Hdr: movc.s 1.26 94/12/14
51 */
52
53 #include <machine/asm.h>
54
55 #ifdef SYSLIBC_SCCS
56 .text
57 .asciz "$OpenBSD: bcmp.S,v 1.3 2001/06/04 23:14:02 mickey Exp $"
58 .align 4
59 #endif
60
61 /*
62 * int
63 * bcmp(src, dst, count)
64 * vaddr_t src;
65 * vaddr_t dst;
66 * size_t count;
67 */
68 LEAF_ENTRY(bcmp)
69 comb,>= %r0,%arg2,$bcmp_exit
70 copy %t1,%t2
71
72 $bcmp_loop:
73 ldbs,ma 1(%arg0),%t1
74 ldbs,ma 1(%arg1),%t2
75 comb,<>,n %t1,%t2,$bcmp_exit
76 addib,<> -1,%arg2,$bcmp_loop
77 nop
78
79 $bcmp_exit:
80 bv 0(%r2)
81 sub %t1,%t2,%ret0
82
83 EXIT(bcmp)
84
85