xref: /openbsd-src/sys/lib/libkern/arch/amd64/bcmp.S (revision 0b7734b3d77bb9b21afec6f4621cae6c805dbd45)
1#include <machine/asm.h>
2
3ENTRY(bcmp)
4	xorl	%eax,%eax		/* clear return value */
5
6	movq	%rdx,%rcx		/* compare by words */
7	shrq	$3,%rcx
8	repe
9	cmpsq
10	jne	L1
11
12	movq	%rdx,%rcx		/* compare remainder by bytes */
13	andq	$7,%rcx
14	repe
15	cmpsb
16	je	L2
17
18L1:	incl	%eax
19L2:	ret
20