6
strcmp (const char *s1, const char *s2)
8
asm (PRELOADSTR ("%0") : : "r" (s1));
9
asm (PRELOADSTR ("%0") : : "r" (s2));
11
#ifndef __OPTIMIZE_SIZE__
12
if (((long)s1 & 3) == ((long)s2 & 3))
16
/* Skip unaligned part. */
19
if (*s1 == '\0' || *s1 != *s2)
25
/* Load two constants:
26
lr = 0xfefefeff [ == ~(0x80808080 << 1) ]
36
add ip, ip, #0x8000\n\
37
add ip, ip, ip, lsl #16\n\
51
" PRELOADSTR("%1") "\n\
52
" PRELOADSTR("%2") "\n\
56
/* The following part could be done in a C loop as well, but it needs
57
to be assembler to save some cycles in the case where the optimized
58
loop above finds the strings to be equal. */
62
" PRELOADSTR("%1") "\n\
63
" PRELOADSTR("%2") "\n\
84
: "=r" (result), "=&r" (s1), "=&r" (s2)
86
: "lr", "ip", "r2", "r3", "cc");
91
while (*s1 != '\0' && *s1 == *s2)
93
asm (PRELOADSTR("%0") : : "r" (s1));
94
asm (PRELOADSTR("%0") : : "r" (s2));
99
return (*(unsigned char *) s1) - (*(unsigned char *) s2);