Skip to content

Commit

Permalink
CRISv32: Add arch optimized strcmp.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jesper Nilsson committed Jun 10, 2009
1 parent b0903ee commit 7f2ff23
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/cris/arch-v32/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

21 changes: 21 additions & 0 deletions arch/cris/arch-v32/lib/strcmp.S
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions arch/cris/include/asm/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7f2ff23

Please sign in to comment.