1999-06-07 00:20:46 +04:00
|
|
|
/* $NetBSD: strncmp.S,v 1.4 1999/06/06 20:20:46 matthias Exp $ */
|
1997-05-08 17:38:29 +04:00
|
|
|
|
1996-09-24 13:29:52 +04:00
|
|
|
/*
|
|
|
|
* Written by Matthias Pfaller, 1996
|
|
|
|
* Public domain.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <machine/asm.h>
|
|
|
|
|
|
|
|
#if defined(LIBC_SCCS)
|
1999-06-07 00:20:46 +04:00
|
|
|
RCSID("$NetBSD: strncmp.S,v 1.4 1999/06/06 20:20:46 matthias Exp $")
|
|
|
|
# if defined(STRCMP)
|
|
|
|
RCSID("$Masqueraded: as strcmp $")
|
|
|
|
# endif
|
1996-09-24 13:29:52 +04:00
|
|
|
#endif
|
|
|
|
|
1999-06-07 00:20:46 +04:00
|
|
|
#if defined(STRCMP)
|
|
|
|
/*
|
|
|
|
* int
|
|
|
|
* strcmp(const char *s1, const char *s2)
|
|
|
|
*/
|
|
|
|
KENTRY(strcmp, 8)
|
|
|
|
enter [r4],0
|
|
|
|
movd -1,r0
|
|
|
|
#else
|
1996-09-24 13:29:52 +04:00
|
|
|
/*
|
|
|
|
* int
|
|
|
|
* strncmp(const char *s1, const char *s2, size_t len)
|
|
|
|
*/
|
1998-04-04 02:58:08 +04:00
|
|
|
KENTRY(strncmp, 12)
|
1996-09-24 13:29:52 +04:00
|
|
|
enter [r4],0
|
|
|
|
movd B_ARG2,r0
|
|
|
|
cmpqd 0,r0
|
|
|
|
beq 1f
|
1999-06-07 00:20:46 +04:00
|
|
|
#endif
|
1996-09-24 13:29:52 +04:00
|
|
|
movd B_ARG0,r1
|
|
|
|
movd B_ARG1,r2
|
|
|
|
movqd 0,r4
|
|
|
|
cmpsb u
|
|
|
|
bfc 0f
|
|
|
|
cmpb 0(r1),0(r2)
|
|
|
|
0: movqd 0,r0
|
|
|
|
beq 1f
|
|
|
|
movqd -1,r0
|
|
|
|
blo 1f
|
|
|
|
movqd 1,r0
|
|
|
|
1: exit [r4]
|
1998-04-04 02:58:08 +04:00
|
|
|
ret ARGS
|