xref: /netbsd-src/lib/libc/arch/hppa/string/bcmp.S (revision 2af01421ec58ee0b13f04872508d2ab824742d69)
1*2af01421Sskrll/*	$NetBSD: bcmp.S,v 1.3 2020/05/05 06:20:55 skrll Exp $	*/
202ac1ae2Sfredette
302ac1ae2Sfredette/*	$OpenBSD: bcmp.S,v 1.3 2001/06/04 23:14:02 mickey Exp $	*/
402ac1ae2Sfredette
502ac1ae2Sfredette/*
602ac1ae2Sfredette * Copyright 1996 1995 by Open Software Foundation, Inc.
702ac1ae2Sfredette *              All Rights Reserved
802ac1ae2Sfredette *
902ac1ae2Sfredette * Permission to use, copy, modify, and distribute this software and
1002ac1ae2Sfredette * its documentation for any purpose and without fee is hereby granted,
1102ac1ae2Sfredette * provided that the above copyright notice appears in all copies and
1202ac1ae2Sfredette * that both the copyright notice and this permission notice appear in
1302ac1ae2Sfredette * supporting documentation.
1402ac1ae2Sfredette *
1502ac1ae2Sfredette * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
1602ac1ae2Sfredette * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1702ac1ae2Sfredette * FOR A PARTICULAR PURPOSE.
1802ac1ae2Sfredette *
1902ac1ae2Sfredette * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
2002ac1ae2Sfredette * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2102ac1ae2Sfredette * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
2202ac1ae2Sfredette * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
2302ac1ae2Sfredette * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2402ac1ae2Sfredette */
2502ac1ae2Sfredette/*
2602ac1ae2Sfredette *  (c) Copyright 1988 HEWLETT-PACKARD COMPANY
2702ac1ae2Sfredette *
2802ac1ae2Sfredette *  To anyone who acknowledges that this file is provided "AS IS"
2902ac1ae2Sfredette *  without any express or implied warranty:
3002ac1ae2Sfredette *      permission to use, copy, modify, and distribute this file
3102ac1ae2Sfredette *  for any purpose is hereby granted without fee, provided that
3202ac1ae2Sfredette *  the above copyright notice and this notice appears in all
3302ac1ae2Sfredette *  copies, and that the name of Hewlett-Packard Company not be
3402ac1ae2Sfredette *  used in advertising or publicity pertaining to distribution
3502ac1ae2Sfredette *  of the software without specific, written prior permission.
3602ac1ae2Sfredette *  Hewlett-Packard Company makes no representations about the
3702ac1ae2Sfredette *  suitability of this software for any purpose.
3802ac1ae2Sfredette */
3902ac1ae2Sfredette/*
4002ac1ae2Sfredette * Copyright (c) 1990,1991,1994 The University of Utah and
4102ac1ae2Sfredette * the Computer Systems Laboratory (CSL).  All rights reserved.
4202ac1ae2Sfredette *
4302ac1ae2Sfredette * THE UNIVERSITY OF UTAH AND CSL PROVIDE THIS SOFTWARE IN ITS "AS IS"
4402ac1ae2Sfredette * CONDITION, AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
4502ac1ae2Sfredette * WHATSOEVER RESULTING FROM ITS USE.
4602ac1ae2Sfredette *
4702ac1ae2Sfredette * CSL requests users of this software to return to csl-dist@cs.utah.edu any
4802ac1ae2Sfredette * improvements that they make and grant CSL redistribution rights.
4902ac1ae2Sfredette *
5002ac1ae2Sfredette * 	Utah Hdr: movc.s 1.26 94/12/14
5102ac1ae2Sfredette */
5202ac1ae2Sfredette
5302ac1ae2Sfredette#include <machine/asm.h>
5402ac1ae2Sfredette
5502ac1ae2Sfredette#ifdef SYSLIBC_SCCS
5602ac1ae2Sfredette	.text
5702ac1ae2Sfredette	.asciz "$OpenBSD: bcmp.S,v 1.3 2001/06/04 23:14:02 mickey Exp $"
5802ac1ae2Sfredette	.align	4
5902ac1ae2Sfredette#endif
6002ac1ae2Sfredette
6102ac1ae2Sfredette/*
6202ac1ae2Sfredette * int
6302ac1ae2Sfredette * bcmp(src, dst, count)
64ed9d4336Smatt *	vaddr_t	src;
65ed9d4336Smatt *	vaddr_t	dst;
66ed9d4336Smatt *	size_t	count;
6702ac1ae2Sfredette */
6802ac1ae2SfredetteLEAF_ENTRY(bcmp)
69ed9d4336Smatt        comb,>= %r0,%arg2,$bcmp_exit
70ed9d4336Smatt	copy	%t1,%t2
7102ac1ae2Sfredette
72ed9d4336Smatt$bcmp_loop:
73ed9d4336Smatt	ldbs,ma	1(%arg0),%t1
74ed9d4336Smatt	ldbs,ma	1(%arg1),%t2
75ed9d4336Smatt	comb,<>,n %t1,%t2,$bcmp_exit
76ed9d4336Smatt	addib,<> -1,%arg2,$bcmp_loop
7702ac1ae2Sfredette	 nop
7802ac1ae2Sfredette
79ed9d4336Smatt$bcmp_exit:
80ed9d4336Smatt	bv	0(%r2)
81ed9d4336Smatt	 sub	%t1,%t2,%ret0
8202ac1ae2Sfredette
8302ac1ae2SfredetteEXIT(bcmp)
8402ac1ae2Sfredette
85