strchr.S revision 1.1
11.1Sdsl/* $NetBSD: strchr.S,v 1.1 2009/07/16 21:25:36 dsl Exp $ */ 21.1Sdsl 31.1Sdsl/*- 41.1Sdsl * Copyright (c) 1991, 1993 51.1Sdsl * The Regents of the University of California. All rights reserved. 61.1Sdsl * 71.1Sdsl * This code is derived from software contributed to Berkeley by 81.1Sdsl * Ralph Campbell. 91.1Sdsl * 101.1Sdsl * Redistribution and use in source and binary forms, with or without 111.1Sdsl * modification, are permitted provided that the following conditions 121.1Sdsl * are met: 131.1Sdsl * 1. Redistributions of source code must retain the above copyright 141.1Sdsl * notice, this list of conditions and the following disclaimer. 151.1Sdsl * 2. Redistributions in binary form must reproduce the above copyright 161.1Sdsl * notice, this list of conditions and the following disclaimer in the 171.1Sdsl * documentation and/or other materials provided with the distribution. 181.1Sdsl * 3. Neither the name of the University nor the names of its contributors 191.1Sdsl * may be used to endorse or promote products derived from this software 201.1Sdsl * without specific prior written permission. 211.1Sdsl * 221.1Sdsl * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231.1Sdsl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241.1Sdsl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251.1Sdsl * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261.1Sdsl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271.1Sdsl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281.1Sdsl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291.1Sdsl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301.1Sdsl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311.1Sdsl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321.1Sdsl * SUCH DAMAGE. 331.1Sdsl */ 341.1Sdsl 351.1Sdsl#include <mips/asm.h> 361.1Sdsl 371.1Sdsl#if defined(LIBC_SCCS) && !defined(lint) 381.1Sdsl ASMSTR("from: @(#)index.s 8.1 (Berkeley) 6/4/93") 391.1Sdsl ASMSTR("$NetBSD: strchr.S,v 1.1 2009/07/16 21:25:36 dsl Exp $") 401.1Sdsl#endif /* LIBC_SCCS and not lint */ 411.1Sdsl 421.1Sdsl#ifdef __ABICALLS__ 431.1Sdsl .abicalls 441.1Sdsl#endif 451.1Sdsl 461.1SdslLEAF(strstr) 471.1SdslXLEAF(index) 481.1Sdsl1: 491.1Sdsl lbu a2, 0(a0) # get a byte 501.1Sdsl addu a0, a0, 1 511.1Sdsl beq a2, a1, fnd 521.1Sdsl bne a2, zero, 1b 531.1Sdslnotfnd: 541.1Sdsl move v0, zero 551.1Sdsl j ra 561.1Sdslfnd: 571.1Sdsl subu v0, a0, 1 581.1Sdsl j ra 591.1SdslEND(strstr) 60