|
Packit Service |
93dc7a |
/* Vector optimized 32/64 bit S/390 version of wcscpy.
|
|
Packit Service |
93dc7a |
Copyright (C) 2015-2018 Free Software Foundation, Inc.
|
|
Packit Service |
93dc7a |
This file is part of the GNU C Library.
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
93dc7a |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
93dc7a |
License as published by the Free Software Foundation; either
|
|
Packit Service |
93dc7a |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
93dc7a |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
93dc7a |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
93dc7a |
Lesser General Public License for more details.
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
93dc7a |
License along with the GNU C Library; if not, see
|
|
Packit Service |
93dc7a |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
#if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
# include "sysdep.h"
|
|
Packit Service |
93dc7a |
# include "asm-syntax.h"
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
.text
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
/* char * wcscpy (const wchar_t *dest, const wchar_t *src)
|
|
Packit Service |
93dc7a |
Copy string src to dest.
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
Register usage:
|
|
Packit Service |
93dc7a |
-r0=border-len for switching to vector-instructions
|
|
Packit Service |
93dc7a |
-r1=tmp
|
|
Packit Service |
93dc7a |
-r2=dest and return value
|
|
Packit Service |
93dc7a |
-r3=src
|
|
Packit Service |
93dc7a |
-r4=tmp
|
|
Packit Service |
93dc7a |
-r5=current_len
|
|
Packit Service |
93dc7a |
-v16=part of src
|
|
Packit Service |
93dc7a |
-v17=index of zero
|
|
Packit Service |
93dc7a |
-v18=part of src
|
|
Packit Service |
93dc7a |
*/
|
|
Packit Service |
93dc7a |
ENTRY(__wcscpy_vx)
|
|
Packit Service |
93dc7a |
.machine "z13"
|
|
Packit Service |
93dc7a |
.machinemode "zarch_nohighgprs"
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
vlbb %v16,0(%r3),6 /* Load s until next 4k-byte boundary. */
|
|
Packit Service |
93dc7a |
lcbb %r1,0(%r3),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
tmll %r3,3 /* Test if s is 4-byte aligned? */
|
|
Packit Service |
93dc7a |
jne .Lfallback /* And use common-code variant if not. */
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
vfenezf %v17,%v16,%v16 /* Find element not equal with zero search. */
|
|
Packit Service |
93dc7a |
vlgvb %r5,%v17,7 /* Load zero index or 16 if not found. */
|
|
Packit Service |
93dc7a |
clrjl %r5,%r1,.Lfound_align /* If found zero within loaded bytes,
|
|
Packit Service |
93dc7a |
copy bytes before and return. */
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
/* Align s to 16 byte. */
|
|
Packit Service |
93dc7a |
risbgn %r4,%r3,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15. */
|
|
Packit Service |
93dc7a |
lghi %r5,15 /* current_len = 15. */
|
|
Packit Service |
93dc7a |
slr %r5,%r4 /* Compute highest index to 16byte boundary. */
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
vstl %v16,%r5,0(%r2) /* Copy loaded characters - no zero. */
|
|
Packit Service |
93dc7a |
ahi %r5,1 /* Start loop at next character. */
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
/* Find zero in 16byte aligned loop. */
|
|
Packit Service |
93dc7a |
.Lloop:
|
|
Packit Service |
93dc7a |
vl %v16,0(%r5,%r3) /* Load s. */
|
|
Packit Service |
93dc7a |
vfenezfs %v17,%v16,%v16 /* Find element not equal with zero search. */
|
|
Packit Service |
93dc7a |
je .Lfound_v16_0 /* Jump away if zero was found. */
|
|
Packit Service |
93dc7a |
vl %v18,16(%r5,%r3) /* Load next part of s. */
|
|
Packit Service |
93dc7a |
vst %v16,0(%r5,%r2) /* Store previous part without zero to dst. */
|
|
Packit Service |
93dc7a |
vfenezfs %v17,%v18,%v18
|
|
Packit Service |
93dc7a |
je .Lfound_v18_16
|
|
Packit Service |
93dc7a |
vl %v16,32(%r5,%r3)
|
|
Packit Service |
93dc7a |
vst %v18,16(%r5,%r2)
|
|
Packit Service |
93dc7a |
vfenezfs %v17,%v16,%v16
|
|
Packit Service |
93dc7a |
je .Lfound_v16_32
|
|
Packit Service |
93dc7a |
vl %v18,48(%r5,%r3)
|
|
Packit Service |
93dc7a |
vst %v16,32(%r5,%r2)
|
|
Packit Service |
93dc7a |
vfenezfs %v17,%v18,%v18
|
|
Packit Service |
93dc7a |
je .Lfound_v18_48
|
|
Packit Service |
93dc7a |
vst %v18,48(%r5,%r2)
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
aghi %r5,64
|
|
Packit Service |
93dc7a |
j .Lloop /* No zero found -> loop. */
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
.Lfound_v16_32:
|
|
Packit Service |
93dc7a |
aghi %r5,32
|
|
Packit Service |
93dc7a |
.Lfound_v16_0:
|
|
Packit Service |
93dc7a |
la %r3,0(%r5,%r2)
|
|
Packit Service |
93dc7a |
vlgvb %r1,%v17,7 /* Load byte index of zero. */
|
|
Packit Service |
93dc7a |
aghi %r1,3 /* Also copy remaining bytes of zero. */
|
|
Packit Service |
93dc7a |
vstl %v16,%r1,0(%r3) /* Copy characters including zero. */
|
|
Packit Service |
93dc7a |
br %r14
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
.Lfound_v18_48:
|
|
Packit Service |
93dc7a |
aghi %r5,32
|
|
Packit Service |
93dc7a |
.Lfound_v18_16:
|
|
Packit Service |
93dc7a |
la %r3,16(%r5,%r2)
|
|
Packit Service |
93dc7a |
vlgvb %r1,%v17,7 /* Load byte index of zero. */
|
|
Packit Service |
93dc7a |
aghi %r1,3 /* Also copy remaining bytes of zero. */
|
|
Packit Service |
93dc7a |
vstl %v18,%r1,0(%r3) /* Copy characters including zero. */
|
|
Packit Service |
93dc7a |
br %r14
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
.Lfound_align:
|
|
Packit Service |
93dc7a |
aghi %r5,3 /* Also copy remaining bytes of zero. */
|
|
Packit Service |
93dc7a |
vstl %v16,%r5,0(%r2) /* Copy characters including zero. */
|
|
Packit Service |
93dc7a |
br %r14
|
|
Packit Service |
93dc7a |
|
|
Packit Service |
93dc7a |
.Lfallback:
|
|
Packit Service |
93dc7a |
jg __wcscpy_c
|
|
Packit Service |
93dc7a |
END(__wcscpy_vx)
|
|
Packit Service |
93dc7a |
#endif /* HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc) */
|