diff options
author | Christopher Ferris <cferris@google.com> | 2013-07-16 17:22:05 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-07-16 17:22:05 -0700 |
commit | 7ff868a6307f0d5e63555b5d320b8ad6e490e3c4 (patch) | |
tree | 4865199359b0954103f6967d5f407e288faa5013 /libc/arch-arm | |
parent | b1d7fd4969fdd3d3402b500840561beb30962c1d (diff) | |
parent | f63c28f0338fd647e88f1f9300b2220093af1aae (diff) | |
download | bionic-7ff868a6307f0d5e63555b5d320b8ad6e490e3c4.zip bionic-7ff868a6307f0d5e63555b5d320b8ad6e490e3c4.tar.gz bionic-7ff868a6307f0d5e63555b5d320b8ad6e490e3c4.tar.bz2 |
am f63c28f0: Merge "Fix assembler errors in generic arm strlen.c."
* commit 'f63c28f0338fd647e88f1f9300b2220093af1aae':
Fix assembler errors in generic arm strlen.c.
Diffstat (limited to 'libc/arch-arm')
-rw-r--r-- | libc/arch-arm/generic/bionic/strlen.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libc/arch-arm/generic/bionic/strlen.c b/libc/arch-arm/generic/bionic/strlen.c index ca0669d..824cf78 100644 --- a/libc/arch-arm/generic/bionic/strlen.c +++ b/libc/arch-arm/generic/bionic/strlen.c @@ -33,16 +33,16 @@ size_t strlen(const char *s) { __builtin_prefetch(s); __builtin_prefetch(s+32); - + union { const char *b; const uint32_t *w; uintptr_t i; } u; - + // these are some scratch variables for the asm code below uint32_t v, t; - + // initialize the string length to zero size_t l = 0; @@ -69,42 +69,50 @@ size_t strlen(const char *s) "sub %[t], %[v], %[mask], lsr #7\n" "and %[t], %[t], %[mask] \n" "bics %[t], %[t], %[v] \n" + "it eq \n" "ldreq %[v], [%[s]], #4 \n" #if !defined(__OPTIMIZE_SIZE__) "bne 1f \n" "sub %[t], %[v], %[mask], lsr #7\n" "and %[t], %[t], %[mask] \n" "bics %[t], %[t], %[v] \n" + "it eq \n" "ldreq %[v], [%[s]], #4 \n" "bne 1f \n" "sub %[t], %[v], %[mask], lsr #7\n" "and %[t], %[t], %[mask] \n" "bics %[t], %[t], %[v] \n" + "it eq \n" "ldreq %[v], [%[s]], #4 \n" "bne 1f \n" "sub %[t], %[v], %[mask], lsr #7\n" "and %[t], %[t], %[mask] \n" "bics %[t], %[t], %[v] \n" + "it eq \n" "ldreq %[v], [%[s]], #4 \n" "bne 1f \n" "sub %[t], %[v], %[mask], lsr #7\n" "and %[t], %[t], %[mask] \n" "bics %[t], %[t], %[v] \n" + "it eq \n" "ldreq %[v], [%[s]], #4 \n" "bne 1f \n" "sub %[t], %[v], %[mask], lsr #7\n" "and %[t], %[t], %[mask] \n" "bics %[t], %[t], %[v] \n" + "it eq \n" "ldreq %[v], [%[s]], #4 \n" "bne 1f \n" "sub %[t], %[v], %[mask], lsr #7\n" "and %[t], %[t], %[mask] \n" "bics %[t], %[t], %[v] \n" + "it eq \n" "ldreq %[v], [%[s]], #4 \n" "bne 1f \n" "sub %[t], %[v], %[mask], lsr #7\n" "and %[t], %[t], %[mask] \n" "bics %[t], %[t], %[v] \n" + "it eq \n" "ldreq %[v], [%[s]], #4 \n" #endif "beq 0b \n" @@ -117,13 +125,14 @@ size_t strlen(const char *s) "beq 2f \n" "add %[l], %[l], #1 \n" "tst %[v], #0xFF0000 \n" + "it ne \n" "addne %[l], %[l], #1 \n" "2: \n" : [l]"=&r"(l), [v]"=&r"(v), [t]"=&r"(t), [s]"=&r"(u.b) : "%[l]"(l), "%[s]"(u.b), [mask]"r"(0x80808080UL) : "cc" ); - + done: return l; } |