2010-05-20 11:35:05 +00:00
|
|
|
/* Optimized memset implementation for PowerPC64/POWER7.
|
2021-01-02 19:32:25 +00:00
|
|
|
Copyright (C) 2010-2021 Free Software Foundation, Inc.
|
2010-05-20 11:35:05 +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
|
2012-02-09 23:18:22 +00:00
|
|
|
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/>. */
|
2010-05-20 11:35:05 +00:00
|
|
|
|
|
|
|
#include <sysdep.h>
|
|
|
|
|
2017-08-08 17:14:49 +00:00
|
|
|
/* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5]));
|
2010-05-20 11:35:05 +00:00
|
|
|
Returns 's'. */
|
|
|
|
|
2017-04-11 17:18:35 +00:00
|
|
|
#ifndef MEMSET
|
|
|
|
# define MEMSET memset
|
|
|
|
#endif
|
2010-05-20 11:35:05 +00:00
|
|
|
.machine power7
|
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 (MEMSET, 5)
|
2010-05-20 11:35:05 +00:00
|
|
|
CALL_MCOUNT 3
|
|
|
|
|
|
|
|
L(_memset):
|
|
|
|
cmpldi cr7,5,31
|
|
|
|
cmpldi cr6,5,8
|
|
|
|
mr 10,3
|
|
|
|
|
|
|
|
/* Replicate byte to word. */
|
2013-08-17 09:17:59 +00:00
|
|
|
insrdi 4,4,8,48
|
|
|
|
insrdi 4,4,16,32
|
2010-05-20 11:35:05 +00:00
|
|
|
ble cr6,L(small) /* If length <= 8, use short copy code. */
|
|
|
|
|
|
|
|
neg 0,3
|
|
|
|
ble cr7,L(medium) /* If length < 32, use medium copy code. */
|
|
|
|
|
|
|
|
andi. 11,10,7 /* Check alignment of SRC. */
|
|
|
|
insrdi 4,4,32,0 /* Replicate word to double word. */
|
|
|
|
|
|
|
|
mr 12,5
|
|
|
|
beq L(big_aligned)
|
|
|
|
|
|
|
|
clrldi 0,0,61
|
|
|
|
mtocrf 0x01,0
|
|
|
|
subf 5,0,5
|
|
|
|
|
|
|
|
/* Get DST aligned to 8 bytes. */
|
|
|
|
1: bf 31,2f
|
|
|
|
|
|
|
|
stb 4,0(10)
|
|
|
|
addi 10,10,1
|
|
|
|
2: bf 30,4f
|
|
|
|
|
|
|
|
sth 4,0(10)
|
|
|
|
addi 10,10,2
|
|
|
|
4: bf 29,L(big_aligned)
|
|
|
|
|
|
|
|
stw 4,0(10)
|
|
|
|
addi 10,10,4
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(big_aligned):
|
|
|
|
|
|
|
|
cmpldi cr5,5,255
|
|
|
|
li 0,32
|
|
|
|
dcbtst 0,10
|
|
|
|
cmpldi cr6,4,0
|
|
|
|
srdi 9,5,3 /* Number of full doublewords remaining. */
|
|
|
|
crand 27,26,21
|
|
|
|
mtocrf 0x01,9
|
|
|
|
bt 27,L(huge)
|
|
|
|
|
|
|
|
/* From this point on, we'll copy 32+ bytes and the value
|
|
|
|
isn't 0 (so we can't use dcbz). */
|
|
|
|
|
|
|
|
srdi 8,5,5
|
|
|
|
clrldi 11,5,61
|
|
|
|
cmpldi cr6,11,0
|
|
|
|
cmpldi cr1,9,4
|
|
|
|
mtctr 8
|
|
|
|
|
|
|
|
/* Copy 1~3 doublewords so the main loop starts
|
|
|
|
at a multiple of 32 bytes. */
|
|
|
|
|
|
|
|
bf 30,1f
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
std 4,8(10)
|
|
|
|
addi 10,10,16
|
|
|
|
bf 31,L(big_loop)
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
addi 10,10,8
|
|
|
|
mr 12,10
|
|
|
|
blt cr1,L(tail_bytes)
|
|
|
|
b L(big_loop)
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
1: /* Copy 1 doubleword. */
|
|
|
|
bf 31,L(big_loop)
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
addi 10,10,8
|
|
|
|
|
|
|
|
/* Main aligned copy loop. Copies 32-bytes at a time and
|
|
|
|
ping-pong through r10 and r12 to avoid AGEN delays. */
|
|
|
|
.align 4
|
|
|
|
L(big_loop):
|
|
|
|
addi 12,10,32
|
|
|
|
std 4,0(10)
|
|
|
|
std 4,8(10)
|
|
|
|
std 4,16(10)
|
|
|
|
std 4,24(10)
|
|
|
|
bdz L(tail_bytes)
|
|
|
|
|
|
|
|
addi 10,10,64
|
|
|
|
std 4,0(12)
|
|
|
|
std 4,8(12)
|
|
|
|
std 4,16(12)
|
|
|
|
std 4,24(12)
|
|
|
|
bdnz L(big_loop)
|
|
|
|
|
|
|
|
mr 12,10
|
|
|
|
b L(tail_bytes)
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(tail_bytes):
|
|
|
|
|
|
|
|
/* Check for tail bytes. */
|
|
|
|
beqlr cr6
|
|
|
|
|
|
|
|
clrldi 0,5,61
|
|
|
|
mtocrf 0x01,0
|
|
|
|
|
|
|
|
/* At this point we have a tail of 0-7 bytes and we know that the
|
|
|
|
destination is doubleword-aligned. */
|
|
|
|
4: /* Copy 4 bytes. */
|
|
|
|
bf 29,2f
|
|
|
|
|
|
|
|
stw 4,0(12)
|
|
|
|
addi 12,12,4
|
|
|
|
2: /* Copy 2 bytes. */
|
|
|
|
bf 30,1f
|
|
|
|
|
|
|
|
sth 4,0(12)
|
|
|
|
addi 12,12,2
|
|
|
|
1: /* Copy 1 byte. */
|
|
|
|
bflr 31
|
|
|
|
|
|
|
|
stb 4,0(12)
|
|
|
|
blr
|
|
|
|
|
|
|
|
/* Special case when value is 0 and we have a long length to deal
|
|
|
|
with. Use dcbz to zero out 128-bytes at a time. Before using
|
|
|
|
dcbz though, we need to get the destination 128-bytes aligned. */
|
|
|
|
.align 4
|
|
|
|
L(huge):
|
|
|
|
andi. 11,10,127
|
|
|
|
neg 0,10
|
|
|
|
beq L(huge_aligned)
|
|
|
|
|
|
|
|
clrldi 0,0,57
|
|
|
|
subf 5,0,5
|
|
|
|
srdi 0,0,3
|
|
|
|
mtocrf 0x01,0
|
|
|
|
|
|
|
|
/* Get DST aligned to 128 bytes. */
|
|
|
|
8: bf 28,4f
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
std 4,8(10)
|
|
|
|
std 4,16(10)
|
|
|
|
std 4,24(10)
|
|
|
|
std 4,32(10)
|
|
|
|
std 4,40(10)
|
|
|
|
std 4,48(10)
|
|
|
|
std 4,56(10)
|
|
|
|
addi 10,10,64
|
|
|
|
.align 4
|
|
|
|
4: bf 29,2f
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
std 4,8(10)
|
|
|
|
std 4,16(10)
|
|
|
|
std 4,24(10)
|
|
|
|
addi 10,10,32
|
|
|
|
.align 4
|
|
|
|
2: bf 30,1f
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
std 4,8(10)
|
|
|
|
addi 10,10,16
|
|
|
|
.align 4
|
|
|
|
1: bf 31,L(huge_aligned)
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
addi 10,10,8
|
|
|
|
|
|
|
|
|
|
|
|
L(huge_aligned):
|
|
|
|
srdi 8,5,7
|
|
|
|
clrldi 11,5,57
|
|
|
|
cmpldi cr6,11,0
|
|
|
|
mtctr 8
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(huge_loop):
|
|
|
|
dcbz 0,10
|
|
|
|
addi 10,10,128
|
|
|
|
bdnz L(huge_loop)
|
|
|
|
|
|
|
|
/* Check how many bytes are still left. */
|
|
|
|
beqlr cr6
|
|
|
|
|
|
|
|
subf 9,3,10
|
|
|
|
subf 5,9,12
|
|
|
|
srdi 8,5,3
|
|
|
|
cmpldi cr6,8,0
|
|
|
|
mtocrf 0x01,8
|
|
|
|
|
|
|
|
/* We have a tail o 1~127 bytes. Copy up to 15 doublewords for
|
|
|
|
speed. We'll handle the resulting tail bytes later. */
|
|
|
|
beq cr6,L(tail)
|
|
|
|
|
|
|
|
8: bf 28,4f
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
std 4,8(10)
|
|
|
|
std 4,16(10)
|
|
|
|
std 4,24(10)
|
|
|
|
std 4,32(10)
|
|
|
|
std 4,40(10)
|
|
|
|
std 4,48(10)
|
|
|
|
std 4,56(10)
|
|
|
|
addi 10,10,64
|
|
|
|
.align 4
|
|
|
|
4: bf 29,2f
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
std 4,8(10)
|
|
|
|
std 4,16(10)
|
|
|
|
std 4,24(10)
|
|
|
|
addi 10,10,32
|
|
|
|
.align 4
|
|
|
|
2: bf 30,1f
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
std 4,8(10)
|
|
|
|
addi 10,10,16
|
|
|
|
.align 4
|
|
|
|
1: bf 31,L(tail)
|
|
|
|
|
|
|
|
std 4,0(10)
|
|
|
|
addi 10,10,8
|
|
|
|
|
|
|
|
/* Handle the rest of the tail bytes here. */
|
|
|
|
L(tail):
|
|
|
|
mtocrf 0x01,5
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
4: bf 29,2f
|
|
|
|
|
|
|
|
stw 4,0(10)
|
|
|
|
addi 10,10,4
|
|
|
|
.align 4
|
|
|
|
2: bf 30,1f
|
|
|
|
|
|
|
|
sth 4,0(10)
|
|
|
|
addi 10,10,2
|
|
|
|
.align 4
|
|
|
|
1: bflr 31
|
|
|
|
|
|
|
|
stb 4,0(10)
|
|
|
|
blr
|
|
|
|
|
|
|
|
/* Expanded tree to copy tail bytes without increments. */
|
|
|
|
.align 4
|
|
|
|
L(copy_tail):
|
|
|
|
bf 29,L(FXX)
|
|
|
|
|
|
|
|
stw 4,0(10)
|
|
|
|
bf 30,L(TFX)
|
|
|
|
|
|
|
|
sth 4,4(10)
|
|
|
|
bflr 31
|
|
|
|
|
|
|
|
stb 4,6(10)
|
|
|
|
blr
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(FXX): bf 30,L(FFX)
|
|
|
|
|
|
|
|
sth 4,0(10)
|
|
|
|
bflr 31
|
|
|
|
|
|
|
|
stb 4,2(10)
|
|
|
|
blr
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(TFX): bflr 31
|
|
|
|
|
|
|
|
stb 4,4(10)
|
|
|
|
blr
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(FFX): bflr 31
|
|
|
|
|
|
|
|
stb 4,0(10)
|
|
|
|
blr
|
|
|
|
|
|
|
|
/* Handle copies of 9~31 bytes. */
|
|
|
|
.align 4
|
|
|
|
L(medium):
|
|
|
|
/* At least 9 bytes to go. */
|
|
|
|
andi. 11,10,3
|
|
|
|
clrldi 0,0,62
|
|
|
|
beq L(medium_aligned)
|
|
|
|
|
2013-08-17 09:17:59 +00:00
|
|
|
/* Force 4-bytes alignment for DST. */
|
2010-05-20 11:35:05 +00:00
|
|
|
mtocrf 0x01,0
|
|
|
|
subf 5,0,5
|
|
|
|
1: /* Copy 1 byte. */
|
|
|
|
bf 31,2f
|
|
|
|
|
|
|
|
stb 4,0(10)
|
|
|
|
addi 10,10,1
|
|
|
|
2: /* Copy 2 bytes. */
|
|
|
|
bf 30,L(medium_aligned)
|
|
|
|
|
|
|
|
sth 4,0(10)
|
|
|
|
addi 10,10,2
|
|
|
|
|
|
|
|
.align 4
|
|
|
|
L(medium_aligned):
|
|
|
|
/* At least 6 bytes to go, and DST is word-aligned. */
|
|
|
|
cmpldi cr1,5,16
|
|
|
|
mtocrf 0x01,5
|
|
|
|
blt cr1,8f
|
|
|
|
|
|
|
|
/* Copy 16 bytes. */
|
|
|
|
stw 4,0(10)
|
|
|
|
stw 4,4(10)
|
|
|
|
stw 4,8(10)
|
|
|
|
stw 4,12(10)
|
|
|
|
addi 10,10,16
|
|
|
|
8: /* Copy 8 bytes. */
|
|
|
|
bf 28,4f
|
|
|
|
|
|
|
|
stw 4,0(10)
|
|
|
|
stw 4,4(10)
|
|
|
|
addi 10,10,8
|
|
|
|
4: /* Copy 4 bytes. */
|
|
|
|
bf 29,2f
|
|
|
|
|
|
|
|
stw 4,0(10)
|
|
|
|
addi 10,10,4
|
|
|
|
2: /* Copy 2-3 bytes. */
|
|
|
|
bf 30,1f
|
|
|
|
|
|
|
|
sth 4,0(10)
|
|
|
|
addi 10,10,2
|
|
|
|
1: /* Copy 1 byte. */
|
|
|
|
bflr 31
|
|
|
|
|
|
|
|
stb 4,0(10)
|
|
|
|
blr
|
|
|
|
|
|
|
|
/* Handles copies of 0~8 bytes. */
|
|
|
|
.align 4
|
|
|
|
L(small):
|
|
|
|
mtocrf 0x01,5
|
|
|
|
bne cr6,L(copy_tail)
|
|
|
|
|
|
|
|
stw 4,0(10)
|
|
|
|
stw 4,4(10)
|
|
|
|
blr
|
|
|
|
|
2017-04-11 17:18:35 +00:00
|
|
|
END_GEN_TB (MEMSET,TB_TOCLESS)
|
2010-05-20 11:35:05 +00:00
|
|
|
libc_hidden_builtin_def (memset)
|
|
|
|
|
|
|
|
/* Copied from bzero.S to prevent the linker from inserting a stub
|
|
|
|
between bzero and memset. */
|
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 (__bzero)
|
2010-05-20 11:35:05 +00:00
|
|
|
CALL_MCOUNT 3
|
|
|
|
mr r5,r4
|
|
|
|
li r4,0
|
|
|
|
b L(_memset)
|
2014-07-15 20:54:46 +00:00
|
|
|
END (__bzero)
|
|
|
|
#ifndef __bzero
|
2013-03-06 00:10:21 +00:00
|
|
|
weak_alias (__bzero, bzero)
|
2013-12-13 19:33:16 +00:00
|
|
|
#endif
|