12fe8fb19SBen Gras/* 22fe8fb19SBen Gras * Written by J.T. Conklin <jtc@NetBSD.org>. 32fe8fb19SBen Gras * Public domain. 42fe8fb19SBen Gras */ 5cbd276e4SArun Thomas 69a21d1a2SArun Thomas#include <machine/asm.h> 79a21d1a2SArun Thomas 82fe8fb19SBen Gras#if defined(LIBC_SCCS) 9*0a6a1f1dSLionel Sambuc RCSID("$NetBSD: bcmp.S,v 1.10 2014/05/23 02:34:19 uebayasi Exp $") 102fe8fb19SBen Gras#endif 112fe8fb19SBen Gras 129a21d1a2SArun ThomasENTRY(bcmp) 132fe8fb19SBen Gras pushl %edi 142fe8fb19SBen Gras pushl %esi 152fe8fb19SBen Gras movl 12(%esp),%edi 162fe8fb19SBen Gras movl 16(%esp),%esi 172fe8fb19SBen Gras xorl %eax,%eax /* clear return value */ 182fe8fb19SBen Gras 192fe8fb19SBen Gras movl 20(%esp),%ecx /* compare by words */ 202fe8fb19SBen Gras shrl $2,%ecx 212fe8fb19SBen Gras repe 222fe8fb19SBen Gras cmpsl 232fe8fb19SBen Gras jne L1 242fe8fb19SBen Gras 252fe8fb19SBen Gras movl 20(%esp),%ecx /* compare remainder by bytes */ 262fe8fb19SBen Gras andl $3,%ecx 272fe8fb19SBen Gras repe 282fe8fb19SBen Gras cmpsb 292fe8fb19SBen Gras je L2 302fe8fb19SBen Gras 312fe8fb19SBen GrasL1: incl %eax 322fe8fb19SBen GrasL2: popl %esi 332fe8fb19SBen Gras popl %edi 34cbd276e4SArun Thomas ret 35*0a6a1f1dSLionel SambucEND(bcmp) 36