]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/sparc/sparc32/strlen.S
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / sparc / sparc32 / strlen.S
CommitLineData
ae6b8730
RH
1/* Determine the length of a string.
2 For SPARC v7.
d4697bc9 3 Copyright (C) 1996-2014 Free Software Foundation, Inc.
41bdb6e2 4 This file is part of the GNU C Library.
462a5227
DM
5 Contributed by Jakub Jelinek <jj@ultra.linux.cz> and
6 David S. Miller <davem@davemloft.net>.
ae6b8730
RH
7
8 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
ae6b8730
RH
12
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 16 Lesser General Public License for more details.
ae6b8730 17
41bdb6e2 18 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
19 License along with the GNU C Library; if not, see
20 <http://www.gnu.org/licenses/>. */
ae6b8730
RH
21
22#include <sysdep.h>
23
ae6b8730
RH
24 .text
25 .align 4
043cee37
RM
26
27ENTRY(strlen)
462a5227
DM
28 mov %o0, %o1
29 andn %o0, 0x3, %o0
30
31 ld [%o0], %o5
32 and %o1, 0x3, %g1
33 mov -1, %g5
34
35 sethi %hi(0x01010101), %o2
36 sll %g1, 3, %g1
37
38 or %o2, %lo(0x01010101), %o2
39 srl %g5, %g1, %g2
40
41 orn %o5, %g2, %o5
42 sll %o2, 7, %o3
4310: add %o0, 4, %o0
44
45 andn %o3, %o5, %g1
46 sub %o5, %o2, %g2
47
48 andcc %g1, %g2, %g0
49 be,a 10b
50 ld [%o0], %o5
51
52 srl %o5, 24, %g1
53
54 andcc %g1, 0xff, %g0
55 be 90f
56 sub %o0, 4, %o0
57
58 srl %o5, 16, %g2
59
60 andcc %g2, 0xff, %g0
61 be 90f
62 add %o0, 1, %o0
63
64 srl %o5, 8, %g1
65
66 andcc %g1, 0xff, %g0
67 be 90f
68 add %o0, 1, %o0
69
70 add %o0, 1, %o0
71
7290: retl
73 sub %o0, %o1, %o0
ae6b8730 74END(strlen)
85dd1003 75libc_hidden_builtin_def (strlen)