summaryrefslogtreecommitdiffstats
path: root/newlib/libc/machine/arm/strlen.c
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2014-09-05 17:26:42 +0000
committerJeff Johnston <jjohnstn@redhat.com>2014-09-05 17:26:42 +0000
commitc8a01afd974007a09f64a1830056ed11d5ebeec8 (patch)
treef8af7d69f1de51ec860b4a0d14682c7c107f2bb9 /newlib/libc/machine/arm/strlen.c
parentbea3ef947a51f735d0cebb3099a5a34f44c1dd30 (diff)
downloadcygnal-c8a01afd974007a09f64a1830056ed11d5ebeec8.tar.gz
cygnal-c8a01afd974007a09f64a1830056ed11d5ebeec8.tar.bz2
cygnal-c8a01afd974007a09f64a1830056ed11d5ebeec8.zip
2014-09-05 Hale Wang <hale.wang@arm.com>
* libc/machine/arm/memchr.S: Clean up the wrapper. * libc/machine/arm/memcpy.S: Likewise. * libc/machine/arm/memchr-stub.c: Delete this redundant file. * libc/machine/arm/memcpy-stub.c: Likewise. * libc/machine/arm/strcmp.S: Add speed-preferred wrapper. * libc/machine/arm/strlen.S: Likewise. * libc/machine/arm/Makefile.am: Add dependencies. * libc/machine/arm/Makefile.in: Regenerated. * libc/machine/arm/configure.in: Add dependencies. * libc/machine/arm/configure: Regenerated.
Diffstat (limited to 'newlib/libc/machine/arm/strlen.c')
-rw-r--r--newlib/libc/machine/arm/strlen.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/newlib/libc/machine/arm/strlen.c b/newlib/libc/machine/arm/strlen.c
index b8de22994..7e59e755d 100644
--- a/newlib/libc/machine/arm/strlen.c
+++ b/newlib/libc/machine/arm/strlen.c
@@ -34,6 +34,24 @@
#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED) || \
(defined (__thumb__) && !defined (__thumb2__))
+# if !defined (PREFER_SIZE_OVER_SPEED) && !defined (__OPTIMIZE_SIZE__)
+/* Thumb1 only variant.
+ If speed is preferred, the strlen() function in ../../string/strlen.c
+ will be used.
+
+ Leave this field blank. So the strlen() is not defined, and this will
+ automatically pull in the default C definition of strlen() from
+ ../../string/strlen.c. No need to include this file explicitely.
+ The lib_a-strlen.o will not be generated, so it won't replace the default
+ lib_a-strlen.o which is generated by ../../string/strlen.c. See the
+ commands in configure.in and Makefile.am for more details.
+
+ However, if we need to rewrite this function to be more efficient,
+ we can add the corresponding assembly code into this field and change
+ the commands in configure.in and Makefile.am to allow the corresponding
+ lib_a-strlen.o to be generated.
+*/
+# else
size_t
strlen (const char* str)
{
@@ -43,7 +61,7 @@ strlen (const char* str)
asm ("mov %0, #0\n"
"1:\n\t"
"ldrb %1, [%2, %0]\n\t"
- "add %0, %0, #1\n\t"
+ "add %0, %0, #1\n\t"
"cmp %1, #0\n\t"
"bne 1b"
: "=&r" (len), "=&r" (scratch) : "r" (str) : "memory", "cc");
@@ -58,6 +76,7 @@ strlen (const char* str)
return end - str - 1;
#endif
}
+#endif
#else
#if !(defined(_ISA_ARM_7) || defined(__ARM_ARCH_6T2__))