summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2010-05-12 12:32:34 +0000
committerNils Wallménius <nils@rockbox.org>2010-05-12 12:32:34 +0000
commitaa1e471f9aa05f56edd00a0bf70bb416efa0529f (patch)
tree0859f03ec73b229bb7fb3d7f84d531f6bcb13c99
parenta5d8d215964b31c3257083846dab71af51eb1af2 (diff)
downloadrockbox-aa1e471f9aa05f56edd00a0bf70bb416efa0529f.tar.gz
rockbox-aa1e471f9aa05f56edd00a0bf70bb416efa0529f.zip
Coldfire strlen, slight optimization pointed out by amiconn, eliminate some unconditionla branches by rearranging the code handling the head bytes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25968 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/coldfire/strlen-coldfire.S11
1 files changed, 2 insertions, 9 deletions
diff --git a/firmware/target/coldfire/strlen-coldfire.S b/firmware/target/coldfire/strlen-coldfire.S
index f1e5aca981..765969da04 100644
--- a/firmware/target/coldfire/strlen-coldfire.S
+++ b/firmware/target/coldfire/strlen-coldfire.S
@@ -31,21 +31,14 @@ strlen:
31 move.l %a0, %a1 /* %a1 = start address */ 31 move.l %a0, %a1 /* %a1 = start address */
32 move.l %a0, %d0 32 move.l %a0, %d0
33 andi.l #3, %d0 /* %d0 = %a0 & 3 */ 33 andi.l #3, %d0 /* %d0 = %a0 & 3 */
34 jmp.l (2,%pc,%d0.l*2) 34 beq.b 1f /* already aligned */
35 bra.b .bytes0 35 jmp.l (-2,%pc,%d0.l*4)
36 bra.b .bytes3
37 bra.b .bytes2
38 bra.b .bytes1
39.bytes3:
40 tst.b (%a0)+ 36 tst.b (%a0)+
41 beq.b .done 37 beq.b .done
42.bytes2:
43 tst.b (%a0)+ 38 tst.b (%a0)+
44 beq.b .done 39 beq.b .done
45.bytes1:
46 tst.b (%a0)+ 40 tst.b (%a0)+
47 beq.b .done 41 beq.b .done
48.bytes0:
49 42
50 1: 43 1:
51 move.l (%a0)+, %d0 /* load %d0 increment %a0 */ 44 move.l (%a0)+, %d0 /* load %d0 increment %a0 */