xref: /minix/lib/libc/arch/i386/string/bcmp.S (revision 0a6a1f1d)
1/*
2 * Written by J.T. Conklin <jtc@NetBSD.org>.
3 * Public domain.
4 */
5
6#include <machine/asm.h>
7
8#if defined(LIBC_SCCS)
9	RCSID("$NetBSD: bcmp.S,v 1.10 2014/05/23 02:34:19 uebayasi Exp $")
10#endif
11
12ENTRY(bcmp)
13	pushl	%edi
14	pushl	%esi
15	movl	12(%esp),%edi
16	movl	16(%esp),%esi
17	xorl	%eax,%eax		/* clear return value */
18
19	movl	20(%esp),%ecx		/* compare by words */
20	shrl	$2,%ecx
21	repe
22	cmpsl
23	jne	L1
24
25	movl	20(%esp),%ecx		/* compare remainder by bytes */
26	andl	$3,%ecx
27	repe
28	cmpsb
29	je	L2
30
31L1:	incl	%eax
32L2:	popl	%esi
33	popl	%edi
34	ret
35END(bcmp)
36