2015-01-07 12:18:30 +00:00
|
|
|
/* Optimized strcmp implementation for PowerPC64/POWER8.
|
2020-01-01 00:14:33 +00:00
|
|
|
Copyright (C) 2015-2020 Free Software Foundation, Inc.
|
2015-01-07 12:18:30 +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/>. */
|
2015-01-07 12:18:30 +00:00
|
|
|
|
|
|
|
#include <sysdep.h>
|
|
|
|
|
2017-04-11 17:18:34 +00:00
|
|
|
#ifndef STRCMP
|
|
|
|
# define STRCMP strcmp
|
|
|
|
#endif
|
|
|
|
|
2015-01-07 12:18:30 +00:00
|
|
|
/* Implements the function
|
|
|
|
|
|
|
|
size_t [r3] strcmp (const char *s1 [r3], const char *s2 [r4])
|
|
|
|
|
|
|
|
The implementation uses unaligned doubleword access to avoid specialized
|
|
|
|
code paths depending of data alignment. Although recent powerpc64 uses
|
|
|
|
64K as default, the page cross handling assumes minimum page size of
|
|
|
|
4k. */
|
|
|
|
|
powerpc: Fix build failures with current GCC
Since GCC commit 271500 (svn), also known as the following commit on the
git mirror:
commit 61edec870f9fdfb5df3fa4e40f28cbaede28a5b1
Author: amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed May 22 04:34:26 2019 +0000
[RS6000] Don't pass -many to the assembler
glibc builds are failing when an assembly implementation does not
declare the correct '.machine' directive, or when no such directive is
declared at all. For example, when a POWER6 instruction is used, but
'.machine power6' is not declared, the assembler will fail with an error
similar to the following:
../sysdeps/powerpc/powerpc64/power8/strcmp.S: Assembler messages:
24 ../sysdeps/powerpc/powerpc64/power8/strcmp.S:55: Error: unrecognized opcode: `cmpb'
This patch adds '.machine powerN' directives where none existed, as well
as it updates '.machine power7' directives on POWER8 files, because the
minimum binutils version required to build glibc (binutils 2.25) now
provides this machine version. It also adds '-many' to the assembler
command used to build tst-set_ppr.c.
Tested for powerpc, powerpc64, and powerpc64le, as well as with
build-many-glibcs.py for powerpc targets.
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2019-05-27 18:21:22 +00:00
|
|
|
.machine power8
|
PowerPC64 ENTRY_TOCLESS
A number of functions in the sysdeps/powerpc/powerpc64/ tree don't use
or change r2, yet declare a global entry that sets up r2. This patch
fixes that problem, and consolidates the ENTRY and EALIGN macros.
* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
(NOPS, ENTRY_3): New macros.
(ENTRY): Rewrite.
(ENTRY_TOCLESS): Define.
(EALIGN, EALIGN_W_0, EALIGN_W_1, EALIGN_W_2, EALIGN_W_4, EALIGN_W_5,
EALIGN_W_6, EALIGN_W_7, EALIGN_W_8): Delete.
* sysdeps/powerpc/powerpc64/a2/memcpy.S: Replace EALIGN with ENTRY.
* sysdeps/powerpc/powerpc64/dl-trampoline.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
* sysdeps/powerpc/powerpc64/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
* sysdeps/powerpc/powerpc64/addmul_1.S: Use ENTRY_TOCLESS.
* sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise.
* sysdeps/powerpc/powerpc64/lshift.S: Likewise.
* sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/mul_1.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/add_n.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strcasecmp.S (strcasecmp_l):
Likewise.
* sysdeps/powerpc/powerpc64/power7/strchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strncpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strnlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strspn.S: Likewise.
* sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/strchr.S: Likewise.
* sysdeps/powerpc/powerpc64/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/strlen.S: Likewise.
* sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/ppc-mcount.S: Store LR earlier. Don't
add nop when SHARED.
* sysdeps/powerpc/powerpc64/start.S: Fix comment.
* sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY): Don't
define.
(ENTRY_TOCLESS): Define.
* sysdeps/powerpc/powerpc32/sysdep.h (ENTRY_TOCLESS): Define.
* sysdeps/powerpc/fpu/s_fma.S: Use ENTRY_TOCLESS.
* sysdeps/powerpc/fpu/s_fmaf.S: Likewise.
2017-06-14 01:15:50 +00:00
|
|
|
ENTRY_TOCLESS (STRCMP, 4)
|
2015-01-07 12:18:30 +00:00
|
|
|
li r0,0
|
|
|
|
|
2017-02-07 05:10:26 +00:00
|
|
|
/* Check if [s1]+16 or [s2]+16 will cross a 4K page boundary using
|
2015-01-07 12:18:30 +00:00
|
|
|
the code:
|
|
|
|
|
|
|
|
(((size_t) s1) % PAGE_SIZE > (PAGE_SIZE - ITER_SIZE))
|
|
|
|
|
2017-02-07 05:10:26 +00:00
|
|
|
with PAGE_SIZE being 4096 and ITER_SIZE begin 16. */
|
2015-01-07 12:18:30 +00:00
|
|
|
|
|
|
|
rldicl r7,r3,0,52
|
|
|
|
rldicl r9,r4,0,52
|
2017-02-07 05:10:26 +00:00
|
|
|
cmpldi cr7,r7,4096-16
|
2015-01-07 12:18:30 +00:00
|
|
|
bgt cr7,L(pagecross_check)
|
2017-02-07 05:10:26 +00:00
|
|
|
cmpldi cr5,r9,4096-16
|
2015-01-07 12:18:30 +00:00
|
|
|
bgt cr5,L(pagecross_check)
|
|
|
|
|
2017-02-07 05:10:26 +00:00
|
|
|
/* For short string up to 16 bytes, load both s1 and s2 using
|
2015-01-07 12:18:30 +00:00
|
|
|
unaligned dwords and compare. */
|
|
|
|
ld r8,0(r3)
|
|
|
|
ld r10,0(r4)
|
|
|
|
cmpb r12,r8,r0
|
|
|
|
cmpb r11,r8,r10
|
|
|
|
orc. r9,r12,r11
|
|
|
|
bne cr0,L(different_nocmpb)
|
|
|
|
|
|
|
|
ld r8,8(r3)
|
|
|
|
ld r10,8(r4)
|
|
|
|
cmpb r12,r8,r0
|
|
|
|
cmpb r11,r8,r10
|
|
|
|
orc. r9,r12,r11
|
|
|
|
bne cr0,L(different_nocmpb)
|
|
|
|
|
2017-02-07 05:10:26 +00:00
|
|
|
addi r7,r3,16
|
|
|
|
addi r4,r4,16
|
2015-01-07 12:18:30 +00:00
|
|
|
|
|
|
|
L(align_8b):
|
2017-02-07 05:10:26 +00:00
|
|
|
/* Now it has checked for first 16 bytes, align source1 to doubleword
|
2015-01-07 12:18:30 +00:00
|
|
|
and adjust source2 address. */
|
|
|
|
rldicl r9,r7,0,61 /* source1 alignment to doubleword */
|
|
|
|
subf r4,r9,r4 /* Adjust source2 address based on source1
|
|
|
|
alignment. */
|
|
|
|
rldicr r7,r7,0,60 /* Align source1 to doubleword. */
|
|
|
|
|
|
|
|
/* At this point, source1 alignment is 0 and source2 alignment is
|
|
|
|
between 0 and 7. Check is source2 alignment is 0, meaning both
|
|
|
|
sources have the same alignment. */
|
|
|
|
andi. r9,r4,0x7
|
|
|
|
bne cr0,L(loop_diff_align)
|
|
|
|
|
|
|
|
/* If both source1 and source2 are doubleword aligned, there is no
|
|
|
|
need for page boundary cross checks. */
|
|
|
|
|
|
|
|
ld r8,0(r7)
|
|
|
|
ld r10,0(r4)
|
|
|
|
cmpb r12,r8,r0
|
|
|
|
cmpb r11,r8,r10
|
|
|
|
orc. r9,r12,r11
|
|
|
|
bne cr0,L(different_nocmpb)
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(loop_equal_align):
|
|
|
|
ld r8,8(r7)
|
|
|
|
ld r10,8(r4)
|
|
|
|
cmpb r12,r8,r0
|
|
|
|
cmpb r11,r8,r10
|
|
|
|
orc. r9,r12,r11
|
|
|
|
bne cr0,L(different_nocmpb)
|
|
|
|
|
|
|
|
ld r8,16(r7)
|
|
|
|
ld r10,16(r4)
|
|
|
|
cmpb r12,r8,r0
|
|
|
|
cmpb r11,r8,r10
|
|
|
|
orc. r9,r12,r11
|
|
|
|
bne cr0,L(different_nocmpb)
|
|
|
|
|
|
|
|
ldu r8,24(r7)
|
|
|
|
ldu r10,24(r4)
|
|
|
|
cmpb r12,r8,r0
|
|
|
|
cmpb r11,r8,r10
|
|
|
|
orc. r9,r12,r11
|
|
|
|
bne cr0,L(different_nocmpb)
|
|
|
|
|
|
|
|
b L(loop_equal_align)
|
|
|
|
|
|
|
|
/* A zero byte was found in r8 (s1 dword), r9 contains the cmpb
|
|
|
|
result and r10 the dword from s2. To code isolate the byte
|
|
|
|
up to end (including the '\0'), masking with 0xFF the remaining
|
|
|
|
ones:
|
|
|
|
|
|
|
|
#if __LITTLE_ENDIAN__
|
|
|
|
(__builtin_ffsl (x) - 1) = counting trailing zero bits
|
|
|
|
r9 = (__builtin_ffsl (r9) - 1) + 8;
|
|
|
|
r9 = -1UL << r9
|
|
|
|
#else
|
|
|
|
r9 = __builtin_clzl (r9) + 8;
|
|
|
|
r9 = -1UL >> r9
|
|
|
|
#endif
|
|
|
|
r8 = r8 | r9
|
|
|
|
r10 = r10 | r9 */
|
|
|
|
|
|
|
|
#ifdef __LITTLE_ENDIAN__
|
|
|
|
nor r9,r9,r9
|
|
|
|
L(different_nocmpb):
|
|
|
|
neg r3,r9
|
|
|
|
and r9,r9,r3
|
|
|
|
cntlzd r9,r9
|
|
|
|
subfic r9,r9,63
|
|
|
|
#else
|
|
|
|
not r9,r9
|
|
|
|
L(different_nocmpb):
|
|
|
|
cntlzd r9,r9
|
|
|
|
subfic r9,r9,56
|
|
|
|
#endif
|
|
|
|
srd r3,r8,r9
|
|
|
|
srd r10,r10,r9
|
|
|
|
rldicl r10,r10,0,56
|
|
|
|
rldicl r3,r3,0,56
|
|
|
|
subf r3,r10,r3
|
|
|
|
extsw r3,r3
|
|
|
|
blr
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(pagecross_check):
|
|
|
|
subfic r9,r9,4096
|
|
|
|
subfic r7,r7,4096
|
|
|
|
cmpld cr7,r7,r9
|
|
|
|
bge cr7,L(pagecross)
|
|
|
|
mr r7,r9
|
|
|
|
|
|
|
|
/* If unaligned 16 bytes reads across a 4K page boundary, it uses
|
|
|
|
a simple byte a byte comparison until the page alignment for s1
|
|
|
|
is reached. */
|
|
|
|
L(pagecross):
|
|
|
|
add r7,r3,r7
|
|
|
|
subf r9,r3,r7
|
|
|
|
mtctr r9
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(pagecross_loop):
|
|
|
|
/* Loads a byte from s1 and s2, compare if *s1 is equal to *s2
|
|
|
|
and if *s1 is '\0'. */
|
|
|
|
lbz r9,0(r3)
|
|
|
|
lbz r10,0(r4)
|
|
|
|
addi r3,r3,1
|
|
|
|
addi r4,r4,1
|
|
|
|
cmplw cr7,r9,r10
|
|
|
|
cmpdi cr5,r9,r0
|
|
|
|
bne cr7,L(pagecross_ne)
|
|
|
|
beq cr5,L(pagecross_nullfound)
|
|
|
|
bdnz L(pagecross_loop)
|
|
|
|
b L(align_8b)
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
/* The unaligned read of source2 will cross a 4K page boundary,
|
|
|
|
and the different byte or NULL maybe be in the remaining page
|
|
|
|
bytes. Since it can not use the unaligned load, the algorithm
|
|
|
|
reads and compares 8 bytes to keep source1 doubleword aligned. */
|
|
|
|
L(check_source2_byte):
|
|
|
|
li r9,8
|
|
|
|
mtctr r9
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(check_source2_byte_loop):
|
|
|
|
lbz r9,0(r7)
|
|
|
|
lbz r10,0(r4)
|
|
|
|
addi r7,r7,1
|
|
|
|
addi r4,r4,1
|
|
|
|
cmplw cr7,r9,10
|
|
|
|
cmpdi r5,r9,0
|
|
|
|
bne cr7,L(pagecross_ne)
|
|
|
|
beq cr5,L(pagecross_nullfound)
|
|
|
|
bdnz L(check_source2_byte_loop)
|
|
|
|
|
|
|
|
/* If source2 is unaligned to doubleword, the code needs to check
|
|
|
|
on each interation if the unaligned doubleword access will cross
|
|
|
|
a 4k page boundary. */
|
|
|
|
.align 5
|
|
|
|
L(loop_unaligned):
|
|
|
|
ld r8,0(r7)
|
|
|
|
ld r10,0(r4)
|
|
|
|
cmpb r12,r8,r0
|
|
|
|
cmpb r11,r8,r10
|
|
|
|
orc. r9,r12,r11
|
|
|
|
bne cr0,L(different_nocmpb)
|
|
|
|
addi r7,r7,8
|
|
|
|
addi r4,r4,8
|
|
|
|
|
|
|
|
L(loop_diff_align):
|
|
|
|
/* Check if [src2]+8 cross a 4k page boundary:
|
|
|
|
|
|
|
|
srcin2 % PAGE_SIZE > (PAGE_SIZE - 8)
|
|
|
|
|
|
|
|
with PAGE_SIZE being 4096. */
|
|
|
|
rldicl r9,r4,0,52
|
|
|
|
cmpldi cr7,r9,4088
|
|
|
|
ble cr7,L(loop_unaligned)
|
|
|
|
b L(check_source2_byte)
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(pagecross_ne):
|
|
|
|
extsw r3,r9
|
|
|
|
mr r9,r10
|
|
|
|
L(pagecross_retdiff):
|
|
|
|
subf r9,r9,r3
|
|
|
|
extsw r3,r9
|
|
|
|
blr
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(pagecross_nullfound):
|
|
|
|
li r3,0
|
|
|
|
b L(pagecross_retdiff)
|
2017-04-11 17:18:34 +00:00
|
|
|
END (STRCMP)
|
2015-01-07 12:18:30 +00:00
|
|
|
libc_hidden_builtin_def (strcmp)
|