diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sh/lib/strlen.S |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/sh/lib/strlen.S')
-rw-r--r-- | arch/sh/lib/strlen.S | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/arch/sh/lib/strlen.S b/arch/sh/lib/strlen.S new file mode 100644 index 000000000000..f8ab296047b3 --- /dev/null +++ b/arch/sh/lib/strlen.S | |||
@@ -0,0 +1,70 @@ | |||
1 | /* $Id: strlen.S,v 1.2 2001/06/29 14:07:15 gniibe Exp $ | ||
2 | * | ||
3 | * "strlen" implementation of SuperH | ||
4 | * | ||
5 | * Copyright (C) 1999 Kaz Kojima | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | /* size_t strlen (const char *s) */ | ||
10 | |||
11 | #include <linux/linkage.h> | ||
12 | ENTRY(strlen) | ||
13 | mov r4,r0 | ||
14 | and #3,r0 | ||
15 | tst r0,r0 | ||
16 | bt/s 1f | ||
17 | mov #0,r2 | ||
18 | |||
19 | add #-1,r0 | ||
20 | shll2 r0 | ||
21 | shll r0 | ||
22 | braf r0 | ||
23 | nop | ||
24 | |||
25 | mov.b @r4+,r1 | ||
26 | tst r1,r1 | ||
27 | bt 8f | ||
28 | add #1,r2 | ||
29 | |||
30 | mov.b @r4+,r1 | ||
31 | tst r1,r1 | ||
32 | bt 8f | ||
33 | add #1,r2 | ||
34 | |||
35 | mov.b @r4+,r1 | ||
36 | tst r1,r1 | ||
37 | bt 8f | ||
38 | add #1,r2 | ||
39 | |||
40 | 1: | ||
41 | mov #0,r3 | ||
42 | 2: | ||
43 | mov.l @r4+,r1 | ||
44 | cmp/str r3,r1 | ||
45 | bf/s 2b | ||
46 | add #4,r2 | ||
47 | |||
48 | add #-4,r2 | ||
49 | #ifndef __LITTLE_ENDIAN__ | ||
50 | swap.b r1,r1 | ||
51 | swap.w r1,r1 | ||
52 | swap.b r1,r1 | ||
53 | #endif | ||
54 | extu.b r1,r0 | ||
55 | tst r0,r0 | ||
56 | bt/s 8f | ||
57 | shlr8 r1 | ||
58 | add #1,r2 | ||
59 | extu.b r1,r0 | ||
60 | tst r0,r0 | ||
61 | bt/s 8f | ||
62 | shlr8 r1 | ||
63 | add #1,r2 | ||
64 | extu.b r1,r0 | ||
65 | tst r0,r0 | ||
66 | bt 8f | ||
67 | add #1,r2 | ||
68 | 8: | ||
69 | rts | ||
70 | mov r2,r0 | ||