blob: 4a88f66e9bbf6ab93987baad6818769a858bd5d8 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/* $OpenBSD: bcmp.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */
2/*
3 * Written by J.T. Conklin <jtc@netbsd.org>.
4 * Public domain.
5 */
6
7#include <machine/asm.h>
8
9ENTRY(bcmp)
10 pushl %edi
11 pushl %esi
12 movl 12(%esp),%edi
13 movl 16(%esp),%esi
14 xorl %eax,%eax /* clear return value */
15 cld /* set compare direction forward */
16
17 movl 20(%esp),%ecx /* compare by words */
18 shrl $2,%ecx
19 repe
20 cmpsl
21 jne L1
22
23 movl 20(%esp),%ecx /* compare remainder by bytes */
24 andl $3,%ecx
25 repe
26 cmpsb
27 je L2
28
29L1: incl %eax
30L2: popl %esi
31 popl %edi
32 ret
Elliott Hughes67195002013-02-13 15:12:32 -080033END(bcmp)