1 /* Vector optimized 32/64 bit S/390 version of strcmp.
2 Copyright (C) 2015-2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <ifunc-strcmp.h>
23 # include "asm-syntax.h"
27 /* int strcmp (const char *s1, const char *s2)
31 -r1=loaded byte count s1
34 -r4=loaded byte coutn s2, tmp
42 .machinemode "zarch_nohighgprs"
44 lghi %r5,0 /* current_len = 0. */
47 vlbb %v16,0(%r5,%r2),6 /* Load s1 to block boundary. */
48 vlbb %v17,0(%r5,%r3),6 /* Load s2 to block boundary. */
49 lcbb %r1,0(%r5,%r2),6 /* Get loaded byte count of s1. */
50 jo .Llt16_1 /* Jump away if vr is not fully loaded. */
52 jo .Llt16_2 /* Jump away if vr is not fully loaded. */
53 /* Both vrs are fully loaded. */
55 vfenezbs %v18,%v16,%v17 /* Compare not equal with zero search. */
58 vlbb %v16,0(%r5,%r2),6
59 vlbb %v17,0(%r5,%r3),6
65 vfenezbs %v18,%v16,%v17
68 vlbb %v16,0(%r5,%r2),6
69 vlbb %v17,0(%r5,%r3),6
75 vfenezbs %v18,%v16,%v17
78 vlbb %v16,0(%r5,%r2),6
79 vlbb %v17,0(%r5,%r3),6
85 vfenezbs %v18,%v16,%v17
90 lcbb %r4,0(%r5,%r3),6 /* Get loaded byte count of s2. */
93 locrh %r1,%r4 /* Get minimum of bytes loaded in s1/2. */
94 algfr %r5,%r1 /* Add smallest loaded bytes to current_len. */
95 vfenezbs %v18,%v16,%v17 /* Compare not equal with zero search. */
96 vlgvb %r4,%v18,7 /* Get not equal index or 16 if all equal. */
97 clrjl %r4,%r1,.Lfound /* Jump away if miscompare is within loaded
112 # if ! HAVE_STRCMP_IFUNC
113 strong_alias (STRCMP_Z13, strcmp)
116 # if ! HAVE_STRCMP_Z900_G5 && defined SHARED && IS_IN (libc)
117 strong_alias (STRCMP_Z13, __GI_strcmp)