|
Packit Service |
82fcde |
/* Vector optimized 32/64 bit S/390 version of wcschrnul.
|
|
Packit Service |
82fcde |
Copyright (C) 2015-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
This file is part of the GNU C Library.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License as published by the Free Software Foundation; either
|
|
Packit Service |
82fcde |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
82fcde |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with the GNU C Library; if not, see
|
|
Packit Service |
82fcde |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
95c0d3 |
#include <ifunc-wcschrnul.h>
|
|
Packit Service |
95c0d3 |
#if HAVE_WCSCHRNUL_Z13
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
# include "sysdep.h"
|
|
Packit Service |
82fcde |
# include "asm-syntax.h"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.text
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* wchar_t* wcschrnul (const wchar_t *s, wchar_t c)
|
|
Packit Service |
82fcde |
Returns pointer to first c or to \0 if c not found.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
Register usage:
|
|
Packit Service |
82fcde |
-r1=tmp
|
|
Packit Service |
82fcde |
-r2=s and return pointer
|
|
Packit Service |
82fcde |
-r3=c
|
|
Packit Service |
82fcde |
-r4=tmp
|
|
Packit Service |
82fcde |
-r5=current_len
|
|
Packit Service |
82fcde |
-v16=part of s
|
|
Packit Service |
82fcde |
-v18=vector with c replicated in every byte
|
|
Packit Service |
82fcde |
*/
|
|
Packit Service |
95c0d3 |
ENTRY(WCSCHRNUL_Z13)
|
|
Packit Service |
82fcde |
.machine "z13"
|
|
Packit Service |
82fcde |
.machinemode "zarch_nohighgprs"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
vlbb %v16,0(%r2),6 /* Load s until next 4k-byte boundary. */
|
|
Packit Service |
82fcde |
lcbb %r1,0(%r2),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
tmll %r2,3 /* Test if s is 4-byte aligned? */
|
|
Packit Service |
82fcde |
jne .Lfallback /* And use common-code variant if not. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
lghi %r5,0 /* current_len = 0. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
vlvgf %v18,%r3,0 /* Generate vector which elements are all c. */
|
|
Packit Service |
82fcde |
vrepf %v18,%v18,0
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
vfeezfs %v16,%v16,%v18 /* Find element equal with zero search. */
|
|
Packit Service |
82fcde |
vlgvb %r4,%v16,7 /* Load byte index of character or zero. */
|
|
Packit Service |
82fcde |
clrjl %r4,%r1,.Lfound /* Return if c/zero is in loaded bytes. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Align s to 16 byte. */
|
|
Packit Service |
82fcde |
risbgn %r4,%r2,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15. */
|
|
Packit Service |
82fcde |
lghi %r5,16 /* current_len = 16. */
|
|
Packit Service |
82fcde |
slr %r5,%r4 /* Compute bytes to 16bytes boundary. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Find c/zero in 16byte aligned loop */
|
|
Packit Service |
82fcde |
.Lloop:
|
|
Packit Service |
82fcde |
vl %v16,0(%r5,%r2) /* Load s. */
|
|
Packit Service |
82fcde |
vfeezfs %v16,%v16,%v18 /* Find element equal with zero search. */
|
|
Packit Service |
82fcde |
jno .Lfound /* Found c/zero (cc=0|1|2). */
|
|
Packit Service |
82fcde |
vl %v16,16(%r5,%r2)
|
|
Packit Service |
82fcde |
vfeezfs %v16,%v16,%v18
|
|
Packit Service |
82fcde |
jno .Lfound16
|
|
Packit Service |
82fcde |
vl %v16,32(%r5,%r2)
|
|
Packit Service |
82fcde |
vfeezfs %v16,%v16,%v18
|
|
Packit Service |
82fcde |
jno .Lfound32
|
|
Packit Service |
82fcde |
vl %v16,48(%r5,%r2)
|
|
Packit Service |
82fcde |
vfeezfs %v16,%v16,%v18
|
|
Packit Service |
82fcde |
jno .Lfound48
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
aghi %r5,64
|
|
Packit Service |
82fcde |
j .Lloop /* No character and no zero -> loop. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Found character or zero */
|
|
Packit Service |
82fcde |
.Lfound48:
|
|
Packit Service |
82fcde |
aghi %r5,16
|
|
Packit Service |
82fcde |
.Lfound32:
|
|
Packit Service |
82fcde |
aghi %r5,16
|
|
Packit Service |
82fcde |
.Lfound16:
|
|
Packit Service |
82fcde |
aghi %r5,16
|
|
Packit Service |
82fcde |
.Lfound:
|
|
Packit Service |
82fcde |
vlgvb %r1,%v16,7 /* Load byte index of character. */
|
|
Packit Service |
82fcde |
algr %r5,%r1
|
|
Packit Service |
82fcde |
la %r2,0(%r5,%r2) /* Return pointer to character. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.Lend:
|
|
Packit Service |
82fcde |
br %r14
|
|
Packit Service |
82fcde |
.Lfallback:
|
|
Packit Service |
95c0d3 |
jg WCSCHRNUL_C
|
|
Packit Service |
95c0d3 |
END(WCSCHRNUL_Z13)
|
|
Packit Service |
95c0d3 |
|
|
Packit Service |
95c0d3 |
# if ! HAVE_WCSCHRNUL_IFUNC
|
|
Packit Service |
95c0d3 |
strong_alias (WCSCHRNUL_Z13, __wcschrnul)
|
|
Packit Service |
95c0d3 |
weak_alias (__wcschrnul, wcschrnul)
|
|
Packit Service |
95c0d3 |
# endif
|
|
Packit Service |
95c0d3 |
#endif
|