Blame sysdeps/sparc/sparc32/strlen.S
|
Packit |
6c4009 |
/* Determine the length of a string.
|
|
Packit |
6c4009 |
For SPARC v7.
|
|
Packit |
6c4009 |
Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
Contributed by Jakub Jelinek <jj@ultra.linux.cz> and
|
|
Packit |
6c4009 |
David S. Miller <davem@davemloft.net>.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <sysdep.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.text
|
|
Packit |
6c4009 |
.align 4
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ENTRY(strlen)
|
|
Packit |
6c4009 |
mov %o0, %o1
|
|
Packit |
6c4009 |
andn %o0, 0x3, %o0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ld [%o0], %o5
|
|
Packit |
6c4009 |
and %o1, 0x3, %g1
|
|
Packit |
6c4009 |
mov -1, %g5
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
sethi %hi(0x01010101), %o2
|
|
Packit |
6c4009 |
sll %g1, 3, %g1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
or %o2, %lo(0x01010101), %o2
|
|
Packit |
6c4009 |
srl %g5, %g1, %g2
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
orn %o5, %g2, %o5
|
|
Packit |
6c4009 |
sll %o2, 7, %o3
|
|
Packit |
6c4009 |
10: add %o0, 4, %o0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
andn %o3, %o5, %g1
|
|
Packit |
6c4009 |
sub %o5, %o2, %g2
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
andcc %g1, %g2, %g0
|
|
Packit |
6c4009 |
be,a 10b
|
|
Packit |
6c4009 |
ld [%o0], %o5
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
srl %o5, 24, %g1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
andcc %g1, 0xff, %g0
|
|
Packit |
6c4009 |
be 90f
|
|
Packit |
6c4009 |
sub %o0, 4, %o0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
srl %o5, 16, %g2
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
andcc %g2, 0xff, %g0
|
|
Packit |
6c4009 |
be 90f
|
|
Packit |
6c4009 |
add %o0, 1, %o0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
srl %o5, 8, %g1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
andcc %g1, 0xff, %g0
|
|
Packit |
6c4009 |
be 90f
|
|
Packit |
6c4009 |
add %o0, 1, %o0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
add %o0, 1, %o0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
90: retl
|
|
Packit |
6c4009 |
sub %o0, %o1, %o0
|
|
Packit |
6c4009 |
END(strlen)
|
|
Packit |
6c4009 |
libc_hidden_builtin_def (strlen)
|