|
Packit |
6c4009 |
/* Vector optimized 32/64 bit S/390 version of wcscmp.
|
|
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 |
e7e1c2 |
#include <ifunc-wcscmp.h>
|
|
Packit Service |
e7e1c2 |
#if HAVE_WCSCMP_Z13
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# include "sysdep.h"
|
|
Packit |
6c4009 |
# include "asm-syntax.h"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.text
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* int wcscmp (const wchar_t *s1, const wchar_t *s2)
|
|
Packit |
6c4009 |
Compare two strings
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
Register usage:
|
|
Packit |
6c4009 |
-r1=loaded byte count s1
|
|
Packit |
6c4009 |
-r2=s1
|
|
Packit |
6c4009 |
-r3=s2
|
|
Packit |
6c4009 |
-r4=loaded byte coutn s2, tmp
|
|
Packit |
6c4009 |
-r5=current_len
|
|
Packit |
6c4009 |
-v16=part of s1
|
|
Packit |
6c4009 |
-v17=part of s2
|
|
Packit |
6c4009 |
-v18=index of unequal
|
|
Packit |
6c4009 |
*/
|
|
Packit Service |
e7e1c2 |
ENTRY(WCSCMP_Z13)
|
|
Packit |
6c4009 |
.machine "z13"
|
|
Packit |
6c4009 |
.machinemode "zarch_nohighgprs"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
lghi %r5,0 /* current_len = 0. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.Lloop:
|
|
Packit |
6c4009 |
vlbb %v16,0(%r5,%r2),6 /* Load s1 to block boundary. */
|
|
Packit |
6c4009 |
vlbb %v17,0(%r5,%r3),6 /* Load s2 to block boundary. */
|
|
Packit |
6c4009 |
lcbb %r1,0(%r5,%r2),6 /* Get loaded byte count of s1. */
|
|
Packit |
6c4009 |
jo .Llt16_1 /* Jump away if vr is not fully loaded. */
|
|
Packit |
6c4009 |
lcbb %r4,0(%r5,%r3),6
|
|
Packit |
6c4009 |
jo .Llt16_2 /* Jump away if vr is not fully loaded. */
|
|
Packit |
6c4009 |
/* Both vrs are fully loaded. */
|
|
Packit |
6c4009 |
aghi %r5,16
|
|
Packit |
6c4009 |
vfenezfs %v18,%v16,%v17 /* Compare not equal with zero search. */
|
|
Packit |
6c4009 |
jno .Lfound
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
vlbb %v16,0(%r5,%r2),6
|
|
Packit |
6c4009 |
vlbb %v17,0(%r5,%r3),6
|
|
Packit |
6c4009 |
lcbb %r1,0(%r5,%r2),6
|
|
Packit |
6c4009 |
jo .Llt16_1
|
|
Packit |
6c4009 |
lcbb %r4,0(%r5,%r3),6
|
|
Packit |
6c4009 |
jo .Llt16_2
|
|
Packit |
6c4009 |
aghi %r5,16
|
|
Packit |
6c4009 |
vfenezfs %v18,%v16,%v17
|
|
Packit |
6c4009 |
jno .Lfound
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
vlbb %v16,0(%r5,%r2),6
|
|
Packit |
6c4009 |
vlbb %v17,0(%r5,%r3),6
|
|
Packit |
6c4009 |
lcbb %r1,0(%r5,%r2),6
|
|
Packit |
6c4009 |
jo .Llt16_1
|
|
Packit |
6c4009 |
lcbb %r4,0(%r5,%r3),6
|
|
Packit |
6c4009 |
jo .Llt16_2
|
|
Packit |
6c4009 |
aghi %r5,16
|
|
Packit |
6c4009 |
vfenezfs %v18,%v16,%v17
|
|
Packit |
6c4009 |
jno .Lfound
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
vlbb %v16,0(%r5,%r2),6
|
|
Packit |
6c4009 |
vlbb %v17,0(%r5,%r3),6
|
|
Packit |
6c4009 |
lcbb %r1,0(%r5,%r2),6
|
|
Packit |
6c4009 |
jo .Llt16_1
|
|
Packit |
6c4009 |
lcbb %r4,0(%r5,%r3),6
|
|
Packit |
6c4009 |
jo .Llt16_2
|
|
Packit |
6c4009 |
aghi %r5,16
|
|
Packit |
6c4009 |
vfenezfs %v18,%v16,%v17
|
|
Packit |
6c4009 |
jno .Lfound
|
|
Packit |
6c4009 |
j .Lloop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.Lcmp_one_char:
|
|
Packit |
6c4009 |
/* At least one of both strings is not 4-byte aligned
|
|
Packit |
6c4009 |
and there is no full character before next block-boundary.
|
|
Packit |
6c4009 |
Compare one character to get over the boundary and
|
|
Packit |
6c4009 |
proceed with normal loop! */
|
|
Packit |
6c4009 |
vlef %v16,0(%r5,%r2),0 /* Load one character. */
|
|
Packit |
6c4009 |
vlef %v17,0(%r5,%r3),0
|
|
Packit |
6c4009 |
lghi %r1,4 /* Loaded byte count is 4. */
|
|
Packit |
6c4009 |
j .Llt_cmp /* Proceed with comparision. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.Llt16_1:
|
|
Packit |
6c4009 |
lcbb %r4,0(%r5,%r3),6 /* Get loaded byte count of s2. */
|
|
Packit |
6c4009 |
.Llt16_2:
|
|
Packit |
6c4009 |
clr %r1,%r4
|
|
Packit |
6c4009 |
locrh %r1,%r4 /* Get minimum of bytes loaded in s1/2. */
|
|
Packit |
6c4009 |
nill %r1,65532 /* Align bytes loaded to full characters. */
|
|
Packit |
6c4009 |
jz .Lcmp_one_char /* Jump away if no full char is available. */
|
|
Packit |
6c4009 |
.Llt_cmp:
|
|
Packit |
6c4009 |
algfr %r5,%r1 /* Add smallest loaded bytes to current_len. */
|
|
Packit |
6c4009 |
vfenezfs %v18,%v16,%v17 /* Compare not equal with zero search. */
|
|
Packit |
6c4009 |
vlgvb %r4,%v18,7 /* Get not equal index or 16 if all equal. */
|
|
Packit |
6c4009 |
clrjl %r4,%r1,.Lfound /* Jump away if miscompare is within loaded
|
|
Packit |
6c4009 |
bytes. */
|
|
Packit |
6c4009 |
j .Lloop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.Lfound:
|
|
Packit |
6c4009 |
/* vfenezf found an unequal element or zero.
|
|
Packit |
6c4009 |
This instruction compares unsigned words, but wchar_t is signed.
|
|
Packit |
6c4009 |
Thus we have to compare the found element again. */
|
|
Packit |
6c4009 |
vlgvb %r4,%v18,7 /* Extract not equal byte-index, */
|
|
Packit |
6c4009 |
srl %r4,2 /* Convert it to character-index. */
|
|
Packit |
6c4009 |
vlgvf %r3,%v16,0(%r4) /* Load character-values. */
|
|
Packit |
6c4009 |
vlgvf %r4,%v17,0(%r4)
|
|
Packit |
6c4009 |
cr %r3,%r4
|
|
Packit |
6c4009 |
je .Lend_equal
|
|
Packit |
6c4009 |
lghi %r2,1
|
|
Packit |
6c4009 |
lghi %r1,-1
|
|
Packit |
6c4009 |
locgrl %r2,%r1
|
|
Packit |
6c4009 |
br %r14
|
|
Packit |
6c4009 |
.Lend_equal:
|
|
Packit |
6c4009 |
lghi %r2,0
|
|
Packit |
6c4009 |
br %r14
|
|
Packit Service |
e7e1c2 |
END(WCSCMP_Z13)
|
|
Packit Service |
e7e1c2 |
|
|
Packit Service |
e7e1c2 |
# if ! HAVE_WCSCMP_IFUNC
|
|
Packit Service |
e7e1c2 |
strong_alias (WCSCMP_Z13, __wcscmp)
|
|
Packit Service |
e7e1c2 |
weak_alias (__wcscmp, wcscmp)
|
|
Packit Service |
e7e1c2 |
# endif
|
|
Packit Service |
e7e1c2 |
|
|
Packit Service |
e7e1c2 |
# if ! HAVE_WCSCMP_C && defined SHARED && IS_IN (libc)
|
|
Packit Service |
e7e1c2 |
strong_alias (WCSCMP_Z13, __GI___wcscmp)
|
|
Packit Service |
e7e1c2 |
# endif
|
|
Packit Service |
e7e1c2 |
#endif
|