|
|
00db10 |
From 685417419834a85cd5d59787c25e487cd7129890 Mon Sep 17 00:00:00 2001
|
|
|
00db10 |
From: Stefan Liebler <stli@linux.vnet.ibm.com>
|
|
|
00db10 |
Date: Thu, 8 Oct 2015 12:58:39 +0200
|
|
|
00db10 |
Subject: [PATCH 24/30] S390: Optimize strpbrk and wcspbrk.
|
|
|
00db10 |
|
|
|
00db10 |
upstream-commit-id: f0ba659847446eec3b2477d60c97c77ef4680e81
|
|
|
00db10 |
https://www.sourceware.org/ml/libc-alpha/2015-07/msg00091.html
|
|
|
00db10 |
|
|
|
00db10 |
This patch provides optimized versions of strpbrk and wcspbrk with the z13
|
|
|
00db10 |
vector instructions.
|
|
|
00db10 |
|
|
|
00db10 |
ChangeLog:
|
|
|
00db10 |
|
|
|
00db10 |
* sysdeps/s390/multiarch/strpbrk-c.c: New File.
|
|
|
00db10 |
* sysdeps/s390/multiarch/strpbrk-vx.S: Likewise.
|
|
|
00db10 |
* sysdeps/s390/multiarch/strpbrk.c: Likewise.
|
|
|
00db10 |
* sysdeps/s390/multiarch/wcspbrk-c.c: Likewise.
|
|
|
00db10 |
* sysdeps/s390/multiarch/wcspbrk-vx.S: Likewise.
|
|
|
00db10 |
* sysdeps/s390/multiarch/wcspbrk.c: Likewise.
|
|
|
00db10 |
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strpbrk and
|
|
|
00db10 |
wcspbrk functions.
|
|
|
00db10 |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
00db10 |
(__libc_ifunc_impl_list): Add ifunc test for strpbrk, wcspbrk.
|
|
|
00db10 |
* wcsmbs/wcspbrk.c: Use WCSPBRK if defined.
|
|
|
00db10 |
* string/test-strpbrk.c: Add wcspbrk support.
|
|
|
00db10 |
* wcsmbs/test-wcspbrk.c: New File.
|
|
|
00db10 |
* wcsmbs/Makefile (strop-tests): Add wcspbrk.
|
|
|
00db10 |
* benchtests/bench-strpbrk.c: Add wcspbrk support.
|
|
|
00db10 |
* benchtests/bench-wcspbrk.c: New File.
|
|
|
00db10 |
* benchtests/Makefile (wcsmbs-bench): Add wcspbrk.
|
|
|
00db10 |
---
|
|
|
00db10 |
benchtests/Makefile | 2 +-
|
|
|
00db10 |
benchtests/bench-strpbrk.c | 100 ++++++----
|
|
|
00db10 |
benchtests/bench-wcspbrk.c | 20 ++
|
|
|
00db10 |
string/strpbrk.c | 8 +-
|
|
|
00db10 |
string/test-strpbrk.c | 130 ++++++++-----
|
|
|
00db10 |
sysdeps/s390/multiarch/Makefile | 6 +-
|
|
|
00db10 |
sysdeps/s390/multiarch/ifunc-impl-list.c | 3 +
|
|
|
00db10 |
sysdeps/s390/multiarch/strpbrk-c.c | 28 +++
|
|
|
00db10 |
sysdeps/s390/multiarch/strpbrk-vx.S | 302 +++++++++++++++++++++++++++++
|
|
|
00db10 |
sysdeps/s390/multiarch/strpbrk.c | 27 +++
|
|
|
00db10 |
sysdeps/s390/multiarch/wcspbrk-c.c | 31 +++
|
|
|
00db10 |
sysdeps/s390/multiarch/wcspbrk-vx.S | 315 +++++++++++++++++++++++++++++++
|
|
|
00db10 |
sysdeps/s390/multiarch/wcspbrk.c | 27 +++
|
|
|
00db10 |
wcsmbs/Makefile | 2 +-
|
|
|
00db10 |
wcsmbs/test-wcspbrk-ifunc.c | 20 ++
|
|
|
00db10 |
wcsmbs/test-wcspbrk.c | 20 ++
|
|
|
00db10 |
wcsmbs/wcspbrk.c | 3 +
|
|
|
00db10 |
17 files changed, 953 insertions(+), 91 deletions(-)
|
|
|
00db10 |
create mode 100644 benchtests/bench-wcspbrk.c
|
|
|
00db10 |
create mode 100644 sysdeps/s390/multiarch/strpbrk-c.c
|
|
|
00db10 |
create mode 100644 sysdeps/s390/multiarch/strpbrk-vx.S
|
|
|
00db10 |
create mode 100644 sysdeps/s390/multiarch/strpbrk.c
|
|
|
00db10 |
create mode 100644 sysdeps/s390/multiarch/wcspbrk-c.c
|
|
|
00db10 |
create mode 100644 sysdeps/s390/multiarch/wcspbrk-vx.S
|
|
|
00db10 |
create mode 100644 sysdeps/s390/multiarch/wcspbrk.c
|
|
|
00db10 |
create mode 100644 wcsmbs/test-wcspbrk-ifunc.c
|
|
|
00db10 |
create mode 100644 wcsmbs/test-wcspbrk.c
|
|
|
00db10 |
|
|
|
00db10 |
diff --git a/benchtests/Makefile b/benchtests/Makefile
|
|
|
00db10 |
index 337b2a1..015b5d6 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 wcschr wcschrnul wcsrchr wcsspn
|
|
|
00db10 |
+ wcsncmp wcsncmp wcschr wcschrnul wcsrchr wcsspn wcspbrk
|
|
|
00db10 |
string-bench-all := $(string-bench) ${wcsmbs-bench}
|
|
|
00db10 |
|
|
|
00db10 |
stdlib-bench := strtod
|
|
|
00db10 |
diff --git a/benchtests/bench-strpbrk.c b/benchtests/bench-strpbrk.c
|
|
|
00db10 |
index fe966be..f2db902 100644
|
|
|
00db10 |
--- a/benchtests/bench-strpbrk.c
|
|
|
00db10 |
+++ b/benchtests/bench-strpbrk.c
|
|
|
00db10 |
@@ -16,50 +16,80 @@
|
|
|
00db10 |
License along with the GNU C Library; if not, see
|
|
|
00db10 |
<http://www.gnu.org/licenses/>. */
|
|
|
00db10 |
|
|
|
00db10 |
+#ifndef WIDE
|
|
|
00db10 |
+# define CHAR char
|
|
|
00db10 |
+# define STRLEN strlen
|
|
|
00db10 |
+# define STRCHR strchr
|
|
|
00db10 |
+# define BIG_CHAR CHAR_MAX
|
|
|
00db10 |
+# define SMALL_CHAR 127
|
|
|
00db10 |
+#else
|
|
|
00db10 |
+# include <wchar.h>
|
|
|
00db10 |
+# define CHAR wchar_t
|
|
|
00db10 |
+# define STRLEN wcslen
|
|
|
00db10 |
+# define STRCHR wcschr
|
|
|
00db10 |
+# define BIG_CHAR WCHAR_MAX
|
|
|
00db10 |
+# define SMALL_CHAR 1273
|
|
|
00db10 |
+#endif /* WIDE */
|
|
|
00db10 |
+
|
|
|
00db10 |
#ifndef STRPBRK_RESULT
|
|
|
00db10 |
# define STRPBRK_RESULT(s, pos) ((s)[(pos)] ? (s) + (pos) : NULL)
|
|
|
00db10 |
-# define RES_TYPE char *
|
|
|
00db10 |
+# define RES_TYPE CHAR *
|
|
|
00db10 |
# define TEST_MAIN
|
|
|
00db10 |
-# define TEST_NAME "strpbrk"
|
|
|
00db10 |
+# ifndef WIDE
|
|
|
00db10 |
+# define TEST_NAME "strpbrk"
|
|
|
00db10 |
+# else
|
|
|
00db10 |
+# define TEST_NAME "wcspbrk"
|
|
|
00db10 |
+# endif /* WIDE */
|
|
|
00db10 |
# include "bench-string.h"
|
|
|
00db10 |
|
|
|
00db10 |
-typedef char *(*proto_t) (const char *, const char *);
|
|
|
00db10 |
-char *simple_strpbrk (const char *, const char *);
|
|
|
00db10 |
-char *stupid_strpbrk (const char *, const char *);
|
|
|
00db10 |
-
|
|
|
00db10 |
-IMPL (stupid_strpbrk, 0)
|
|
|
00db10 |
-IMPL (simple_strpbrk, 0)
|
|
|
00db10 |
-IMPL (strpbrk, 1)
|
|
|
00db10 |
-
|
|
|
00db10 |
-char *
|
|
|
00db10 |
-simple_strpbrk (const char *s, const char *rej)
|
|
|
00db10 |
+# ifndef WIDE
|
|
|
00db10 |
+# define STRPBRK strpbrk
|
|
|
00db10 |
+# define SIMPLE_STRPBRK simple_strpbrk
|
|
|
00db10 |
+# define STUPID_STRPBRK stupid_strpbrk
|
|
|
00db10 |
+# else
|
|
|
00db10 |
+# include <wchar.h>
|
|
|
00db10 |
+# define STRPBRK wcspbrk
|
|
|
00db10 |
+# define SIMPLE_STRPBRK simple_wcspbrk
|
|
|
00db10 |
+# define STUPID_STRPBRK stupid_wcspbrk
|
|
|
00db10 |
+# endif /* WIDE */
|
|
|
00db10 |
+
|
|
|
00db10 |
+typedef CHAR *(*proto_t) (const CHAR *, const CHAR *);
|
|
|
00db10 |
+CHAR *SIMPLE_STRPBRK (const CHAR *, const CHAR *);
|
|
|
00db10 |
+CHAR *STUPID_STRPBRK (const CHAR *, const CHAR *);
|
|
|
00db10 |
+
|
|
|
00db10 |
+IMPL (STUPID_STRPBRK, 0)
|
|
|
00db10 |
+IMPL (SIMPLE_STRPBRK, 0)
|
|
|
00db10 |
+IMPL (STRPBRK, 1)
|
|
|
00db10 |
+
|
|
|
00db10 |
+CHAR *
|
|
|
00db10 |
+SIMPLE_STRPBRK (const CHAR *s, const CHAR *rej)
|
|
|
00db10 |
{
|
|
|
00db10 |
- const char *r;
|
|
|
00db10 |
- char c;
|
|
|
00db10 |
+ const CHAR *r;
|
|
|
00db10 |
+ CHAR c;
|
|
|
00db10 |
|
|
|
00db10 |
while ((c = *s++) != '\0')
|
|
|
00db10 |
for (r = rej; *r != '\0'; ++r)
|
|
|
00db10 |
if (*r == c)
|
|
|
00db10 |
- return (char *) s - 1;
|
|
|
00db10 |
+ return (CHAR *) s - 1;
|
|
|
00db10 |
return NULL;
|
|
|
00db10 |
}
|
|
|
00db10 |
|
|
|
00db10 |
-char *
|
|
|
00db10 |
-stupid_strpbrk (const char *s, const char *rej)
|
|
|
00db10 |
+CHAR *
|
|
|
00db10 |
+STUPID_STRPBRK (const CHAR *s, const CHAR *rej)
|
|
|
00db10 |
{
|
|
|
00db10 |
- size_t ns = strlen (s), nrej = strlen (rej);
|
|
|
00db10 |
+ size_t ns = STRLEN (s), nrej = STRLEN (rej);
|
|
|
00db10 |
size_t i, j;
|
|
|
00db10 |
|
|
|
00db10 |
for (i = 0; i < ns; ++i)
|
|
|
00db10 |
for (j = 0; j < nrej; ++j)
|
|
|
00db10 |
if (s[i] == rej[j])
|
|
|
00db10 |
- return (char *) s + i;
|
|
|
00db10 |
+ return (CHAR *) s + i;
|
|
|
00db10 |
return NULL;
|
|
|
00db10 |
}
|
|
|
00db10 |
-#endif
|
|
|
00db10 |
+#endif /* !STRPBRK_RESULT */
|
|
|
00db10 |
|
|
|
00db10 |
static void
|
|
|
00db10 |
-do_one_test (impl_t *impl, const char *s, const char *rej, RES_TYPE exp_res)
|
|
|
00db10 |
+do_one_test (impl_t *impl, const CHAR *s, const CHAR *rej, RES_TYPE exp_res)
|
|
|
00db10 |
{
|
|
|
00db10 |
RES_TYPE res = CALL (impl, s, rej);
|
|
|
00db10 |
size_t i, iters = INNER_LOOP_ITERS;
|
|
|
00db10 |
@@ -91,35 +121,35 @@ do_test (size_t align, size_t pos, size_t len)
|
|
|
00db10 |
size_t i;
|
|
|
00db10 |
int c;
|
|
|
00db10 |
RES_TYPE result;
|
|
|
00db10 |
- char *rej, *s;
|
|
|
00db10 |
+ CHAR *rej, *s;
|
|
|
00db10 |
|
|
|
00db10 |
align &= 7;
|
|
|
00db10 |
- if (align + pos + 10 >= page_size || len > 240)
|
|
|
00db10 |
+ if ((align + pos + 10) * sizeof (CHAR) >= page_size || len > 240)
|
|
|
00db10 |
return;
|
|
|
00db10 |
|
|
|
00db10 |
- rej = (char *) (buf2 + (random () & 255));
|
|
|
00db10 |
- s = (char *) (buf1 + align);
|
|
|
00db10 |
+ rej = (CHAR *) (buf2) + (random () & BIG_CHAR);
|
|
|
00db10 |
+ s = (CHAR *) (buf1) + align;
|
|
|
00db10 |
|
|
|
00db10 |
for (i = 0; i < len; ++i)
|
|
|
00db10 |
{
|
|
|
00db10 |
- rej[i] = random () & 255;
|
|
|
00db10 |
+ rej[i] = random () & BIG_CHAR;
|
|
|
00db10 |
if (!rej[i])
|
|
|
00db10 |
- rej[i] = random () & 255;
|
|
|
00db10 |
+ rej[i] = random () & BIG_CHAR;
|
|
|
00db10 |
if (!rej[i])
|
|
|
00db10 |
- rej[i] = 1 + (random () & 127);
|
|
|
00db10 |
+ rej[i] = 1 + (random () & SMALL_CHAR);
|
|
|
00db10 |
}
|
|
|
00db10 |
rej[len] = '\0';
|
|
|
00db10 |
- for (c = 1; c <= 255; ++c)
|
|
|
00db10 |
- if (strchr (rej, c) == NULL)
|
|
|
00db10 |
+ for (c = 1; c <= BIG_CHAR; ++c)
|
|
|
00db10 |
+ if (STRCHR (rej, c) == NULL)
|
|
|
00db10 |
break;
|
|
|
00db10 |
|
|
|
00db10 |
for (i = 0; i < pos; ++i)
|
|
|
00db10 |
{
|
|
|
00db10 |
- s[i] = random () & 255;
|
|
|
00db10 |
- if (strchr (rej, s[i]))
|
|
|
00db10 |
+ s[i] = random () & BIG_CHAR;
|
|
|
00db10 |
+ if (STRCHR (rej, s[i]))
|
|
|
00db10 |
{
|
|
|
00db10 |
- s[i] = random () & 255;
|
|
|
00db10 |
- if (strchr (rej, s[i]))
|
|
|
00db10 |
+ s[i] = random () & BIG_CHAR;
|
|
|
00db10 |
+ if (STRCHR (rej, s[i]))
|
|
|
00db10 |
s[i] = c;
|
|
|
00db10 |
}
|
|
|
00db10 |
}
|
|
|
00db10 |
@@ -127,7 +157,7 @@ do_test (size_t align, size_t pos, size_t len)
|
|
|
00db10 |
if (s[pos])
|
|
|
00db10 |
{
|
|
|
00db10 |
for (i = pos + 1; i < pos + 10; ++i)
|
|
|
00db10 |
- s[i] = random () & 255;
|
|
|
00db10 |
+ s[i] = random () & BIG_CHAR;
|
|
|
00db10 |
s[i] = '\0';
|
|
|
00db10 |
}
|
|
|
00db10 |
result = STRPBRK_RESULT (s, pos);
|
|
|
00db10 |
diff --git a/benchtests/bench-wcspbrk.c b/benchtests/bench-wcspbrk.c
|
|
|
00db10 |
new file mode 100644
|
|
|
00db10 |
index 0000000..3d9f00f
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ b/benchtests/bench-wcspbrk.c
|
|
|
00db10 |
@@ -0,0 +1,20 @@
|
|
|
00db10 |
+/* Measure wcspbrk 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-strpbrk.c"
|
|
|
00db10 |
diff --git a/string/strpbrk.c b/string/strpbrk.c
|
|
|
00db10 |
index 7f45fdf..c153d8e 100644
|
|
|
00db10 |
--- a/string/strpbrk.c
|
|
|
00db10 |
+++ b/string/strpbrk.c
|
|
|
00db10 |
@@ -25,11 +25,13 @@
|
|
|
00db10 |
|
|
|
00db10 |
#undef strpbrk
|
|
|
00db10 |
|
|
|
00db10 |
+#ifndef STRPBRK
|
|
|
00db10 |
+# define STRPBRK strpbrk
|
|
|
00db10 |
+#endif
|
|
|
00db10 |
+
|
|
|
00db10 |
/* Find the first occurrence in S of any character in ACCEPT. */
|
|
|
00db10 |
char *
|
|
|
00db10 |
-strpbrk (s, accept)
|
|
|
00db10 |
- const char *s;
|
|
|
00db10 |
- const char *accept;
|
|
|
00db10 |
+STRPBRK (const char *s, const char *accept)
|
|
|
00db10 |
{
|
|
|
00db10 |
while (*s != '\0')
|
|
|
00db10 |
{
|
|
|
00db10 |
diff --git a/string/test-strpbrk.c b/string/test-strpbrk.c
|
|
|
00db10 |
index 72eaaa1..c36c5b5 100644
|
|
|
00db10 |
--- a/string/test-strpbrk.c
|
|
|
00db10 |
+++ b/string/test-strpbrk.c
|
|
|
00db10 |
@@ -17,50 +17,82 @@
|
|
|
00db10 |
License along with the GNU C Library; if not, see
|
|
|
00db10 |
<http://www.gnu.org/licenses/>. */
|
|
|
00db10 |
|
|
|
00db10 |
+#ifndef WIDE
|
|
|
00db10 |
+# define CHAR char
|
|
|
00db10 |
+# define UCHAR unsigned char
|
|
|
00db10 |
+# define STRLEN strlen
|
|
|
00db10 |
+# define STRCHR strchr
|
|
|
00db10 |
+# define BIG_CHAR CHAR_MAX
|
|
|
00db10 |
+# define SMALL_CHAR 127
|
|
|
00db10 |
+#else
|
|
|
00db10 |
+# include <wchar.h>
|
|
|
00db10 |
+# define CHAR wchar_t
|
|
|
00db10 |
+# define UCHAR wchar_t
|
|
|
00db10 |
+# define STRLEN wcslen
|
|
|
00db10 |
+# define STRCHR wcschr
|
|
|
00db10 |
+# define BIG_CHAR WCHAR_MAX
|
|
|
00db10 |
+# define SMALL_CHAR 1273
|
|
|
00db10 |
+#endif /* WIDE */
|
|
|
00db10 |
+
|
|
|
00db10 |
#ifndef STRPBRK_RESULT
|
|
|
00db10 |
# define STRPBRK_RESULT(s, pos) ((s)[(pos)] ? (s) + (pos) : NULL)
|
|
|
00db10 |
-# define RES_TYPE char *
|
|
|
00db10 |
+# define RES_TYPE CHAR *
|
|
|
00db10 |
# define TEST_MAIN
|
|
|
00db10 |
-# define TEST_NAME "strpbrk"
|
|
|
00db10 |
+# ifndef WIDE
|
|
|
00db10 |
+# define TEST_NAME "strpbrk"
|
|
|
00db10 |
+# else
|
|
|
00db10 |
+# define TEST_NAME "wcspbrk"
|
|
|
00db10 |
+# endif /* WIDE */
|
|
|
00db10 |
# include "test-string.h"
|
|
|
00db10 |
|
|
|
00db10 |
-typedef char *(*proto_t) (const char *, const char *);
|
|
|
00db10 |
-char *simple_strpbrk (const char *, const char *);
|
|
|
00db10 |
-char *stupid_strpbrk (const char *, const char *);
|
|
|
00db10 |
+# ifndef WIDE
|
|
|
00db10 |
+# define STRPBRK strpbrk
|
|
|
00db10 |
+# define SIMPLE_STRPBRK simple_strpbrk
|
|
|
00db10 |
+# define STUPID_STRPBRK stupid_strpbrk
|
|
|
00db10 |
+# else
|
|
|
00db10 |
+# include <wchar.h>
|
|
|
00db10 |
+# define STRPBRK wcspbrk
|
|
|
00db10 |
+# define SIMPLE_STRPBRK simple_wcspbrk
|
|
|
00db10 |
+# define STUPID_STRPBRK stupid_wcspbrk
|
|
|
00db10 |
+# endif /* WIDE */
|
|
|
00db10 |
+
|
|
|
00db10 |
+typedef CHAR *(*proto_t) (const CHAR *, const CHAR *);
|
|
|
00db10 |
+CHAR *SIMPLE_STRPBRK (const CHAR *, const CHAR *);
|
|
|
00db10 |
+CHAR *STUPID_STRPBRK (const CHAR *, const CHAR *);
|
|
|
00db10 |
|
|
|
00db10 |
-IMPL (stupid_strpbrk, 0)
|
|
|
00db10 |
-IMPL (simple_strpbrk, 0)
|
|
|
00db10 |
-IMPL (strpbrk, 1)
|
|
|
00db10 |
+IMPL (STUPID_STRPBRK, 0)
|
|
|
00db10 |
+IMPL (SIMPLE_STRPBRK, 0)
|
|
|
00db10 |
+IMPL (STRPBRK, 1)
|
|
|
00db10 |
|
|
|
00db10 |
-char *
|
|
|
00db10 |
-simple_strpbrk (const char *s, const char *rej)
|
|
|
00db10 |
+CHAR *
|
|
|
00db10 |
+SIMPLE_STRPBRK (const CHAR *s, const CHAR *rej)
|
|
|
00db10 |
{
|
|
|
00db10 |
- const char *r;
|
|
|
00db10 |
- char c;
|
|
|
00db10 |
+ const CHAR *r;
|
|
|
00db10 |
+ CHAR c;
|
|
|
00db10 |
|
|
|
00db10 |
while ((c = *s++) != '\0')
|
|
|
00db10 |
for (r = rej; *r != '\0'; ++r)
|
|
|
00db10 |
if (*r == c)
|
|
|
00db10 |
- return (char *) s - 1;
|
|
|
00db10 |
+ return (CHAR *) s - 1;
|
|
|
00db10 |
return NULL;
|
|
|
00db10 |
}
|
|
|
00db10 |
|
|
|
00db10 |
-char *
|
|
|
00db10 |
-stupid_strpbrk (const char *s, const char *rej)
|
|
|
00db10 |
+CHAR *
|
|
|
00db10 |
+STUPID_STRPBRK (const CHAR *s, const CHAR *rej)
|
|
|
00db10 |
{
|
|
|
00db10 |
- size_t ns = strlen (s), nrej = strlen (rej);
|
|
|
00db10 |
+ size_t ns = STRLEN (s), nrej = STRLEN (rej);
|
|
|
00db10 |
size_t i, j;
|
|
|
00db10 |
|
|
|
00db10 |
for (i = 0; i < ns; ++i)
|
|
|
00db10 |
for (j = 0; j < nrej; ++j)
|
|
|
00db10 |
if (s[i] == rej[j])
|
|
|
00db10 |
- return (char *) s + i;
|
|
|
00db10 |
+ return (CHAR *) s + i;
|
|
|
00db10 |
return NULL;
|
|
|
00db10 |
}
|
|
|
00db10 |
-#endif
|
|
|
00db10 |
+#endif /* !STRPBRK_RESULT */
|
|
|
00db10 |
|
|
|
00db10 |
static void
|
|
|
00db10 |
-do_one_test (impl_t *impl, const char *s, const char *rej, RES_TYPE exp_res)
|
|
|
00db10 |
+do_one_test (impl_t *impl, const CHAR *s, const CHAR *rej, RES_TYPE exp_res)
|
|
|
00db10 |
{
|
|
|
00db10 |
RES_TYPE res = CALL (impl, s, rej);
|
|
|
00db10 |
if (res != exp_res)
|
|
|
00db10 |
@@ -78,35 +110,35 @@ do_test (size_t align, size_t pos, size_t len)
|
|
|
00db10 |
size_t i;
|
|
|
00db10 |
int c;
|
|
|
00db10 |
RES_TYPE result;
|
|
|
00db10 |
- char *rej, *s;
|
|
|
00db10 |
+ CHAR *rej, *s;
|
|
|
00db10 |
|
|
|
00db10 |
align &= 7;
|
|
|
00db10 |
- if (align + pos + 10 >= page_size || len > 240)
|
|
|
00db10 |
+ if ((align + pos + 10) * sizeof (CHAR) >= page_size || len > 240)
|
|
|
00db10 |
return;
|
|
|
00db10 |
|
|
|
00db10 |
- rej = (char *) (buf2 + (random () & 255));
|
|
|
00db10 |
- s = (char *) (buf1 + align);
|
|
|
00db10 |
+ rej = (CHAR *) (buf2) + (random () & 255);
|
|
|
00db10 |
+ s = (CHAR *) (buf1) + align;
|
|
|
00db10 |
|
|
|
00db10 |
for (i = 0; i < len; ++i)
|
|
|
00db10 |
{
|
|
|
00db10 |
- rej[i] = random () & 255;
|
|
|
00db10 |
+ rej[i] = random () & BIG_CHAR;
|
|
|
00db10 |
if (!rej[i])
|
|
|
00db10 |
- rej[i] = random () & 255;
|
|
|
00db10 |
+ rej[i] = random () & BIG_CHAR;
|
|
|
00db10 |
if (!rej[i])
|
|
|
00db10 |
- rej[i] = 1 + (random () & 127);
|
|
|
00db10 |
+ rej[i] = 1 + (random () & SMALL_CHAR);
|
|
|
00db10 |
}
|
|
|
00db10 |
rej[len] = '\0';
|
|
|
00db10 |
- for (c = 1; c <= 255; ++c)
|
|
|
00db10 |
- if (strchr (rej, c) == NULL)
|
|
|
00db10 |
+ for (c = 1; c <= BIG_CHAR; ++c)
|
|
|
00db10 |
+ if (STRCHR (rej, c) == NULL)
|
|
|
00db10 |
break;
|
|
|
00db10 |
|
|
|
00db10 |
for (i = 0; i < pos; ++i)
|
|
|
00db10 |
{
|
|
|
00db10 |
- s[i] = random () & 255;
|
|
|
00db10 |
- if (strchr (rej, s[i]))
|
|
|
00db10 |
+ s[i] = random () & BIG_CHAR;
|
|
|
00db10 |
+ if (STRCHR (rej, s[i]))
|
|
|
00db10 |
{
|
|
|
00db10 |
- s[i] = random () & 255;
|
|
|
00db10 |
- if (strchr (rej, s[i]))
|
|
|
00db10 |
+ s[i] = random () & BIG_CHAR;
|
|
|
00db10 |
+ if (STRCHR (rej, s[i]))
|
|
|
00db10 |
s[i] = c;
|
|
|
00db10 |
}
|
|
|
00db10 |
}
|
|
|
00db10 |
@@ -114,7 +146,7 @@ do_test (size_t align, size_t pos, size_t len)
|
|
|
00db10 |
if (s[pos])
|
|
|
00db10 |
{
|
|
|
00db10 |
for (i = pos + 1; i < pos + 10; ++i)
|
|
|
00db10 |
- s[i] = random () & 255;
|
|
|
00db10 |
+ s[i] = random () & BIG_CHAR;
|
|
|
00db10 |
s[i] = '\0';
|
|
|
00db10 |
}
|
|
|
00db10 |
result = STRPBRK_RESULT (s, pos);
|
|
|
00db10 |
@@ -129,8 +161,8 @@ do_random_tests (void)
|
|
|
00db10 |
size_t i, j, n, align, pos, len, rlen;
|
|
|
00db10 |
RES_TYPE result;
|
|
|
00db10 |
int c;
|
|
|
00db10 |
- unsigned char *p = buf1 + page_size - 512;
|
|
|
00db10 |
- unsigned char *rej;
|
|
|
00db10 |
+ UCHAR *p = (UCHAR *) (buf1 + page_size) - 512;
|
|
|
00db10 |
+ UCHAR *rej;
|
|
|
00db10 |
|
|
|
00db10 |
for (n = 0; n < ITERATIONS; n++)
|
|
|
00db10 |
{
|
|
|
00db10 |
@@ -147,18 +179,18 @@ do_random_tests (void)
|
|
|
00db10 |
rlen = random () & 63;
|
|
|
00db10 |
else
|
|
|
00db10 |
rlen = random () & 15;
|
|
|
00db10 |
- rej = buf2 + page_size - rlen - 1 - (random () & 7);
|
|
|
00db10 |
+ rej = (UCHAR *) (buf2 + page_size) - rlen - 1 - (random () & 7);
|
|
|
00db10 |
for (i = 0; i < rlen; ++i)
|
|
|
00db10 |
{
|
|
|
00db10 |
- rej[i] = random () & 255;
|
|
|
00db10 |
+ rej[i] = random () & BIG_CHAR;
|
|
|
00db10 |
if (!rej[i])
|
|
|
00db10 |
- rej[i] = random () & 255;
|
|
|
00db10 |
+ rej[i] = random () & BIG_CHAR;
|
|
|
00db10 |
if (!rej[i])
|
|
|
00db10 |
- rej[i] = 1 + (random () & 127);
|
|
|
00db10 |
+ rej[i] = 1 + (random () & SMALL_CHAR);
|
|
|
00db10 |
}
|
|
|
00db10 |
rej[i] = '\0';
|
|
|
00db10 |
- for (c = 1; c <= 255; ++c)
|
|
|
00db10 |
- if (strchr ((char *) rej, c) == NULL)
|
|
|
00db10 |
+ for (c = 1; c <= BIG_CHAR; ++c)
|
|
|
00db10 |
+ if (STRCHR ((CHAR *) rej, c) == NULL)
|
|
|
00db10 |
break;
|
|
|
00db10 |
j = (pos > len ? pos : len) + align + 64;
|
|
|
00db10 |
if (j > 512)
|
|
|
00db10 |
@@ -171,27 +203,27 @@ do_random_tests (void)
|
|
|
00db10 |
else if (i == pos + align)
|
|
|
00db10 |
p[i] = rej[random () % (rlen + 1)];
|
|
|
00db10 |
else if (i < align || i > pos + align)
|
|
|
00db10 |
- p[i] = random () & 255;
|
|
|
00db10 |
+ p[i] = random () & BIG_CHAR;
|
|
|
00db10 |
else
|
|
|
00db10 |
{
|
|
|
00db10 |
- p[i] = random () & 255;
|
|
|
00db10 |
- if (strchr ((char *) rej, p[i]))
|
|
|
00db10 |
+ p[i] = random () & BIG_CHAR;
|
|
|
00db10 |
+ if (STRCHR ((CHAR *) rej, p[i]))
|
|
|
00db10 |
{
|
|
|
00db10 |
- p[i] = random () & 255;
|
|
|
00db10 |
- if (strchr ((char *) rej, p[i]))
|
|
|
00db10 |
+ p[i] = random () & BIG_CHAR;
|
|
|
00db10 |
+ if (STRCHR ((CHAR *) rej, p[i]))
|
|
|
00db10 |
p[i] = c;
|
|
|
00db10 |
}
|
|
|
00db10 |
}
|
|
|
00db10 |
}
|
|
|
00db10 |
|
|
|
00db10 |
- result = STRPBRK_RESULT ((char *) (p + align), pos < len ? pos : len);
|
|
|
00db10 |
+ result = STRPBRK_RESULT ((CHAR *) (p + align), pos < len ? pos : len);
|
|
|
00db10 |
|
|
|
00db10 |
FOR_EACH_IMPL (impl, 1)
|
|
|
00db10 |
- if (CALL (impl, (char *) (p + align), (char *) rej) != result)
|
|
|
00db10 |
+ if (CALL (impl, (CHAR *) (p + align), (CHAR *) rej) != result)
|
|
|
00db10 |
{
|
|
|
00db10 |
error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %p, %zd, %zd, %zd) %p != %p",
|
|
|
00db10 |
n, impl->name, align, rej, rlen, pos, len,
|
|
|
00db10 |
- (void *) CALL (impl, (char *) (p + align), (char *) rej),
|
|
|
00db10 |
+ (void *) CALL (impl, (CHAR *) (p + align), (CHAR *) rej),
|
|
|
00db10 |
(void *) result);
|
|
|
00db10 |
ret = 1;
|
|
|
00db10 |
}
|
|
|
00db10 |
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
|
|
|
00db10 |
index 9403169..5765a8c 100644
|
|
|
00db10 |
--- a/sysdeps/s390/multiarch/Makefile
|
|
|
00db10 |
+++ b/sysdeps/s390/multiarch/Makefile
|
|
|
00db10 |
@@ -12,7 +12,8 @@ sysdep_routines += strlen strlen-vx strlen-c \
|
|
|
00db10 |
strchr strchr-vx strchr-c \
|
|
|
00db10 |
strchrnul strchrnul-vx strchrnul-c \
|
|
|
00db10 |
strrchr strrchr-vx strrchr-c \
|
|
|
00db10 |
- strspn strspn-vx strspn-c
|
|
|
00db10 |
+ strspn strspn-vx strspn-c \
|
|
|
00db10 |
+ strpbrk strpbrk-vx strpbrk-c
|
|
|
00db10 |
endif
|
|
|
00db10 |
|
|
|
00db10 |
ifeq ($(subdir),wcsmbs)
|
|
|
00db10 |
@@ -29,5 +30,6 @@ sysdep_routines += wcslen wcslen-vx wcslen-c \
|
|
|
00db10 |
wcschr wcschr-vx wcschr-c \
|
|
|
00db10 |
wcschrnul wcschrnul-vx wcschrnul-c \
|
|
|
00db10 |
wcsrchr wcsrchr-vx wcsrchr-c \
|
|
|
00db10 |
- wcsspn wcsspn-vx wcsspn-c
|
|
|
00db10 |
+ wcsspn wcsspn-vx wcsspn-c \
|
|
|
00db10 |
+ wcspbrk wcspbrk-vx wcspbrk-c
|
|
|
00db10 |
endif
|
|
|
00db10 |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
00db10 |
index cbedf64..b39a5c5 100644
|
|
|
00db10 |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
00db10 |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
00db10 |
@@ -121,6 +121,9 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
00db10 |
IFUNC_VX_IMPL (strspn);
|
|
|
00db10 |
IFUNC_VX_IMPL (wcsspn);
|
|
|
00db10 |
|
|
|
00db10 |
+ IFUNC_VX_IMPL (strpbrk);
|
|
|
00db10 |
+ IFUNC_VX_IMPL (wcspbrk);
|
|
|
00db10 |
+
|
|
|
00db10 |
#endif /* HAVE_S390_VX_ASM_SUPPORT */
|
|
|
00db10 |
|
|
|
00db10 |
return i;
|
|
|
00db10 |
diff --git a/sysdeps/s390/multiarch/strpbrk-c.c b/sysdeps/s390/multiarch/strpbrk-c.c
|
|
|
00db10 |
new file mode 100644
|
|
|
00db10 |
index 0000000..1c8bf49
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ b/sysdeps/s390/multiarch/strpbrk-c.c
|
|
|
00db10 |
@@ -0,0 +1,28 @@
|
|
|
00db10 |
+/* Default strpbrk 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 STRPBRK __strpbrk_c
|
|
|
00db10 |
+# ifdef SHARED
|
|
|
00db10 |
+# undef libc_hidden_builtin_def
|
|
|
00db10 |
+# define libc_hidden_builtin_def(name) \
|
|
|
00db10 |
+ __hidden_ver1 (__strpbrk_c, __GI_strpbrk, __strpbrk_c);
|
|
|
00db10 |
+# endif /* SHARED */
|
|
|
00db10 |
+
|
|
|
00db10 |
+# include <string/strpbrk.c>
|
|
|
00db10 |
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
|
|
|
00db10 |
diff --git a/sysdeps/s390/multiarch/strpbrk-vx.S b/sysdeps/s390/multiarch/strpbrk-vx.S
|
|
|
00db10 |
new file mode 100644
|
|
|
00db10 |
index 0000000..c6ad3ef
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ b/sysdeps/s390/multiarch/strpbrk-vx.S
|
|
|
00db10 |
@@ -0,0 +1,302 @@
|
|
|
00db10 |
+/* Vector optimized 32/64 bit S/390 version of strpbrk.
|
|
|
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 *strpbrk (const char *s, const char * accept)
|
|
|
00db10 |
+ The strpbrk() function locates the first occurrence in the string s
|
|
|
00db10 |
+ of any of the characters in the string accept and returns a pointer
|
|
|
00db10 |
+ to that character or NULL if not found.
|
|
|
00db10 |
+
|
|
|
00db10 |
+ This method checks the length of accept string. If it fits entirely
|
|
|
00db10 |
+ in one vector register, a fast algorithm is used, which does not need
|
|
|
00db10 |
+ to check multiple parts of accept-string. Otherwise a slower full
|
|
|
00db10 |
+ check of accept-string is used.
|
|
|
00db10 |
+
|
|
|
00db10 |
+ register overview:
|
|
|
00db10 |
+ r3: pointer to start of accept-string
|
|
|
00db10 |
+ r2: pointer to start of search-string
|
|
|
00db10 |
+ r0: loaded byte count of vlbb search-string (32bit unsigned)
|
|
|
00db10 |
+ r4: found byte index (32bit unsigned)
|
|
|
00db10 |
+ r1: current return len (64bit unsigned)
|
|
|
00db10 |
+ v16: search-string
|
|
|
00db10 |
+ v17: accept-string
|
|
|
00db10 |
+ v18: temp-vreg
|
|
|
00db10 |
+
|
|
|
00db10 |
+ ONLY FOR SLOW:
|
|
|
00db10 |
+ v19: first accept-string
|
|
|
00db10 |
+ v20: zero for preparing acc-vector
|
|
|
00db10 |
+ v21: global mask; 1 indicates a match between
|
|
|
00db10 |
+ search-string-vreg and any accept-character
|
|
|
00db10 |
+ v22: current mask; 1 indicates a match between
|
|
|
00db10 |
+ search-string-vreg and any accept-character in current acc-vreg
|
|
|
00db10 |
+ v24: one for result-checking of former string-part
|
|
|
00db10 |
+ v30, v31: for re-/storing registers r6, r8, r9
|
|
|
00db10 |
+ r5: current len of accept-string
|
|
|
00db10 |
+ r6: zero-index in search-string or 16 if no zero
|
|
|
00db10 |
+ or min(zero-index, loaded byte count)
|
|
|
00db10 |
+ r8: >0, if former accept-string-part contains a zero,
|
|
|
00db10 |
+ otherwise =0;
|
|
|
00db10 |
+ r9: loaded byte count of vlbb accept-string
|
|
|
00db10 |
+*/
|
|
|
00db10 |
+ENTRY(__strpbrk_vx)
|
|
|
00db10 |
+ .machine "z13"
|
|
|
00db10 |
+ .machinemode "zarch_nohighgprs"
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /*
|
|
|
00db10 |
+ Check if accept-string fits in one vreg:
|
|
|
00db10 |
+ ----------------------------------------
|
|
|
00db10 |
+ */
|
|
|
00db10 |
+ vlbb %v17,0(%r3),6 /* Load accept. */
|
|
|
00db10 |
+ lghi %r1,0 /* Zero out current len. */
|
|
|
00db10 |
+ vlgvb %r0,%v17,0 /* Get first element. */
|
|
|
00db10 |
+ clije %r0,0,.Lfast_end_null /* Return null if accept is empty. */
|
|
|
00db10 |
+ lcbb %r0,0(%r3),6
|
|
|
00db10 |
+ jo .Lcheck_onbb /* Special case if accept lays
|
|
|
00db10 |
+ on block-boundary. */
|
|
|
00db10 |
+.Lcheck_notonbb:
|
|
|
00db10 |
+ vistrbs %v17,%v17 /* Fill with zeros after first zero. */
|
|
|
00db10 |
+ je .Lfast /* Zero found -> accept fits in one vreg. */
|
|
|
00db10 |
+ j .Lslow /* No zero -> accept exceeds one vreg */
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lcheck_onbb:
|
|
|
00db10 |
+ /* Accept lays on block-boundary. */
|
|
|
00db10 |
+ vfenezb %v18,%v17,%v17 /* Search zero in loaded accept bytes. */
|
|
|
00db10 |
+ vlgvb %r4,%v18,7 /* Get index of zero or 16 if not found. */
|
|
|
00db10 |
+ clrjl %r4,%r0,.Lcheck_notonbb /* Zero index < loaded bytes count ->
|
|
|
00db10 |
+ Accept fits in one vreg;
|
|
|
00db10 |
+ Fill with zeros and proceed
|
|
|
00db10 |
+ with FAST. */
|
|
|
00db10 |
+ vl %v17,0(%r3) /* Load accept, which exceeds loaded bytes. */
|
|
|
00db10 |
+ j .Lcheck_notonbb /* Check if accept fits in one vreg. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /*
|
|
|
00db10 |
+ Search s for accept in one vreg
|
|
|
00db10 |
+ -------------------------------
|
|
|
00db10 |
+ */
|
|
|
00db10 |
+.Lfast:
|
|
|
00db10 |
+ /* Complete accept-string in v17 and remaining bytes are zero. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vlbb %v16,0(%r2),6 /* Load s until next 4k-byte boundary. */
|
|
|
00db10 |
+ lcbb %r0,0(%r2),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vfaezbs %v18,%v16,%v17,0 /* Find first element in v16 unequal to any
|
|
|
00db10 |
+ in v17 or first zero element. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vlgvb %r4,%v18,7 /* Load byte index of found element. */
|
|
|
00db10 |
+ /* If found index is within loaded bytes, return with found
|
|
|
00db10 |
+ element index (=equal count). */
|
|
|
00db10 |
+ clrjl %r4,%r0,.Lfast_loop_found2
|
|
|
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 %r1,16 /* current_len = 16. */
|
|
|
00db10 |
+ slr %r1,%r4 /* Compute bytes to 16bytes boundary. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /* Process s in 16byte aligned loop. */
|
|
|
00db10 |
+.Lfast_loop:
|
|
|
00db10 |
+ vl %v16,0(%r1,%r2) /* Load search-string. */
|
|
|
00db10 |
+ vfaezbs %v18,%v16,%v17,0 /* Find first element in v16 equal to any
|
|
|
00db10 |
+ in v17 or first zero element. */
|
|
|
00db10 |
+ jno .Lfast_loop_found
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vl %v16,16(%r1,%r2)
|
|
|
00db10 |
+ vfaezbs %v18,%v16,%v17,0
|
|
|
00db10 |
+ jno .Lfast_loop_found16
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vl %v16,32(%r1,%r2)
|
|
|
00db10 |
+ vfaezbs %v18,%v16,%v17,0
|
|
|
00db10 |
+ jno .Lfast_loop_found32
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vl %v16,48(%r1,%r2)
|
|
|
00db10 |
+ vfaezbs %v18,%v16,%v17,0
|
|
|
00db10 |
+ jno .Lfast_loop_found48
|
|
|
00db10 |
+
|
|
|
00db10 |
+ aghi %r1,64
|
|
|
00db10 |
+ j .Lfast_loop /* Loop if no element was unequal to accept
|
|
|
00db10 |
+ and not zero. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /* Found equal or zero element. */
|
|
|
00db10 |
+.Lfast_loop_found48:
|
|
|
00db10 |
+ aghi %r1,16
|
|
|
00db10 |
+.Lfast_loop_found32:
|
|
|
00db10 |
+ aghi %r1,16
|
|
|
00db10 |
+.Lfast_loop_found16:
|
|
|
00db10 |
+ aghi %r1,16
|
|
|
00db10 |
+.Lfast_loop_found:
|
|
|
00db10 |
+ vlgvb %r4,%v18,7 /* Load byte index of found element. */
|
|
|
00db10 |
+.Lfast_loop_found2:
|
|
|
00db10 |
+ vlgvb %r0,%v16,0(%r4) /* Get found element. */
|
|
|
00db10 |
+ clije %r0,0,.Lfast_end_null /* Return null if no accept-char found */
|
|
|
00db10 |
+ algfr %r1,%r4 /* Add found index of char to current len. */
|
|
|
00db10 |
+ la %r2,0(%r1,%r2) /* And return pointer to first equal char. */
|
|
|
00db10 |
+ br %r14
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lfast_end_null:
|
|
|
00db10 |
+ lghi %r2,0 /* Return null if no character is equal. */
|
|
|
00db10 |
+ br %r14
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /*
|
|
|
00db10 |
+ Search s for accept in multiple vregs
|
|
|
00db10 |
+ -------------------------------------
|
|
|
00db10 |
+ */
|
|
|
00db10 |
+.Lslow:
|
|
|
00db10 |
+ /* Save registers. */
|
|
|
00db10 |
+ vlvgg %v30,%r6,0
|
|
|
00db10 |
+ vlvgp %v31,%r8,%r9
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /* accept in v17 without zero. */
|
|
|
00db10 |
+ vlr %v19,%v17 /* Save first acc-part for a fast reload. */
|
|
|
00db10 |
+ vzero %v20 /* Zero for preparing acc-vector. */
|
|
|
00db10 |
+ vone %v24 /* One for checking result of former string. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /* Align s to 16 byte. */
|
|
|
00db10 |
+ risbg %r4,%r2,60,128+63,0 /* Test if s is aligned and
|
|
|
00db10 |
+ %r4 = bits 60-63 'and' 15. */
|
|
|
00db10 |
+ je .Lslow_loop_str /* If s is aligned, loop aligned. */
|
|
|
00db10 |
+ lghi %r0,15
|
|
|
00db10 |
+ slr %r0,%r4 /* Compute highest index to load (15-x). */
|
|
|
00db10 |
+ vll %v16,%r0,0(%r2) /* Load up to 16 byte boundary (vll needs
|
|
|
00db10 |
+ highest index, remaining bytes are 0). */
|
|
|
00db10 |
+ ahi %r0,1 /* Work with loaded byte count. */
|
|
|
00db10 |
+ vzero %v21 /* Zero out global mask. */
|
|
|
00db10 |
+ lghi %r5,0 /* Set current len of accept-string to zero. */
|
|
|
00db10 |
+ vfenezb %v18,%v16,%v16 /* Find zero in current string-part. */
|
|
|
00db10 |
+ lghi %r8,0 /* There is no zero in first accept-part. */
|
|
|
00db10 |
+ vlgvb %r6,%v18,7 /* Load byte index of zero or 16 if no zero. */
|
|
|
00db10 |
+ clije %r6,0,.Lslow_end_null /* If first element is zero
|
|
|
00db10 |
+ (end of string) -> return null */
|
|
|
00db10 |
+ clr %r0,%r6 /* cc==1 if loaded byte count < zero-index. */
|
|
|
00db10 |
+ locrl %r6,%r0 /* Load on cc==1; zero-index = lbc. */
|
|
|
00db10 |
+ j .Lslow_loop_acc
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /* Process s in 16byte aligned loop. */
|
|
|
00db10 |
+.Lslow_next_str:
|
|
|
00db10 |
+ /* Check results of former processed str-part. */
|
|
|
00db10 |
+ vfeeb %v18,%v21,%v24 /* Find first equal match in global mask
|
|
|
00db10 |
+ (ones in element). */
|
|
|
00db10 |
+ vlgvb %r4,%v18,7 /* Get index of first one (=equal)
|
|
|
00db10 |
+ or 16 if no match. */
|
|
|
00db10 |
+ /* Equal-index < min(zero-index, loaded byte count)
|
|
|
00db10 |
+ -> return pointer to equal element. */
|
|
|
00db10 |
+ clrjl %r4,%r6,.Lslow_index_found
|
|
|
00db10 |
+ /* Zero-index < loaded byte count
|
|
|
00db10 |
+ -> former str-part was last str-part
|
|
|
00db10 |
+ -> return null */
|
|
|
00db10 |
+ clrjl %r6,%r0,.Lslow_end_null
|
|
|
00db10 |
+ /* All elements are zero (=no match) -> proceed with next str-part. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vlr %v17,%v19 /* Load first part of accept (no zero). */
|
|
|
00db10 |
+ algfr %r1,%r0 /* Add loaded byte count to current len. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_loop_str:
|
|
|
00db10 |
+ vl %v16,0(%r1,%r2) /* Load search-string */
|
|
|
00db10 |
+ lghi %r0,16 /* Loaded byte count is 16. */
|
|
|
00db10 |
+ vzero %v21 /* Zero out global mask. */
|
|
|
00db10 |
+ lghi %r5,0 /* Set current len of accept to zero. */
|
|
|
00db10 |
+ vfenezb %v18,%v16,%v16 /* Find zero in current string-part. */
|
|
|
00db10 |
+ lghi %r8,0 /* There is no zero in first accept-part. */
|
|
|
00db10 |
+ vlgvb %r6,%v18,7 /* Load byte index of zero or 16 if no zero. */
|
|
|
00db10 |
+ clije %r6,0,.Lslow_end_null /* If first element is zero
|
|
|
00db10 |
+ (end of string) -> return null. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_loop_acc:
|
|
|
00db10 |
+ vfaeb %v22,%v16,%v17,4 /* Create matching-mask (1 in mask ->
|
|
|
00db10 |
+ Character matches any accepted character in
|
|
|
00db10 |
+ this accept-string-part) IN=0, RT=1. */
|
|
|
00db10 |
+ vlgvb %r4,%v22,0 /* Get result of first element. */
|
|
|
00db10 |
+ /* First element is equal to any accepted characters
|
|
|
00db10 |
+ (all other parts of accept cannot lead to a match before this one)
|
|
|
00db10 |
+ -> current len is pointing to first element
|
|
|
00db10 |
+ -> return found */
|
|
|
00db10 |
+ clijh %r4,0,.Lslow_end_found
|
|
|
00db10 |
+ vo %v21,%v21,%v22 /* Global-mask = global-|matching-mask. */
|
|
|
00db10 |
+ /* Proceed with next acc until end of acc is reached. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_next_acc:
|
|
|
00db10 |
+ clijh %r8,0,.Lslow_next_str /* There was a zero in the last acc-part
|
|
|
00db10 |
+ -> add index to current_len and
|
|
|
00db10 |
+ end. */
|
|
|
00db10 |
+ vlbb %v17,16(%r5,%r3),6 /* Load next accept part. */
|
|
|
00db10 |
+ aghi %r5,16 /* Increment current len of accept-string. */
|
|
|
00db10 |
+ lcbb %r9,0(%r5,%r3),6 /* Get loaded byte count of accept-string. */
|
|
|
00db10 |
+ jo .Lslow_next_acc_onbb /* Jump away ifaccept-string is
|
|
|
00db10 |
+ on block-boundary. */
|
|
|
00db10 |
+.Lslow_next_acc_notonbb:
|
|
|
00db10 |
+ vistrbs %v17,%v17 /* Fill with zeros after first zero. */
|
|
|
00db10 |
+ jo .Lslow_loop_acc /* No zero found -> no preparation needed. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_next_acc_prepare_zero:
|
|
|
00db10 |
+ /* Zero in accept-part: fill zeros with first-accept-character. */
|
|
|
00db10 |
+ vlgvb %r8,%v17,0 /* Load first element of acc-part. */
|
|
|
00db10 |
+ clije %r8,0,.Lslow_next_str /* Proceed with next string-part,
|
|
|
00db10 |
+ if first char in this part of accept
|
|
|
00db10 |
+ is a zero. */
|
|
|
00db10 |
+ /* r8>0 -> zero found in this acc-part. */
|
|
|
00db10 |
+ vrepb %v18,%v17,0 /* Replicate first char accross all chars. */
|
|
|
00db10 |
+ vceqb %v22,%v20,%v17 /* Create a mask (v22) of null chars
|
|
|
00db10 |
+ by comparing with 0 (v20). */
|
|
|
00db10 |
+ vsel %v17,%v18,%v17,%v22 /* Replace null chars with first char. */
|
|
|
00db10 |
+ j .Lslow_loop_acc /* Accept part is prepared -> process. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_next_acc_onbb:
|
|
|
00db10 |
+ vfenezb %v18,%v17,%v17 /* Find zero in loaded bytes of accept part. */
|
|
|
00db10 |
+ vlgvb %r8,%v18,7 /* Load byte index of zero. */
|
|
|
00db10 |
+ clrjl %r8,%r9,.Lslow_next_acc_notonbb /* Found a zero in loaded bytes
|
|
|
00db10 |
+ -> Prepare vreg. */
|
|
|
00db10 |
+ vl %v17,0(%r5,%r3) /* Load over boundary ... */
|
|
|
00db10 |
+ lghi %r8,0 /* r8=0 -> no zero in this part of acc,
|
|
|
00db10 |
+ check for zero is in jump-target. */
|
|
|
00db10 |
+ j .Lslow_next_acc_notonbb /* ... and search for zero in
|
|
|
00db10 |
+ fully loaded vreg again. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_end_null:
|
|
|
00db10 |
+ lghi %r1,0 /* Return null if no character is equal. */
|
|
|
00db10 |
+ j .Lslow_end
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_loop_found:
|
|
|
00db10 |
+ vlgvb %r4,%v18,7 /* Load byte index of found element. */
|
|
|
00db10 |
+ vlgvb %r0,%v16,0(%r4) /* Get found element. */
|
|
|
00db10 |
+ clije %r0,0,.Lslow_end_null /* Return null if no acc-char found. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_index_found:
|
|
|
00db10 |
+ algfr %r1,%r4 /* Add found index of char to current len. */
|
|
|
00db10 |
+.Lslow_end_found:
|
|
|
00db10 |
+ la %r1,0(%r1,%r2) /* And return pointer to first equal char. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_end:
|
|
|
00db10 |
+ /* Restore registers. */
|
|
|
00db10 |
+ vlgvg %r6,%v30,0
|
|
|
00db10 |
+ vlgvg %r8,%v31,0
|
|
|
00db10 |
+ vlgvg %r9,%v31,1
|
|
|
00db10 |
+ lgr %r2,%r1
|
|
|
00db10 |
+ br %r14
|
|
|
00db10 |
+END(__strpbrk_vx)
|
|
|
00db10 |
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
|
|
|
00db10 |
diff --git a/sysdeps/s390/multiarch/strpbrk.c b/sysdeps/s390/multiarch/strpbrk.c
|
|
|
00db10 |
new file mode 100644
|
|
|
00db10 |
index 0000000..afcb633
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ b/sysdeps/s390/multiarch/strpbrk.c
|
|
|
00db10 |
@@ -0,0 +1,27 @@
|
|
|
00db10 |
+/* Multiple versions of strpbrk.
|
|
|
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 (__strpbrk, strpbrk)
|
|
|
00db10 |
+
|
|
|
00db10 |
+#else
|
|
|
00db10 |
+# include <string/strpbrk.c>
|
|
|
00db10 |
+#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc) */
|
|
|
00db10 |
diff --git a/sysdeps/s390/multiarch/wcspbrk-c.c b/sysdeps/s390/multiarch/wcspbrk-c.c
|
|
|
00db10 |
new file mode 100644
|
|
|
00db10 |
index 0000000..3a27e60
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ b/sysdeps/s390/multiarch/wcspbrk-c.c
|
|
|
00db10 |
@@ -0,0 +1,31 @@
|
|
|
00db10 |
+/* Default wcspbrk 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 WCSPBRK __wcspbrk_c
|
|
|
00db10 |
+
|
|
|
00db10 |
+# include <wchar.h>
|
|
|
00db10 |
+extern __typeof (wcspbrk) __wcspbrk_c;
|
|
|
00db10 |
+# ifdef SHARED
|
|
|
00db10 |
+# undef libc_hidden_def
|
|
|
00db10 |
+# define libc_hidden_def(name) \
|
|
|
00db10 |
+ __hidden_ver1 (__wcspbrk_c, __GI_wcspbrk, __wcspbrk_c);
|
|
|
00db10 |
+# endif /* SHARED */
|
|
|
00db10 |
+
|
|
|
00db10 |
+# include <wcsmbs/wcspbrk.c>
|
|
|
00db10 |
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
|
|
|
00db10 |
diff --git a/sysdeps/s390/multiarch/wcspbrk-vx.S b/sysdeps/s390/multiarch/wcspbrk-vx.S
|
|
|
00db10 |
new file mode 100644
|
|
|
00db10 |
index 0000000..e6eaf95
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ b/sysdeps/s390/multiarch/wcspbrk-vx.S
|
|
|
00db10 |
@@ -0,0 +1,315 @@
|
|
|
00db10 |
+/* Vector optimized 32/64 bit S/390 version of wcspbrk.
|
|
|
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 *wcspbrk (const wchar_t *s, const wchar_t * accept)
|
|
|
00db10 |
+ The wcspbrk() function locates the first occurrence in the string s
|
|
|
00db10 |
+ of any of the characters in the string accept and returns a pointer
|
|
|
00db10 |
+ to that character or NULL if not found.
|
|
|
00db10 |
+
|
|
|
00db10 |
+ This method checks the length of accept string. If it fits entirely
|
|
|
00db10 |
+ in one vector register, a fast algorithm is used, which does not need
|
|
|
00db10 |
+ to check multiple parts of accept-string. Otherwise a slower full
|
|
|
00db10 |
+ check of accept-string is used.
|
|
|
00db10 |
+
|
|
|
00db10 |
+ register overview:
|
|
|
00db10 |
+ r3: pointer to start of accept-string
|
|
|
00db10 |
+ r2: pointer to start of search-string
|
|
|
00db10 |
+ r0: loaded byte count of vlbb search-string (32bit unsigned)
|
|
|
00db10 |
+ r4: found byte index (32bit unsigned)
|
|
|
00db10 |
+ r1: current return len (64bit unsigned)
|
|
|
00db10 |
+ v16: search-string
|
|
|
00db10 |
+ v17: accept-string
|
|
|
00db10 |
+ v18: temp-vreg
|
|
|
00db10 |
+
|
|
|
00db10 |
+ ONLY FOR SLOW:
|
|
|
00db10 |
+ v19: first accept-string
|
|
|
00db10 |
+ v20: zero for preparing acc-vector
|
|
|
00db10 |
+ v21: global mask; 1 indicates a match between
|
|
|
00db10 |
+ search-string-vreg and any accept-character
|
|
|
00db10 |
+ v22: current mask; 1 indicates a match between
|
|
|
00db10 |
+ search-string-vreg and any accept-character in current acc-vreg
|
|
|
00db10 |
+ v24: one for result-checking of former string-part
|
|
|
00db10 |
+ v30, v31: for re-/storing registers r6, r8, r9
|
|
|
00db10 |
+ r5: current len of accept-string
|
|
|
00db10 |
+ r6: zero-index in search-string or 16 if no zero
|
|
|
00db10 |
+ or min(zero-index, loaded byte count)
|
|
|
00db10 |
+ r8: >0, if former accept-string-part contains a zero,
|
|
|
00db10 |
+ otherwise =0;
|
|
|
00db10 |
+ r9: loaded byte count of vlbb accept-string
|
|
|
00db10 |
+*/
|
|
|
00db10 |
+ENTRY(__wcspbrk_vx)
|
|
|
00db10 |
+ .machine "z13"
|
|
|
00db10 |
+ .machinemode "zarch_nohighgprs"
|
|
|
00db10 |
+
|
|
|
00db10 |
+ tmll %r2,3 /* Test if s is 4-byte aligned? */
|
|
|
00db10 |
+ jne .Lfallback /* And use common-code variant if not. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /*
|
|
|
00db10 |
+ Check if accept-string fits in one vreg:
|
|
|
00db10 |
+ ----------------------------------------
|
|
|
00db10 |
+ */
|
|
|
00db10 |
+ vlbb %v17,0(%r3),6 /* Load accept. */
|
|
|
00db10 |
+ lcbb %r0,0(%r3),6
|
|
|
00db10 |
+ jo .Lcheck_onbb /* Special case if accept lays
|
|
|
00db10 |
+ on block-boundary. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lcheck_notonbb:
|
|
|
00db10 |
+ lghi %r1,0 /* Zero out current len. */
|
|
|
00db10 |
+ vlgvf %r0,%v17,0 /* Get first element. */
|
|
|
00db10 |
+ clije %r0,0,.Lfast_end_null /* Return null if accept is empty. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vistrfs %v17,%v17 /* Fill with zeros after first zero. */
|
|
|
00db10 |
+ je .Lfast /* Zero found -> accept fits in one vreg. */
|
|
|
00db10 |
+ j .Lslow /* No zero -> accept exceeds one vreg */
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lcheck_onbb:
|
|
|
00db10 |
+ /* Accept lays on block-boundary. */
|
|
|
00db10 |
+ nill %r0,65532 /* Recognize only fully loaded characters. */
|
|
|
00db10 |
+ je .Lcheck_onbb2 /* Reload vr, if we loaded no full wchar_t. */
|
|
|
00db10 |
+ vfenezf %v18,%v17,%v17 /* Search zero in loaded accept bytes. */
|
|
|
00db10 |
+ vlgvb %r4,%v18,7 /* Get index of zero or 16 if not found. */
|
|
|
00db10 |
+ clrjl %r4,%r0,.Lcheck_notonbb /* Zero index < loaded bytes count ->
|
|
|
00db10 |
+ accept fits in one vreg;
|
|
|
00db10 |
+ Fill with zeros and proceed
|
|
|
00db10 |
+ with FAST. */
|
|
|
00db10 |
+.Lcheck_onbb2:
|
|
|
00db10 |
+ vl %v17,0(%r3) /* Load accept, which exceeds loaded bytes. */
|
|
|
00db10 |
+ j .Lcheck_notonbb /* Check if accept fits in one vreg. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /*
|
|
|
00db10 |
+ Search s for accept in one vreg
|
|
|
00db10 |
+ -------------------------------
|
|
|
00db10 |
+ */
|
|
|
00db10 |
+.Lfast:
|
|
|
00db10 |
+ /* Complete accept-string in v17 and remaining bytes are zero. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vlbb %v16,0(%r2),6 /* Load s until next 4k-byte boundary. */
|
|
|
00db10 |
+ lcbb %r0,0(%r2),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vfaezfs %v18,%v16,%v17,0 /* Find first element in v16 unequal to any
|
|
|
00db10 |
+ in v17 or first zero element. */
|
|
|
00db10 |
+ vlgvb %r4,%v18,7 /* Load byte index of found element. */
|
|
|
00db10 |
+ /* If found index is within loaded bytes, return with found
|
|
|
00db10 |
+ element index (=equal count). */
|
|
|
00db10 |
+ clrjl %r4,%r0,.Lfast_loop_found2
|
|
|
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 %r1,16 /* current_len = 16. */
|
|
|
00db10 |
+ slr %r1,%r4 /* Compute bytes to 16bytes boundary. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lfast_loop:
|
|
|
00db10 |
+ vl %v16,0(%r1,%r2) /* Load search-string. */
|
|
|
00db10 |
+ vfaezfs %v18,%v16,%v17,0 /* Find first element in v16 equal to any
|
|
|
00db10 |
+ in v17 or first zero element. */
|
|
|
00db10 |
+ jno .Lfast_loop_found
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vl %v16,16(%r1,%r2)
|
|
|
00db10 |
+ vfaezfs %v18,%v16,%v17,0
|
|
|
00db10 |
+ jno .Lfast_loop_found16
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vl %v16,32(%r1,%r2)
|
|
|
00db10 |
+ vfaezfs %v18,%v16,%v17,0
|
|
|
00db10 |
+ jno .Lfast_loop_found32
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vl %v16,48(%r1,%r2)
|
|
|
00db10 |
+ vfaezfs %v18,%v16,%v17,0
|
|
|
00db10 |
+ jno .Lfast_loop_found48
|
|
|
00db10 |
+
|
|
|
00db10 |
+ aghi %r1,64
|
|
|
00db10 |
+ j .Lfast_loop /* Loop if no element was unequal to accept
|
|
|
00db10 |
+ and not zero. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /* Found equal or zero element. */
|
|
|
00db10 |
+.Lfast_loop_found48:
|
|
|
00db10 |
+ aghi %r1,16
|
|
|
00db10 |
+.Lfast_loop_found32:
|
|
|
00db10 |
+ aghi %r1,16
|
|
|
00db10 |
+.Lfast_loop_found16:
|
|
|
00db10 |
+ aghi %r1,16
|
|
|
00db10 |
+.Lfast_loop_found:
|
|
|
00db10 |
+ vlgvb %r4,%v18,7 /* Load byte index of found element. */
|
|
|
00db10 |
+.Lfast_loop_found2:
|
|
|
00db10 |
+ srlg %r5,%r4,2 /* Convert byte-index to character-index. */
|
|
|
00db10 |
+ vlgvf %r0,%v16,0(%r5) /* Get found element. */
|
|
|
00db10 |
+ clije %r0,0,.Lfast_end_null /* Return null if no accept-char found */
|
|
|
00db10 |
+ algfr %r1,%r4 /* Add found index of char to current len. */
|
|
|
00db10 |
+ la %r2,0(%r1,%r2) /* And return pointer to first equal char. */
|
|
|
00db10 |
+ br %r14
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lfast_end_null:
|
|
|
00db10 |
+ lghi %r2,0 /* Return null if no character is equal. */
|
|
|
00db10 |
+ br %r14
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /*
|
|
|
00db10 |
+ Search s for accept in multiple vregs
|
|
|
00db10 |
+ -------------------------------------
|
|
|
00db10 |
+ */
|
|
|
00db10 |
+.Lslow:
|
|
|
00db10 |
+ /* Save registers. */
|
|
|
00db10 |
+ vlvgg %v30,%r6,0
|
|
|
00db10 |
+ vlvgp %v31,%r8,%r9
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /* Accept in v17 without zero */
|
|
|
00db10 |
+ vlr %v19,%v17 /* Save first acc-part for a fast reload. */
|
|
|
00db10 |
+ vzero %v20 /* Zero for preparing acc-vector. */
|
|
|
00db10 |
+ vone %v24 /* One for checking result of former string. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /* Align s to 16 byte. */
|
|
|
00db10 |
+ risbg %r4,%r2,60,128+63,0 /* Test if s is aligned and
|
|
|
00db10 |
+ %r4 = bits 60-63 'and' 15. */
|
|
|
00db10 |
+ je .Lslow_loop_str /* If s is aligned, loop aligned. */
|
|
|
00db10 |
+ lghi %r0,15
|
|
|
00db10 |
+ slr %r0,%r4 /* Compute highest index to load (15-x). */
|
|
|
00db10 |
+ vll %v16,%r0,0(%r2) /* Load up to 16byte boundary;
|
|
|
00db10 |
+ needs highest index, left bytes are 0. */
|
|
|
00db10 |
+ ahi %r0,1 /* Work with loaded byte count. */
|
|
|
00db10 |
+ vzero %v21 /* Zero out global mask. */
|
|
|
00db10 |
+ lghi %r5,0 /* Set current len of accept-string to zero. */
|
|
|
00db10 |
+ vfenezf %v18,%v16,%v16 /* Find zero in current string-part. */
|
|
|
00db10 |
+ lghi %r8,0 /* There is no zero in first accept-part. */
|
|
|
00db10 |
+ vlgvb %r6,%v18,7 /* Load byte index of zero or 16 if no zero. */
|
|
|
00db10 |
+ clije %r6,0,.Lslow_end_null /* If first element is zero
|
|
|
00db10 |
+ (end of string) -> return null */
|
|
|
00db10 |
+ clr %r0,%r6 /* cc==1 if loaded byte count < zero-index. */
|
|
|
00db10 |
+ locrl %r6,%r0 /* Load on cc==1; zero-index = lbc. */
|
|
|
00db10 |
+ j .Lslow_loop_acc
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+ /* Process s in 16byte aligned loop. */
|
|
|
00db10 |
+.Lslow_next_str:
|
|
|
00db10 |
+ /* Check results of former processed str-part. */
|
|
|
00db10 |
+ vfeef %v18,%v21,%v24 /* Find first equal match in global mask
|
|
|
00db10 |
+ (ones in element). */
|
|
|
00db10 |
+ vlgvb %r4,%v18,7 /* Get index of first one (=equal)
|
|
|
00db10 |
+ or 16 if no match. */
|
|
|
00db10 |
+ /* Equal-index < min(zero-index, loaded byte count)
|
|
|
00db10 |
+ -> return pointer to equal element. */
|
|
|
00db10 |
+ clrjl %r4,%r6,.Lslow_index_found
|
|
|
00db10 |
+ /* Zero-index < loaded byte count
|
|
|
00db10 |
+ -> former str-part was last str-part
|
|
|
00db10 |
+ -> return null */
|
|
|
00db10 |
+ clrjl %r6,%r0,.Lslow_end_null
|
|
|
00db10 |
+ /* All elements are zero (=no match) -> proceed with next str-part. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+ vlr %v17,%v19 /* Load first part of accept (no zero). */
|
|
|
00db10 |
+ algfr %r1,%r0 /* Add loaded byte count to current len. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_loop_str:
|
|
|
00db10 |
+ vl %v16,0(%r1,%r2) /* Load search-string */
|
|
|
00db10 |
+ lghi %r0,16 /* Loaded byte count is 16. */
|
|
|
00db10 |
+ vzero %v21 /* Zero out global mask. */
|
|
|
00db10 |
+ lghi %r5,0 /* Set current len of accept to zero. */
|
|
|
00db10 |
+ vfenezf %v18,%v16,%v16 /* Find zero in current string-part. */
|
|
|
00db10 |
+ lghi %r8,0 /* There is no zero in first accept-part. */
|
|
|
00db10 |
+ vlgvb %r6,%v18,7 /* Load byte index of zero or 16 if no zero. */
|
|
|
00db10 |
+ clije %r6,0,.Lslow_end_null /* If first element is zero
|
|
|
00db10 |
+ (end of string) -> return null. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_loop_acc:
|
|
|
00db10 |
+ vfaef %v22,%v16,%v17,4 /* Create matching-mask (1 in mask ->
|
|
|
00db10 |
+ Character matches any accepted character in
|
|
|
00db10 |
+ this accept-string-part) IN=0, RT=1. */
|
|
|
00db10 |
+ vlgvf %r4,%v22,0 /* Get result of first element. */
|
|
|
00db10 |
+ /* First element is equal to any accepted characters
|
|
|
00db10 |
+ (all other parts of accept cannot lead to a match before this one)
|
|
|
00db10 |
+ -> current len is pointing to first element
|
|
|
00db10 |
+ -> return found */
|
|
|
00db10 |
+ clijh %r4,0,.Lslow_end_found
|
|
|
00db10 |
+ vo %v21,%v21,%v22 /* Global-mask = global-|matching-mask. */
|
|
|
00db10 |
+ /* Proceed with next acc until end of acc is reached. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_next_acc:
|
|
|
00db10 |
+ clijh %r8,0,.Lslow_next_str /* There was a zero in the last acc-part
|
|
|
00db10 |
+ -> add index to current len and
|
|
|
00db10 |
+ end. */
|
|
|
00db10 |
+ vlbb %v17,16(%r5,%r3),6 /* Load next accept part. */
|
|
|
00db10 |
+ aghi %r5,16 /* Increment current len of accept-string. */
|
|
|
00db10 |
+ lcbb %r9,0(%r5,%r3),6 /* Get loaded byte count of accept-string. */
|
|
|
00db10 |
+ jo .Lslow_next_acc_onbb /* Jump away ifaccept-string is
|
|
|
00db10 |
+ on block-boundary. */
|
|
|
00db10 |
+.Lslow_next_acc_notonbb:
|
|
|
00db10 |
+ vistrfs %v17,%v17 /* Fill with zeros after first zero. */
|
|
|
00db10 |
+ jo .Lslow_loop_acc /* No zero found -> no preparation needed. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_next_acc_prepare_zero:
|
|
|
00db10 |
+ /* Zero in accept-part: fill zeros with first-accept-character. */
|
|
|
00db10 |
+ vlgvf %r8,%v17,0 /* Load first element of acc-part. */
|
|
|
00db10 |
+ clije %r8,0,.Lslow_next_str /* Proceed with next string-part,
|
|
|
00db10 |
+ If first char in this part of accept
|
|
|
00db10 |
+ is a zero. */
|
|
|
00db10 |
+ /* r8>0 -> zero found in this acc-part. */
|
|
|
00db10 |
+ vrepf %v18,%v17,0 /* Replicate first char accross all chars. */
|
|
|
00db10 |
+ vceqf %v22,%v20,%v17 /* Create a mask (v22) of null chars
|
|
|
00db10 |
+ by comparing with 0 (v20). */
|
|
|
00db10 |
+ vsel %v17,%v18,%v17,%v22 /* Replace null chars with first char. */
|
|
|
00db10 |
+ j .Lslow_loop_acc /* Accept part is prepared -> process. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_next_acc_onbb:
|
|
|
00db10 |
+ nill %r9,65532 /* Recognize only fully loaded characters. */
|
|
|
00db10 |
+ je .Lslow_next_acc_onbb2 /* Reload vr, if no full wchar_t. */
|
|
|
00db10 |
+ vfenezf %v18,%v17,%v17 /* Find zero in loaded bytes of accept part. */
|
|
|
00db10 |
+ vlgvb %r8,%v18,7 /* Load byte index of zero. */
|
|
|
00db10 |
+ clrjl %r8,%r9,.Lslow_next_acc_notonbb /* Found a zero in loaded bytes
|
|
|
00db10 |
+ -> Prepare vreg. */
|
|
|
00db10 |
+.Lslow_next_acc_onbb2:
|
|
|
00db10 |
+ vl %v17,0(%r5,%r3) /* Load over boundary ... */
|
|
|
00db10 |
+ lghi %r8,0 /* r8=0 -> no zero in this part of acc,
|
|
|
00db10 |
+ check for zero is in jump-target. */
|
|
|
00db10 |
+ j .Lslow_next_acc_notonbb /* ... and search for zero in
|
|
|
00db10 |
+ fully loaded vreg again. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_end_null:
|
|
|
00db10 |
+ lghi %r1,0 /* Return null if no character is equal. */
|
|
|
00db10 |
+ j .Lslow_end
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_loop_found:
|
|
|
00db10 |
+ vlgvb %r4,%v18,7 /* Load byte index of found element. */
|
|
|
00db10 |
+ srlg %r5,%r4,2 /* Convert byte-index to character-index. */
|
|
|
00db10 |
+ vlgvf %r0,%v16,0(%r5) /* Get found element. */
|
|
|
00db10 |
+ clije %r0,0,.Lslow_end_null /* Return null if no acc-char found. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_index_found:
|
|
|
00db10 |
+ algfr %r1,%r4 /* Add found index of char to current len. */
|
|
|
00db10 |
+.Lslow_end_found:
|
|
|
00db10 |
+ la %r1,0(%r1,%r2) /* And return pointer to first equal char. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+.Lslow_end:
|
|
|
00db10 |
+ /* Restore registers. */
|
|
|
00db10 |
+ vlgvg %r6,%v30,0
|
|
|
00db10 |
+ vlgvg %r8,%v31,0
|
|
|
00db10 |
+ vlgvg %r9,%v31,1
|
|
|
00db10 |
+ lgr %r2,%r1
|
|
|
00db10 |
+ br %r14
|
|
|
00db10 |
+.Lfallback:
|
|
|
00db10 |
+ jg __wcspbrk_c
|
|
|
00db10 |
+END(__wcspbrk_vx)
|
|
|
00db10 |
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
|
|
|
00db10 |
diff --git a/sysdeps/s390/multiarch/wcspbrk.c b/sysdeps/s390/multiarch/wcspbrk.c
|
|
|
00db10 |
new file mode 100644
|
|
|
00db10 |
index 0000000..1a0ef9c
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ b/sysdeps/s390/multiarch/wcspbrk.c
|
|
|
00db10 |
@@ -0,0 +1,27 @@
|
|
|
00db10 |
+/* Multiple versions of wcspbrk.
|
|
|
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 (__wcspbrk, wcspbrk)
|
|
|
00db10 |
+
|
|
|
00db10 |
+#else
|
|
|
00db10 |
+# include <wcsmbs/wcspbrk.c>
|
|
|
00db10 |
+#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc) */
|
|
|
00db10 |
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
|
|
|
00db10 |
index 843a23c..7ecff8b 100644
|
|
|
00db10 |
--- a/wcsmbs/Makefile
|
|
|
00db10 |
+++ b/wcsmbs/Makefile
|
|
|
00db10 |
@@ -42,7 +42,7 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
|
|
|
00db10 |
mbrtoc16 c16rtomb
|
|
|
00db10 |
|
|
|
00db10 |
strop-tests := wcscmp wcsncmp wmemcmp wcslen wcschr wcsrchr wcscpy wcsnlen \
|
|
|
00db10 |
- wcpcpy wcsncpy wcpncpy wcscat wcsncat wcschrnul wcsspn
|
|
|
00db10 |
+ wcpcpy wcsncpy wcpncpy wcscat wcsncat wcschrnul wcsspn wcspbrk
|
|
|
00db10 |
tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
|
|
|
00db10 |
tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
|
|
|
00db10 |
tst-c16c32-1 wcsatcliff $(addprefix test-,$(strop-tests))
|
|
|
00db10 |
diff --git a/wcsmbs/test-wcspbrk-ifunc.c b/wcsmbs/test-wcspbrk-ifunc.c
|
|
|
00db10 |
new file mode 100644
|
|
|
00db10 |
index 0000000..af389b6
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ b/wcsmbs/test-wcspbrk-ifunc.c
|
|
|
00db10 |
@@ -0,0 +1,20 @@
|
|
|
00db10 |
+/* Test and measure IFUNC implementations of wcspbrk function.
|
|
|
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 TEST_IFUNC 1
|
|
|
00db10 |
+#include "test-wcspbrk.c"
|
|
|
00db10 |
diff --git a/wcsmbs/test-wcspbrk.c b/wcsmbs/test-wcspbrk.c
|
|
|
00db10 |
new file mode 100644
|
|
|
00db10 |
index 0000000..98e44e5
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ b/wcsmbs/test-wcspbrk.c
|
|
|
00db10 |
@@ -0,0 +1,20 @@
|
|
|
00db10 |
+/* Test wcspbrk 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 "../string/test-strpbrk.c"
|
|
|
00db10 |
diff --git a/wcsmbs/wcspbrk.c b/wcsmbs/wcspbrk.c
|
|
|
00db10 |
index a39f148..b769a38 100644
|
|
|
00db10 |
--- a/wcsmbs/wcspbrk.c
|
|
|
00db10 |
+++ b/wcsmbs/wcspbrk.c
|
|
|
00db10 |
@@ -18,6 +18,9 @@
|
|
|
00db10 |
|
|
|
00db10 |
#include <wchar.h>
|
|
|
00db10 |
|
|
|
00db10 |
+#ifdef WCSPBRK
|
|
|
00db10 |
+# define wcspbrk WCSPBRK
|
|
|
00db10 |
+#endif
|
|
|
00db10 |
|
|
|
00db10 |
/* Find the first occurrence in WCS of any wide-character in ACCEPT. */
|
|
|
00db10 |
wchar_t *
|
|
|
00db10 |
--
|
|
|
00db10 |
2.3.0
|
|
|
00db10 |
|