|
Packit |
6c4009 |
/* Vector optimized 32/64 bit S/390 version of strcpy.
|
|
Packit |
6c4009 |
Copyright (C) 2015-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
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 Service |
a23f65 |
#include <ifunc-strcpy.h>
|
|
Packit Service |
a23f65 |
#include "sysdep.h"
|
|
Packit Service |
a23f65 |
#include "asm-syntax.h"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.text
|
|
Packit |
6c4009 |
|
|
Packit Service |
a23f65 |
#if HAVE_STRCPY_Z13
|
|
Packit |
6c4009 |
/* char * strcpy (const char *dest, const char *src)
|
|
Packit |
6c4009 |
Copy string src to dest.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
Register usage:
|
|
Packit |
6c4009 |
-r1=tmp
|
|
Packit |
6c4009 |
-r2=dest and return_value
|
|
Packit |
6c4009 |
-r3=src
|
|
Packit |
6c4009 |
-r4=tmp
|
|
Packit |
6c4009 |
-r5=current_len
|
|
Packit |
6c4009 |
-v16=part of src
|
|
Packit |
6c4009 |
-v17=index of zero
|
|
Packit |
6c4009 |
-v18=part of src
|
|
Packit |
6c4009 |
*/
|
|
Packit Service |
a23f65 |
ENTRY(STRCPY_Z13)
|
|
Packit |
6c4009 |
.machine "z13"
|
|
Packit |
6c4009 |
.machinemode "zarch_nohighgprs"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
vlbb %v16,0(%r3),6 /* Load s until next 4k-byte boundary. */
|
|
Packit |
6c4009 |
lcbb %r1,0(%r3),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
vfenezb %v17,%v16,%v16 /* Find element not equal with zero search. */
|
|
Packit |
6c4009 |
vlgvb %r5,%v17,7 /* Load zero index or 16 if not found. */
|
|
Packit |
6c4009 |
clrjl %r5,%r1,.Lfound_align /* If found zero within loaded bytes,
|
|
Packit |
6c4009 |
copy bytes before and return. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Align s to 16 byte. */
|
|
Packit |
6c4009 |
risbgn %r4,%r3,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15. */
|
|
Packit |
6c4009 |
lghi %r5,15 /* current_len = 15. */
|
|
Packit |
6c4009 |
slr %r5,%r4 /* Compute highest index to 16byte boundary. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
vstl %v16,%r5,0(%r2) /* Copy loaded characters - no zero. */
|
|
Packit |
6c4009 |
ahi %r5,1 /* Start loop at next character. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Find zero in 16byte aligned loop. */
|
|
Packit |
6c4009 |
.Lloop:
|
|
Packit |
6c4009 |
vl %v16,0(%r5,%r3) /* Load s. */
|
|
Packit |
6c4009 |
vfenezbs %v17,%v16,%v16 /* Find element not equal with zero search. */
|
|
Packit |
6c4009 |
je .Lfound_v16_0 /* Jump away if zero was found. */
|
|
Packit |
6c4009 |
vl %v18,16(%r5,%r3)/* Load next part of s. */
|
|
Packit |
6c4009 |
vst %v16,0(%r5,%r2) /* Store previous part without zero to dst. */
|
|
Packit |
6c4009 |
vfenezbs %v17,%v18,%v18
|
|
Packit |
6c4009 |
je .Lfound_v18_16
|
|
Packit |
6c4009 |
vl %v16,32(%r5,%r3)
|
|
Packit |
6c4009 |
vst %v18,16(%r5,%r2)
|
|
Packit |
6c4009 |
vfenezbs %v17,%v16,%v16
|
|
Packit |
6c4009 |
je .Lfound_v16_32
|
|
Packit |
6c4009 |
vl %v18,48(%r5,%r3)
|
|
Packit |
6c4009 |
vst %v16,32(%r5,%r2)
|
|
Packit |
6c4009 |
vfenezbs %v17,%v18,%v18
|
|
Packit |
6c4009 |
je .Lfound_v18_48
|
|
Packit |
6c4009 |
vst %v18,48(%r5,%r2)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
aghi %r5,64
|
|
Packit |
6c4009 |
j .Lloop /* No zero found -> loop. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.Lfound_v16_32:
|
|
Packit |
6c4009 |
aghi %r5,32
|
|
Packit |
6c4009 |
.Lfound_v16_0:
|
|
Packit |
6c4009 |
la %r3,0(%r5,%r2)
|
|
Packit |
6c4009 |
vlgvb %r4,%v17,7 /* Load byte index of zero. */
|
|
Packit |
6c4009 |
vstl %v16,%r4,0(%r3) /* Store characters including zero. */
|
|
Packit |
6c4009 |
br %r14
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.Lfound_v18_48:
|
|
Packit |
6c4009 |
aghi %r5,32
|
|
Packit |
6c4009 |
.Lfound_v18_16:
|
|
Packit |
6c4009 |
la %r3,16(%r5,%r2)
|
|
Packit |
6c4009 |
vlgvb %r4,%v17,7 /* Load byte index of zero. */
|
|
Packit |
6c4009 |
vstl %v18,%r4,0(%r3) /* Store characters including zero. */
|
|
Packit |
6c4009 |
br %r14
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.Lfound_align:
|
|
Packit |
6c4009 |
vstl %v16,%r5,0(%r2) /* Copy characters including zero. */
|
|
Packit |
6c4009 |
br %r14
|
|
Packit Service |
a23f65 |
END(STRCPY_Z13)
|
|
Packit |
6c4009 |
|
|
Packit Service |
a23f65 |
# if ! HAVE_STRCPY_IFUNC
|
|
Packit Service |
a23f65 |
strong_alias (STRCPY_Z13, strcpy)
|
|
Packit Service |
a23f65 |
# endif
|
|
Packit |
6c4009 |
|
|
Packit Service |
a23f65 |
# if ! HAVE_STRCPY_Z900_G5 && defined SHARED && IS_IN (libc)
|
|
Packit Service |
a23f65 |
strong_alias (STRCPY_Z13, __GI_strcpy)
|
|
Packit Service |
a23f65 |
# endif
|
|
Packit Service |
a23f65 |
#endif
|