00db10
From 0b3ff29b298c488ab995d4224da2cc36fb56ddce Mon Sep 17 00:00:00 2001
00db10
From: Stefan Liebler <stli@linux.vnet.ibm.com>
00db10
Date: Thu, 8 Oct 2015 11:25:00 +0200
00db10
Subject: [PATCH 20/30] S390: Optimize strchr and wcschr.
00db10
00db10
upstream-commit-id: cf150d45a97c6bb8410d6d3acf6e1560e8fe96cc
00db10
https://www.sourceware.org/ml/libc-alpha/2015-07/msg00094.html
00db10
00db10
This patch provides optimized versions of strchr and wcschr with the z13
00db10
vector instructions.
00db10
00db10
ChangeLog:
00db10
00db10
	* sysdeps/s390/multiarch/strchr-c.c: New File.
00db10
	* sysdeps/s390/multiarch/strchr-vx.S: Likewise.
00db10
	* sysdeps/s390/multiarch/strchr.c: Likewise.
00db10
	* sysdeps/s390/multiarch/wcschr-c.c: Likewise.
00db10
	* sysdeps/s390/multiarch/wcschr-vx.S: Likewise.
00db10
	* sysdeps/s390/multiarch/wcschr.c: Likewise.
00db10
	* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strchr and
00db10
	wcschr functions.
00db10
	* sysdeps/s390/multiarch/ifunc-impl-list.c
00db10
	(__libc_ifunc_impl_list): Add ifunc test for strchr, wcschr.
00db10
	* string/strchr.c (STRCHR): Define and use macro.
00db10
	* benchtests/bench-wcschr.c: New File.
00db10
	* benchtests/Makefile (wcsmbs-bench): Add wcschr.
00db10
---
00db10
 benchtests/Makefile                      |   2 +-
00db10
 benchtests/bench-wcschr.c                |  20 ++++++
00db10
 string/strchr.c                          |   8 ++-
00db10
 sysdeps/s390/multiarch/Makefile          |   6 +-
00db10
 sysdeps/s390/multiarch/ifunc-impl-list.c |   3 +
00db10
 sysdeps/s390/multiarch/strchr-c.c        |  29 +++++++++
00db10
 sysdeps/s390/multiarch/strchr-vx.S       | 100 ++++++++++++++++++++++++++++++
00db10
 sysdeps/s390/multiarch/strchr.c          |  28 +++++++++
00db10
 sysdeps/s390/multiarch/wcschr-c.c        |  31 ++++++++++
00db10
 sysdeps/s390/multiarch/wcschr-vx.S       | 103 +++++++++++++++++++++++++++++++
00db10
 sysdeps/s390/multiarch/wcschr.c          |  27 ++++++++
00db10
 11 files changed, 351 insertions(+), 6 deletions(-)
00db10
 create mode 100644 benchtests/bench-wcschr.c
00db10
 create mode 100644 sysdeps/s390/multiarch/strchr-c.c
00db10
 create mode 100644 sysdeps/s390/multiarch/strchr-vx.S
00db10
 create mode 100644 sysdeps/s390/multiarch/strchr.c
00db10
 create mode 100644 sysdeps/s390/multiarch/wcschr-c.c
00db10
 create mode 100644 sysdeps/s390/multiarch/wcschr-vx.S
00db10
 create mode 100644 sysdeps/s390/multiarch/wcschr.c
00db10
00db10
diff --git a/benchtests/Makefile b/benchtests/Makefile
00db10
index f6342da..bcb0288 100644
00db10
--- a/benchtests/Makefile
00db10
+++ b/benchtests/Makefile
00db10
@@ -39,7 +39,7 @@ string-bench := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
00db10
 		strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
00db10
 		strspn strstr strcpy_chk stpcpy_chk memrchr strsep strtok
00db10
 wcsmbs-bench := wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat \
00db10
-		wcsncmp wcsncmp
00db10
+		wcsncmp wcsncmp wcschr
00db10
 string-bench-all := $(string-bench) ${wcsmbs-bench}
00db10
 
00db10
 stdlib-bench := strtod
00db10
diff --git a/benchtests/bench-wcschr.c b/benchtests/bench-wcschr.c
00db10
new file mode 100644
00db10
index 0000000..4287724
00db10
--- /dev/null
00db10
+++ b/benchtests/bench-wcschr.c
00db10
@@ -0,0 +1,20 @@
00db10
+/* Measure wcschr functions.
00db10
+   Copyright (C) 2015 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#define WIDE 1
00db10
+#include "bench-strchr.c"
00db10
diff --git a/string/strchr.c b/string/strchr.c
00db10
index 9d18b7e..69a9cd9 100644
00db10
--- a/string/strchr.c
00db10
+++ b/string/strchr.c
00db10
@@ -27,11 +27,13 @@
00db10
 
00db10
 #undef strchr
00db10
 
00db10
+#ifndef STRCHR
00db10
+# define STRCHR strchr
00db10
+#endif
00db10
+
00db10
 /* Find the first occurrence of C in S.  */
00db10
 char *
00db10
-strchr (s, c_in)
00db10
-     const char *s;
00db10
-     int c_in;
00db10
+STRCHR (const char *s, int c_in)
00db10
 {
00db10
   const unsigned char *char_ptr;
00db10
   const unsigned long int *longword_ptr;
00db10
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
00db10
index d77bee5..1a3673b 100644
00db10
--- a/sysdeps/s390/multiarch/Makefile
00db10
+++ b/sysdeps/s390/multiarch/Makefile
00db10
@@ -8,7 +8,8 @@ sysdep_routines += strlen strlen-vx strlen-c \
00db10
 		   strcat strcat-vx strcat-c \
00db10
 		   strncat strncat-vx strncat-c \
00db10
 		   strcmp strcmp-vx \
00db10
-		   strncmp strncmp-vx strncmp-c
00db10
+		   strncmp strncmp-vx strncmp-c \
00db10
+		   strchr strchr-vx strchr-c
00db10
 endif
00db10
 
00db10
 ifeq ($(subdir),wcsmbs)
00db10
@@ -21,5 +22,6 @@ sysdep_routines += wcslen wcslen-vx wcslen-c \
00db10
 		   wcscat wcscat-vx wcscat-c \
00db10
 		   wcsncat wcsncat-vx wcsncat-c \
00db10
 		   wcscmp wcscmp-vx wcscmp-c \
00db10
-		   wcsncmp wcsncmp-vx wcsncmp-c
00db10
+		   wcsncmp wcsncmp-vx wcsncmp-c \
00db10
+		   wcschr wcschr-vx wcschr-c
00db10
 endif
00db10
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
00db10
index 5bfc493..b0782ff 100644
00db10
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
00db10
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
00db10
@@ -109,6 +109,9 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
00db10
   IFUNC_VX_IMPL (strncmp);
00db10
   IFUNC_VX_IMPL (wcsncmp);
00db10
 
00db10
+  IFUNC_VX_IMPL (strchr);
00db10
+  IFUNC_VX_IMPL (wcschr);
00db10
+
00db10
 #endif /* HAVE_S390_VX_ASM_SUPPORT */
00db10
 
00db10
   return i;
00db10
diff --git a/sysdeps/s390/multiarch/strchr-c.c b/sysdeps/s390/multiarch/strchr-c.c
00db10
new file mode 100644
00db10
index 0000000..4384e6b
00db10
--- /dev/null
00db10
+++ b/sysdeps/s390/multiarch/strchr-c.c
00db10
@@ -0,0 +1,29 @@
00db10
+/* Default strchr implementation for S/390.
00db10
+   Copyright (C) 2015 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
00db10
+# define STRCHR  __strchr_c
00db10
+# undef weak_alias
00db10
+# ifdef SHARED
00db10
+#  undef libc_hidden_builtin_def
00db10
+#  define libc_hidden_builtin_def(name)				\
00db10
+     __hidden_ver1 (__strchr_c, __GI_strchr, __strchr_c);
00db10
+# endif /* SHARED */
00db10
+
00db10
+# include <string/strchr.c>
00db10
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
00db10
diff --git a/sysdeps/s390/multiarch/strchr-vx.S b/sysdeps/s390/multiarch/strchr-vx.S
00db10
new file mode 100644
00db10
index 0000000..26180df
00db10
--- /dev/null
00db10
+++ b/sysdeps/s390/multiarch/strchr-vx.S
00db10
@@ -0,0 +1,100 @@
00db10
+/* Vector optimized 32/64 bit S/390 version of strchr.
00db10
+   Copyright (C) 2015 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
00db10
+
00db10
+# include "sysdep.h"
00db10
+# include "asm-syntax.h"
00db10
+
00db10
+	.text
00db10
+
00db10
+/* char *strchr (const char *s, int c)
00db10
+   Locate character in string.
00db10
+
00db10
+   Register usage:
00db10
+   -r1=tmp
00db10
+   -r2=s
00db10
+   -r3=c
00db10
+   -r4=tmp
00db10
+   -r5=current_len
00db10
+   -v16=part of s
00db10
+   -v17=index of unequal
00db10
+   -v18=replicated c
00db10
+*/
00db10
+ENTRY(__strchr_vx)
00db10
+	.machine "z13"
00db10
+	.machinemode "zarch_nohighgprs"
00db10
+
00db10
+	vlbb	%v16,0(%r2),6	/* Load s until next 4k-byte boundary.  */
00db10
+	lcbb	%r1,0(%r2),6	/* Get bytes to 4k-byte boundary or 16.  */
00db10
+
00db10
+	lghi	%r5,0		/* current_len = 0.  */
00db10
+
00db10
+	vlvgb	%v18,%r3,0	/* Generate vector which elements are all c.
00db10
+				   If c > 255, c will be truncated.  */
00db10
+	vrepb	%v18,%v18,0
00db10
+
00db10
+	vfeezbs	%v16,%v16,%v18	/* Find element equal with zero search.  */
00db10
+	vlgvb	%r4,%v16,7	/* Load byte index of character or zero.  */
00db10
+	clrjl	%r4,%r1,.Lfound /* Return if c/zero is in loaded bytes.  */
00db10
+
00db10
+	/* Align s to 16 byte.  */
00db10
+	risbgn	%r4,%r2,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15.  */
00db10
+	lghi	%r5,16		/* current_len = 16.  */
00db10
+	slr	%r5,%r4		/* Compute bytes to 16bytes boundary.  */
00db10
+
00db10
+	/* Find c/zero in 16 byte aligned loop */
00db10
+.Lloop:
00db10
+	vl	%v16,0(%r5,%r2) /* Load s.  */
00db10
+	vfeezbs	%v16,%v16,%v18	/* Find element equal with zero search.  */
00db10
+	jno	.Lfound		/* Found c/zero (cc=0|1|2).  */
00db10
+	vl	%v16,16(%r5,%r2)
00db10
+	vfeezbs	%v16,%v16,%v18
00db10
+	jno	.Lfound16
00db10
+	vl	%v16,32(%r5,%r2)
00db10
+	vfeezbs	%v16,%v16,%v18
00db10
+	jno	.Lfound32
00db10
+	vl	%v16,48(%r5,%r2)
00db10
+	vfeezbs	%v16,%v16,%v18
00db10
+	jno	.Lfound48
00db10
+
00db10
+	aghi	%r5,64
00db10
+	j	.Lloop		/* No character and no zero -> loop.  */
00db10
+
00db10
+.Lfound48:
00db10
+	la	%r5,16(%r5)	/* Use la since aghi would clobber cc.  */
00db10
+.Lfound32:
00db10
+	la	%r5,16(%r5)
00db10
+.Lfound16:
00db10
+	la	%r5,16(%r5)
00db10
+.Lfound:
00db10
+	je	.Lzero		/* Found zero, but no c before that zero.  */
00db10
+
00db10
+.Lcharacter:
00db10
+	vlgvb	%r4,%v16,7	/* Load byte index of character.  */
00db10
+	algr	%r5,%r4
00db10
+	la	%r2,0(%r5,%r2)	/* Return pointer to character.  */
00db10
+	br	%r14
00db10
+
00db10
+.Lzero:
00db10
+	llgcr	%r3,%r3		/* char c_char = (char) c.  */
00db10
+	clije	%r3,0,.Lcharacter /* Found zero and c is zero.  */
00db10
+	lghi	%r2,0		/* Return null if character not found.  */
00db10
+	br	%r14
00db10
+END(__strchr_vx)
00db10
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
00db10
diff --git a/sysdeps/s390/multiarch/strchr.c b/sysdeps/s390/multiarch/strchr.c
00db10
new file mode 100644
00db10
index 0000000..e2a310f
00db10
--- /dev/null
00db10
+++ b/sysdeps/s390/multiarch/strchr.c
00db10
@@ -0,0 +1,28 @@
00db10
+/* Multiple versions of strchr.
00db10
+   Copyright (C) 2015 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
00db10
+# include <string.h>
00db10
+# include <ifunc-resolve.h>
00db10
+
00db10
+s390_vx_libc_ifunc2 (__strchr, strchr)
00db10
+weak_alias (strchr, index)
00db10
+
00db10
+#else
00db10
+# include <string/strchr.c>
00db10
+#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc) */
00db10
diff --git a/sysdeps/s390/multiarch/wcschr-c.c b/sysdeps/s390/multiarch/wcschr-c.c
00db10
new file mode 100644
00db10
index 0000000..ad7415e
00db10
--- /dev/null
00db10
+++ b/sysdeps/s390/multiarch/wcschr-c.c
00db10
@@ -0,0 +1,31 @@
00db10
+/* Default wcschr implementation for S/390.
00db10
+   Copyright (C) 2015 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
00db10
+# define WCSCHR  __wcschr_c
00db10
+
00db10
+# include <wchar.h>
00db10
+extern __typeof (wcschr) __wcschr_c;
00db10
+# ifdef SHARED
00db10
+#  undef libc_hidden_def
00db10
+#  define libc_hidden_def(name)					\
00db10
+  __hidden_ver1 (__wcschr_c, __GI_wcschr, __wcschr_c);
00db10
+# endif /* SHARED */
00db10
+
00db10
+# include <wcsmbs/wcschr.c>
00db10
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
00db10
diff --git a/sysdeps/s390/multiarch/wcschr-vx.S b/sysdeps/s390/multiarch/wcschr-vx.S
00db10
new file mode 100644
00db10
index 0000000..c1b3f6b
00db10
--- /dev/null
00db10
+++ b/sysdeps/s390/multiarch/wcschr-vx.S
00db10
@@ -0,0 +1,103 @@
00db10
+/* Vector optimized 32/64 bit S/390 version of wcschr.
00db10
+   Copyright (C) 2015 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
00db10
+
00db10
+# include "sysdep.h"
00db10
+# include "asm-syntax.h"
00db10
+
00db10
+	.text
00db10
+
00db10
+/* wchar_t *wcschr (const wchar_t *s, wchar_t c)
00db10
+   Locate character in string.
00db10
+
00db10
+   Register usage:
00db10
+   -r1=tmp
00db10
+   -r2=s
00db10
+   -r3=c
00db10
+   -r4=tmp
00db10
+   -r5=current_len
00db10
+   -v16=part of s
00db10
+   -v17=index of unequal
00db10
+   -v18=replicated c
00db10
+*/
00db10
+ENTRY(__wcschr_vx)
00db10
+	.machine "z13"
00db10
+	.machinemode "zarch_nohighgprs"
00db10
+
00db10
+	vlbb	%v16,0(%r2),6	/* Load s until next 4k-byte boundary.  */
00db10
+	lcbb	%r1,0(%r2),6	/* Get bytes to 4k-byte boundary or 16.  */
00db10
+
00db10
+	tmll	%r2,3		/* Test if s is 4-byte aligned?   */
00db10
+	jne	.Lfallback	/* And use common-code variant if not.  */
00db10
+
00db10
+	lghi	%r5,0		/* current_len = 0.  */
00db10
+
00db10
+	vlvgf	%v18,%r3,0	/* Generate vector which elements are all c.  */
00db10
+	vrepf	%v18,%v18,0
00db10
+
00db10
+	vfeezfs	%v16,%v16,%v18	/* Find element equal with zero search.  */
00db10
+	vlgvb	%r4,%v16,7	/* Load byte index of character or zero.  */
00db10
+	clrjl	%r4,%r1,.Lfound /* Return if c/zero is in loaded bytes.  */
00db10
+
00db10
+	/* Align s to 16 byte.  */
00db10
+	risbgn	%r4,%r2,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15.  */
00db10
+	lghi	%r5,16		/* current_len = 16.  */
00db10
+	slr	%r5,%r4		/* Compute bytes to 16bytes boundary.  */
00db10
+
00db10
+	/* Find c/zero in 16byte aligned loop */
00db10
+.Lloop:
00db10
+	vl	%v16,0(%r5,%r2) /* Load s.  */
00db10
+	vfeezfs	%v16,%v16,%v18	/* Find element equal with zero search.  */
00db10
+	jno	.Lfound		/* Found c/zero (cc=0|1|2).  */
00db10
+	vl	%v16,16(%r5,%r2)
00db10
+	vfeezfs	%v16,%v16,%v18
00db10
+	jno	.Lfound16
00db10
+	vl	%v16,32(%r5,%r2)
00db10
+	vfeezfs	%v16,%v16,%v18
00db10
+	jno	.Lfound32
00db10
+	vl	%v16,48(%r5,%r2)
00db10
+	vfeezfs	%v16,%v16,%v18
00db10
+	jno	.Lfound48
00db10
+
00db10
+	aghi	%r5,64
00db10
+	j	.Lloop		/* No character and no zero -> loop.  */
00db10
+
00db10
+.Lfound48:
00db10
+	la	%r5,16(%r5)	/* Use la since aghi would clobber cc.  */
00db10
+.Lfound32:
00db10
+	la	%r5,16(%r5)
00db10
+.Lfound16:
00db10
+	la	%r5,16(%r5)
00db10
+.Lfound:
00db10
+	je	.Lzero		/* Found zero, but no c before that zero.  */
00db10
+
00db10
+.Lcharacter:
00db10
+	vlgvb	%r4,%v16,7	/* Load byte index of character.  */
00db10
+	algr	%r5,%r4
00db10
+	la	%r2,0(%r5,%r2)	/* Return pointer to character.  */
00db10
+	br	%r14
00db10
+
00db10
+.Lzero:
00db10
+	clije	%r3,0,.Lcharacter /* Found zero and c is zero.  */
00db10
+	lghi	%r2,0		/* Return null if character not found.  */
00db10
+	br	%r14
00db10
+.Lfallback:
00db10
+	jg	__wcschr_c
00db10
+END(__wcschr_vx)
00db10
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
00db10
diff --git a/sysdeps/s390/multiarch/wcschr.c b/sysdeps/s390/multiarch/wcschr.c
00db10
new file mode 100644
00db10
index 0000000..9c8c097
00db10
--- /dev/null
00db10
+++ b/sysdeps/s390/multiarch/wcschr.c
00db10
@@ -0,0 +1,27 @@
00db10
+/* Multiple versions of wcschr.
00db10
+   Copyright (C) 2015 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
00db10
+# include <wchar.h>
00db10
+# include <ifunc-resolve.h>
00db10
+
00db10
+s390_vx_libc_ifunc2 (__wcschr, wcschr)
00db10
+
00db10
+#else
00db10
+# include <wcsmbs/wcschr.c>
00db10
+#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc) */
00db10
-- 
00db10
2.3.0
00db10