URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 207 |
Rev 345 |
/*
|
/*
|
* ====================================================
|
* ====================================================
|
* Copyright (C) 1998, 2002, 2008 by Red Hat Inc. All rights reserved.
|
* Copyright (C) 1998, 2002, 2008 by Red Hat Inc. All rights reserved.
|
*
|
*
|
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
* is preserved.
|
* is preserved.
|
* ====================================================
|
* ====================================================
|
*/
|
*/
|
|
|
#include "i386mach.h"
|
#include "i386mach.h"
|
|
|
.global SYM (memchr)
|
.global SYM (memchr)
|
SOTYPE_FUNCTION(memchr)
|
SOTYPE_FUNCTION(memchr)
|
|
|
SYM (memchr):
|
SYM (memchr):
|
pushl ebp
|
pushl ebp
|
movl esp,ebp
|
movl esp,ebp
|
pushl edi
|
pushl edi
|
movzbl 12(ebp),eax
|
movzbl 12(ebp),eax
|
movl 16(ebp),ecx
|
movl 16(ebp),ecx
|
movl 8(ebp),edi
|
movl 8(ebp),edi
|
|
|
xorl edx,edx
|
xorl edx,edx
|
testl ecx,ecx
|
testl ecx,ecx
|
jz L20
|
jz L20
|
|
|
#ifdef __OPTIMIZE_SIZE__
|
#ifdef __OPTIMIZE_SIZE__
|
|
|
cld
|
cld
|
repnz
|
repnz
|
scasb
|
scasb
|
|
|
setnz dl
|
setnz dl
|
decl edi
|
decl edi
|
|
|
#else /* !__OPTIMIZE_SIZE__ */
|
#else /* !__OPTIMIZE_SIZE__ */
|
/* Do byte-wise checks until string is aligned. */
|
/* Do byte-wise checks until string is aligned. */
|
testl $3,edi
|
testl $3,edi
|
je L5
|
je L5
|
cmpb (edi),al
|
cmpb (edi),al
|
je L15
|
je L15
|
incl edi
|
incl edi
|
decl ecx
|
decl ecx
|
je L20
|
je L20
|
|
|
testl $3,edi
|
testl $3,edi
|
je L5
|
je L5
|
cmpb (edi),al
|
cmpb (edi),al
|
je L15
|
je L15
|
incl edi
|
incl edi
|
decl ecx
|
decl ecx
|
je L20
|
je L20
|
|
|
testl $3,edi
|
testl $3,edi
|
je L5
|
je L5
|
cmpb (edi),al
|
cmpb (edi),al
|
je L15
|
je L15
|
incl edi
|
incl edi
|
decl ecx
|
decl ecx
|
je L20
|
je L20
|
|
|
/* Create a mask, then check a word at a time. */
|
/* Create a mask, then check a word at a time. */
|
L5:
|
L5:
|
movb al,ah
|
movb al,ah
|
movl eax,edx
|
movl eax,edx
|
sall $16,edx
|
sall $16,edx
|
orl edx,eax
|
orl edx,eax
|
pushl ebx
|
pushl ebx
|
|
|
.p2align 4,,7
|
.p2align 4,,7
|
L8:
|
L8:
|
subl $4,ecx
|
subl $4,ecx
|
jc L9
|
jc L9
|
movl (edi),edx
|
movl (edi),edx
|
addl $4,edi
|
addl $4,edi
|
xorl eax,edx
|
xorl eax,edx
|
leal -16843009(edx),ebx
|
leal -16843009(edx),ebx
|
notl edx
|
notl edx
|
andl edx,ebx
|
andl edx,ebx
|
testl $-2139062144,ebx
|
testl $-2139062144,ebx
|
je L8
|
je L8
|
|
|
subl $4,edi
|
subl $4,edi
|
|
|
L9:
|
L9:
|
popl ebx
|
popl ebx
|
xorl edx,edx
|
xorl edx,edx
|
addl $4,ecx
|
addl $4,ecx
|
je L20
|
je L20
|
|
|
/* Final byte-wise checks. */
|
/* Final byte-wise checks. */
|
.p2align 4,,7
|
.p2align 4,,7
|
L10:
|
L10:
|
cmpb (edi),al
|
cmpb (edi),al
|
je L15
|
je L15
|
incl edi
|
incl edi
|
decl ecx
|
decl ecx
|
jne L10
|
jne L10
|
|
|
xorl edi,edi
|
xorl edi,edi
|
|
|
#endif /* !__OPTIMIZE_SIZE__ */
|
#endif /* !__OPTIMIZE_SIZE__ */
|
|
|
L15:
|
L15:
|
decl edx
|
decl edx
|
andl edi,edx
|
andl edi,edx
|
L20:
|
L20:
|
movl edx,eax
|
movl edx,eax
|
|
|
leal -4(ebp),esp
|
leal -4(ebp),esp
|
popl edi
|
popl edi
|
leave
|
leave
|
ret
|
ret
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.