2020-01-01 00:14:33 +00:00
|
|
|
/* Copyright (C) 2010-2020 Free Software Foundation, Inc.
|
2013-08-09 08:36:41 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library. If not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2013-08-09 08:36:41 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Assumes:
|
|
|
|
ARMv6T2, AArch32
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2018-04-16 11:18:23 +00:00
|
|
|
#include <arm-features.h>
|
2013-08-09 08:36:41 +00:00
|
|
|
#include <sysdep.h>
|
|
|
|
|
|
|
|
#ifdef __ARMEB__
|
|
|
|
#define S2LO lsl
|
|
|
|
#define S2HI lsr
|
|
|
|
#else
|
|
|
|
#define S2LO lsr
|
|
|
|
#define S2HI lsl
|
|
|
|
#endif
|
|
|
|
|
2013-08-30 17:43:39 +00:00
|
|
|
/* This code is best on Thumb. */
|
2013-08-09 08:36:41 +00:00
|
|
|
.thumb
|
|
|
|
|
|
|
|
/* Parameters and result. */
|
|
|
|
#define srcin r0
|
|
|
|
#define result r0
|
|
|
|
|
|
|
|
/* Internal variables. */
|
|
|
|
#define src r1
|
|
|
|
#define data1a r2
|
|
|
|
#define data1b r3
|
|
|
|
#define const_m1 r12
|
|
|
|
#define const_0 r4
|
|
|
|
#define tmp1 r4 /* Overlaps const_0 */
|
|
|
|
#define tmp2 r5
|
|
|
|
|
|
|
|
.text
|
|
|
|
.p2align 6
|
|
|
|
ENTRY(strlen)
|
Remove sfi_* annotations from ARM assembly files.
This semi-mechanical patch removes all uses and definitions of the
sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific
assembly files. These were only used by NaCl.
* sysdeps/arm/sysdep.h
(ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions.
* sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S
* sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S
* sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S
* sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S
* sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S
* sysdeps/arm/armv6t2/strlen.S
* sysdeps/arm/armv7/multiarch/memcpy_impl.S
* sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S
* sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S
* sysdeps/arm/memset.S, sysdeps/arm/setjmp.S
* sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S:
Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
2017-05-12 00:36:15 +00:00
|
|
|
pld [srcin, #0]
|
2013-08-09 08:36:41 +00:00
|
|
|
strd r4, r5, [sp, #-8]!
|
|
|
|
cfi_adjust_cfa_offset (8)
|
|
|
|
cfi_rel_offset (r4, 0)
|
|
|
|
cfi_rel_offset (r5, 4)
|
|
|
|
cfi_remember_state
|
|
|
|
bic src, srcin, #7
|
|
|
|
mvn const_m1, #0
|
|
|
|
ands tmp1, srcin, #7 /* (8 - bytes) to alignment. */
|
Remove sfi_* annotations from ARM assembly files.
This semi-mechanical patch removes all uses and definitions of the
sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific
assembly files. These were only used by NaCl.
* sysdeps/arm/sysdep.h
(ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions.
* sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S
* sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S
* sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S
* sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S
* sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S
* sysdeps/arm/armv6t2/strlen.S
* sysdeps/arm/armv7/multiarch/memcpy_impl.S
* sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S
* sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S
* sysdeps/arm/memset.S, sysdeps/arm/setjmp.S
* sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S:
Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
2017-05-12 00:36:15 +00:00
|
|
|
pld [src, #32]
|
2013-08-09 08:36:41 +00:00
|
|
|
bne.w .Lmisaligned8
|
|
|
|
mov const_0, #0
|
|
|
|
mov result, #-8
|
|
|
|
.Lloop_aligned:
|
|
|
|
/* Bytes 0-7. */
|
Remove sfi_* annotations from ARM assembly files.
This semi-mechanical patch removes all uses and definitions of the
sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific
assembly files. These were only used by NaCl.
* sysdeps/arm/sysdep.h
(ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions.
* sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S
* sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S
* sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S
* sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S
* sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S
* sysdeps/arm/armv6t2/strlen.S
* sysdeps/arm/armv7/multiarch/memcpy_impl.S
* sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S
* sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S
* sysdeps/arm/memset.S, sysdeps/arm/setjmp.S
* sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S:
Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
2017-05-12 00:36:15 +00:00
|
|
|
ldrd data1a, data1b, [src]
|
|
|
|
pld [src, #64]
|
2013-08-09 08:36:41 +00:00
|
|
|
add result, result, #8
|
|
|
|
.Lstart_realigned:
|
|
|
|
uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */
|
|
|
|
sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */
|
|
|
|
uadd8 data1b, data1b, const_m1
|
|
|
|
sel data1b, data1a, const_m1 /* Only used if d1a == 0. */
|
|
|
|
cbnz data1b, .Lnull_found
|
|
|
|
|
|
|
|
/* Bytes 8-15. */
|
Remove sfi_* annotations from ARM assembly files.
This semi-mechanical patch removes all uses and definitions of the
sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific
assembly files. These were only used by NaCl.
* sysdeps/arm/sysdep.h
(ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions.
* sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S
* sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S
* sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S
* sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S
* sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S
* sysdeps/arm/armv6t2/strlen.S
* sysdeps/arm/armv7/multiarch/memcpy_impl.S
* sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S
* sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S
* sysdeps/arm/memset.S, sysdeps/arm/setjmp.S
* sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S:
Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
2017-05-12 00:36:15 +00:00
|
|
|
ldrd data1a, data1b, [src, #8]
|
2013-08-09 08:36:41 +00:00
|
|
|
uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */
|
|
|
|
add result, result, #8
|
|
|
|
sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */
|
|
|
|
uadd8 data1b, data1b, const_m1
|
|
|
|
sel data1b, data1a, const_m1 /* Only used if d1a == 0. */
|
|
|
|
cbnz data1b, .Lnull_found
|
|
|
|
|
|
|
|
/* Bytes 16-23. */
|
Remove sfi_* annotations from ARM assembly files.
This semi-mechanical patch removes all uses and definitions of the
sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific
assembly files. These were only used by NaCl.
* sysdeps/arm/sysdep.h
(ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions.
* sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S
* sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S
* sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S
* sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S
* sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S
* sysdeps/arm/armv6t2/strlen.S
* sysdeps/arm/armv7/multiarch/memcpy_impl.S
* sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S
* sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S
* sysdeps/arm/memset.S, sysdeps/arm/setjmp.S
* sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S:
Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
2017-05-12 00:36:15 +00:00
|
|
|
ldrd data1a, data1b, [src, #16]
|
2013-08-09 08:36:41 +00:00
|
|
|
uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */
|
|
|
|
add result, result, #8
|
|
|
|
sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */
|
|
|
|
uadd8 data1b, data1b, const_m1
|
|
|
|
sel data1b, data1a, const_m1 /* Only used if d1a == 0. */
|
|
|
|
cbnz data1b, .Lnull_found
|
|
|
|
|
|
|
|
/* Bytes 24-31. */
|
Remove sfi_* annotations from ARM assembly files.
This semi-mechanical patch removes all uses and definitions of the
sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific
assembly files. These were only used by NaCl.
* sysdeps/arm/sysdep.h
(ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions.
* sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S
* sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S
* sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S
* sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S
* sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S
* sysdeps/arm/armv6t2/strlen.S
* sysdeps/arm/armv7/multiarch/memcpy_impl.S
* sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S
* sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S
* sysdeps/arm/memset.S, sysdeps/arm/setjmp.S
* sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S:
Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
2017-05-12 00:36:15 +00:00
|
|
|
ldrd data1a, data1b, [src, #24]
|
2013-08-09 08:36:41 +00:00
|
|
|
add src, src, #32
|
|
|
|
uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */
|
|
|
|
add result, result, #8
|
|
|
|
sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */
|
|
|
|
uadd8 data1b, data1b, const_m1
|
|
|
|
sel data1b, data1a, const_m1 /* Only used if d1a == 0. */
|
|
|
|
cmp data1b, #0
|
|
|
|
beq .Lloop_aligned
|
|
|
|
|
|
|
|
.Lnull_found:
|
|
|
|
cmp data1a, #0
|
|
|
|
itt eq
|
|
|
|
addeq result, result, #4
|
|
|
|
moveq data1a, data1b
|
|
|
|
#ifndef __ARMEB__
|
|
|
|
rev data1a, data1a
|
|
|
|
#endif
|
|
|
|
clz data1a, data1a
|
|
|
|
ldrd r4, r5, [sp], #8
|
|
|
|
cfi_adjust_cfa_offset (-8)
|
|
|
|
cfi_restore (r4)
|
|
|
|
cfi_restore (r5)
|
|
|
|
add result, result, data1a, lsr #3 /* Bits -> Bytes. */
|
|
|
|
DO_RET(lr)
|
|
|
|
|
|
|
|
.Lmisaligned8:
|
|
|
|
cfi_restore_state
|
Remove sfi_* annotations from ARM assembly files.
This semi-mechanical patch removes all uses and definitions of the
sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific
assembly files. These were only used by NaCl.
* sysdeps/arm/sysdep.h
(ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions.
* sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S
* sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S
* sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S
* sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S
* sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S
* sysdeps/arm/armv6t2/strlen.S
* sysdeps/arm/armv7/multiarch/memcpy_impl.S
* sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S
* sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S
* sysdeps/arm/memset.S, sysdeps/arm/setjmp.S
* sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S:
Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
2017-05-12 00:36:15 +00:00
|
|
|
ldrd data1a, data1b, [src]
|
2013-08-09 08:36:41 +00:00
|
|
|
and tmp2, tmp1, #3
|
|
|
|
rsb result, tmp1, #0
|
|
|
|
lsl tmp2, tmp2, #3 /* Bytes -> bits. */
|
|
|
|
tst tmp1, #4
|
Remove sfi_* annotations from ARM assembly files.
This semi-mechanical patch removes all uses and definitions of the
sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific
assembly files. These were only used by NaCl.
* sysdeps/arm/sysdep.h
(ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions.
* sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S
* sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S
* sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S
* sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S
* sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S
* sysdeps/arm/armv6t2/strlen.S
* sysdeps/arm/armv7/multiarch/memcpy_impl.S
* sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S
* sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S
* sysdeps/arm/memset.S, sysdeps/arm/setjmp.S
* sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S:
Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
2017-05-12 00:36:15 +00:00
|
|
|
pld [src, #64]
|
2013-08-09 08:36:41 +00:00
|
|
|
S2HI tmp2, const_m1, tmp2
|
|
|
|
orn data1a, data1a, tmp2
|
|
|
|
itt ne
|
|
|
|
ornne data1b, data1b, tmp2
|
|
|
|
movne data1a, const_m1
|
|
|
|
mov const_0, #0
|
|
|
|
b .Lstart_realigned
|
|
|
|
|
|
|
|
END(strlen)
|
|
|
|
libc_hidden_builtin_def (strlen)
|