summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2007-06-25 20:21:37 +0000
committerNils Wallménius <nils@rockbox.org>2007-06-25 20:21:37 +0000
commit07b7877809e27fed9f11eeb8d6ed92a369c38225 (patch)
tree22e06f206ab63908d31cc56819ed4fa4d54600b5
parentdfa4e6406d7e4793b2bae189eb2fc1cab4506f6f (diff)
downloadrockbox-07b7877809e27fed9f11eeb8d6ed92a369c38225.tar.gz
rockbox-07b7877809e27fed9f11eeb8d6ed92a369c38225.zip
Simple coldfire assembly strlen() function, 20-25% faster than the c
version. Move function out of iram as it turns out that makes it slightly faster. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13713 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/SOURCES2
-rw-r--r--firmware/target/coldfire/strlen-coldfire.S40
2 files changed, 41 insertions, 1 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 2b948e7df4..c642196d5c 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -250,13 +250,13 @@ target/sh/system-sh.c
250 250
251#elif defined(CPU_COLDFIRE) 251#elif defined(CPU_COLDFIRE)
252 252
253common/strlen.c
254#ifndef SIMULATOR 253#ifndef SIMULATOR
255target/coldfire/crt0.S 254target/coldfire/crt0.S
256target/coldfire/memcpy-coldfire.S 255target/coldfire/memcpy-coldfire.S
257target/coldfire/memmove-coldfire.S 256target/coldfire/memmove-coldfire.S
258target/coldfire/memset-coldfire.S 257target/coldfire/memset-coldfire.S
259target/coldfire/memswap128-coldfire.S 258target/coldfire/memswap128-coldfire.S
259target/coldfire/strlen-coldfire.S
260#if defined(HAVE_LCD_COLOR) \ 260#if defined(HAVE_LCD_COLOR) \
261 || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) 261 || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED)
262target/coldfire/memset16-coldfire.S 262target/coldfire/memset16-coldfire.S
diff --git a/firmware/target/coldfire/strlen-coldfire.S b/firmware/target/coldfire/strlen-coldfire.S
new file mode 100644
index 0000000000..9be42a5864
--- /dev/null
+++ b/firmware/target/coldfire/strlen-coldfire.S
@@ -0,0 +1,40 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id $
9 *
10 * Copyright (C) 2007 Nils Wallménius
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20/* size_t strlen(const char *str) */
21
22 .section .text,"ax",@progbits
23 .align 2
24 .globl strlen
25 .type strlen, @function
26
27strlen:
28 move.l 4(%sp),%a0 /* %a0 = *str */
29 move.l %a0,%d0 /* %d0 = start address */
30
31 1:
32 tst.b (%a0)+ /* test if %a0 == 0 and increment */
33 bne.b 1b /* if the test was false repeat */
34
35 sub.l %d0,%a0 /* how many times did we repeat? */
36 move.l %a0,%d0
37 subq.l #1,%d0 /* %d0 is 1 too large due to the last increment */
38 rts
39 .size strlen, .-strlen
40