CRISv32: Add arch optimized strcmp.
authorJesper Nilsson <jesper.nilsson@axis.com>
Wed, 10 Jun 2009 13:06:55 +0000 (15:06 +0200)
committerJesper Nilsson <jesper.nilsson@axis.com>
Wed, 10 Jun 2009 13:21:03 +0000 (15:21 +0200)
Add an optimized strcmp for CRISv32. This improves strcmp performance
with about 25% when comparing a 55 character string with itself.

Signed-off-by: Edgar Iglesias <edgar@axis.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
arch/cris/arch-v32/lib/Makefile
arch/cris/arch-v32/lib/strcmp.S [new file with mode: 0644]
arch/cris/include/asm/string.h

index eb4aad1f115889cf6fce82f8f6bd78257d063ec3..dd296b9db034a5e1d5791ca0069c875fbb5b18e9 100644 (file)
@@ -3,5 +3,5 @@
 #
 
 lib-y  = checksum.o checksumcopy.o string.o usercopy.o memset.o \
-       csumcpfruser.o spinlock.o delay.o
+       csumcpfruser.o spinlock.o delay.o strcmp.o
 
diff --git a/arch/cris/arch-v32/lib/strcmp.S b/arch/cris/arch-v32/lib/strcmp.S
new file mode 100644 (file)
index 0000000..8f7a1ee
--- /dev/null
@@ -0,0 +1,21 @@
+; strcmp.S -- CRISv32 version.
+; Copyright (C) 2008 AXIS Communications AB
+; Written by Edgar E. Iglesias
+;
+; This source code is licensed under the GNU General Public License,
+; Version 2.  See the file COPYING for more details.
+
+       .global strcmp
+       .type   strcmp,@function
+strcmp:
+1:
+       move.b  [$r10+], $r12
+       seq     $r13
+       sub.b   [$r11+], $r12
+       or.b    $r12, $r13
+       beq     1b
+       nop
+
+       ret
+       movs.b  $r12, $r10
+       .size   strcmp, . - strcmp
index 691190e99a27622a3f9a1d79f93c0c96254fba40..d5db39f9eea1535541a4962e0a027df0a6599bf8 100644 (file)
@@ -11,4 +11,10 @@ extern void *memcpy(void *, const void *, size_t);
 #define __HAVE_ARCH_MEMSET
 extern void *memset(void *, int, size_t);
 
+#ifdef CONFIG_ETRAX_ARCH_V32
+/* For v32 we provide strcmp.  */
+#define __HAVE_ARCH_STRCMP
+extern int strcmp(const char *s1, const char *s2);
+#endif
+
 #endif