projects
/
linux-2.6
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
[linux-2.6]
/
arch
/
sh
/
lib
/
strlen.S
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