152719Sbostic/*- 2*61146Sbostic * Copyright (c) 1991, 1993 3*61146Sbostic * The Regents of the University of California. All rights reserved. 452719Sbostic * 552719Sbostic * This code is derived from software contributed to Berkeley by 652719Sbostic * Ralph Campbell. 752719Sbostic * 852719Sbostic * %sccs.include.redist.c% 952719Sbostic */ 1052719Sbostic 1155708Sralph#include <machine/machAsmDefs.h> 1252737Sbostic 1352719Sbostic#if defined(LIBC_SCCS) && !defined(lint) 14*61146Sbostic ASMSTR("@(#)strcmp.s 8.1 (Berkeley) 06/04/93") 1552719Sbostic#endif /* LIBC_SCCS and not lint */ 1652719Sbostic 1752719Sbostic/* 1852719Sbostic * NOTE: this version assumes unsigned chars in order to be "8 bit clean". 1952719Sbostic */ 2052719SbosticLEAF(strcmp) 2152719Sbostic1: 2252719Sbostic lbu t0, 0(a0) # get two bytes and compare them 2352719Sbostic lbu t1, 0(a1) 2452719Sbostic beq t0, zero, LessOrEq # end of first string? 2552719Sbostic bne t0, t1, NotEq 2652719Sbostic lbu t0, 1(a0) # unroll loop 2752719Sbostic lbu t1, 1(a1) 2852719Sbostic add a0, a0, 2 2952719Sbostic beq t0, zero, LessOrEq # end of first string? 3052719Sbostic add a1, a1, 2 3152719Sbostic beq t0, t1, 1b 3252719SbosticNotEq: 3352719Sbostic subu v0, t0, t1 3452719Sbostic j ra 3552719SbosticLessOrEq: 3652719Sbostic subu v0, zero, t1 3752719Sbostic j ra 3852719SbosticEND(strcmp) 39