xref: /dragonfly/lib/libc/x86_64/string/bcmp.S (revision 0ca59c34)
1/*
2 * $NetBSD: bcmp.S,v 1.1 2001/06/19 00:25:04 fvdl Exp $
3 * $FreeBSD: src/lib/libc/amd64/string/bcmp.S,v 1.3 2008/11/02 01:10:54 peter Exp $
4 */
5
6#include <machine/asm.h>
7
8ENTRY(bcmp)
9	cld				/* set compare direction forward */
10
11	movq	%rdx,%rcx		/* compare by words */
12	shrq	$3,%rcx
13	repe
14	cmpsq
15	jne	L1
16
17	movq	%rdx,%rcx		/* compare remainder by bytes */
18	andq	$7,%rcx
19	repe
20	cmpsb
21L1:
22	setne	%al
23	movsbl	%al,%eax
24	ret
25END(bcmp)
26
27	.section .note.GNU-stack,"",%progbits
28