xref: /csrg-svn/lib/libc/mips/string/rindex.s (revision 61146)
152718Sbostic/*-
2*61146Sbostic * Copyright (c) 1991, 1993
3*61146Sbostic *	The Regents of the University of California.  All rights reserved.
452718Sbostic *
552718Sbostic * This code is derived from software contributed to Berkeley by
652718Sbostic * Ralph Campbell.
752718Sbostic *
852718Sbostic * %sccs.include.redist.c%
952718Sbostic */
1052718Sbostic
1155708Sralph#include <machine/machAsmDefs.h>
1252737Sbostic
1352718Sbostic#if defined(LIBC_SCCS) && !defined(lint)
14*61146Sbostic	ASMSTR("@(#)rindex.s	8.1 (Berkeley) 06/04/93")
1552718Sbostic#endif /* LIBC_SCCS and not lint */
1652718Sbostic
1752718SbosticLEAF(rindex)
1852718Sbostic	move	v0, zero		# default if not found
1952718Sbostic1:
2052718Sbostic	lbu	a3, 0(a0)		# get a byte
2152718Sbostic	addu	a0, a0, 1
2252718Sbostic	bne	a3, a1, 2f
2352718Sbostic	subu	v0, a0, 1		# save address of last match
2452718Sbostic2:
2552718Sbostic	bne	a3, zero, 1b		# continue if not end
2652718Sbostic	j	ra
2752718SbosticEND(rindex)
28