|
|
ce426f |
From 6be435ec4f615266351487da396333f3ff026c03 Mon Sep 17 00:00:00 2001
|
|
|
ce426f |
From: Stefan Liebler <stli@linux.vnet.ibm.com>
|
|
|
ce426f |
Date: Thu, 8 Oct 2015 13:02:41 +0200
|
|
|
ce426f |
Subject: [PATCH 25/30] S390: Optimize strcspn and wcscspn.
|
|
|
ce426f |
|
|
|
ce426f |
upstream-commit-id: b4c21601b147efc3c2b0e679e4ffc554b3987f0b
|
|
|
ce426f |
https://www.sourceware.org/ml/libc-alpha/2015-07/msg00099.html
|
|
|
ce426f |
|
|
|
ce426f |
This patch provides optimized versions of strcspn and wcscspn with the z13
|
|
|
ce426f |
vector instructions.
|
|
|
ce426f |
|
|
|
ce426f |
ChangeLog:
|
|
|
ce426f |
|
|
|
ce426f |
* sysdeps/s390/multiarch/strcspn-c.c: New File.
|
|
|
ce426f |
* sysdeps/s390/multiarch/strcspn-vx.S: Likewise.
|
|
|
ce426f |
* sysdeps/s390/multiarch/strcspn.c: Likewise.
|
|
|
ce426f |
* sysdeps/s390/multiarch/wcscspn-c.c: Likewise.
|
|
|
ce426f |
* sysdeps/s390/multiarch/wcscspn-vx.S: Likewise.
|
|
|
ce426f |
* sysdeps/s390/multiarch/wcscspn.c: Likewise.
|
|
|
ce426f |
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcspn and
|
|
|
ce426f |
wcscspn functions.
|
|
|
ce426f |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
ce426f |
(__libc_ifunc_impl_list): Add ifunc test for strcspn, wcscspn.
|
|
|
ce426f |
* wcsmbs/wcscspn.c: Use WCSCSPN if defined.
|
|
|
ce426f |
* string/test-strcspn.c: Add wcscspn support.
|
|
|
ce426f |
* wcsmbs/test-wcscspn.c: New File.
|
|
|
ce426f |
* wcsmbs/Makefile (strop-tests): Add wcscspn.
|
|
|
ce426f |
* benchtests/bench-strcspn.c: Add wcscspn support.
|
|
|
ce426f |
* benchtests/bench-wcscspn.c: New File.
|
|
|
ce426f |
* benchtests/Makefile (wcsmbs-bench): Add wcscspn.
|
|
|
ce426f |
---
|
|
|
ce426f |
benchtests/Makefile | 2 +-
|
|
|
ce426f |
benchtests/bench-strcspn.c | 45 +++--
|
|
|
ce426f |
benchtests/bench-wcscspn.c | 20 +++
|
|
|
ce426f |
string/strcspn.c | 8 +-
|
|
|
ce426f |
string/test-strcspn.c | 45 +++--
|
|
|
ce426f |
sysdeps/s390/multiarch/Makefile | 6 +-
|
|
|
ce426f |
sysdeps/s390/multiarch/ifunc-impl-list.c | 3 +
|
|
|
ce426f |
sysdeps/s390/multiarch/strcspn-c.c | 28 +++
|
|
|
ce426f |
sysdeps/s390/multiarch/strcspn-vx.S | 281 +++++++++++++++++++++++++++++
|
|
|
ce426f |
sysdeps/s390/multiarch/strcspn.c | 27 +++
|
|
|
ce426f |
sysdeps/s390/multiarch/wcscspn-c.c | 26 +++
|
|
|
ce426f |
sysdeps/s390/multiarch/wcscspn-vx.S | 293 +++++++++++++++++++++++++++++++
|
|
|
ce426f |
sysdeps/s390/multiarch/wcscspn.c | 27 +++
|
|
|
ce426f |
wcsmbs/Makefile | 3 +-
|
|
|
ce426f |
wcsmbs/test-wcscspn-ifunc.c | 20 +++
|
|
|
ce426f |
wcsmbs/test-wcscspn.c | 20 +++
|
|
|
ce426f |
wcsmbs/wcscspn.c | 3 +
|
|
|
ce426f |
17 files changed, 826 insertions(+), 31 deletions(-)
|
|
|
ce426f |
create mode 100644 benchtests/bench-wcscspn.c
|
|
|
ce426f |
create mode 100644 sysdeps/s390/multiarch/strcspn-c.c
|
|
|
ce426f |
create mode 100644 sysdeps/s390/multiarch/strcspn-vx.S
|
|
|
ce426f |
create mode 100644 sysdeps/s390/multiarch/strcspn.c
|
|
|
ce426f |
create mode 100644 sysdeps/s390/multiarch/wcscspn-c.c
|
|
|
ce426f |
create mode 100644 sysdeps/s390/multiarch/wcscspn-vx.S
|
|
|
ce426f |
create mode 100644 sysdeps/s390/multiarch/wcscspn.c
|
|
|
ce426f |
create mode 100644 wcsmbs/test-wcscspn-ifunc.c
|
|
|
ce426f |
create mode 100644 wcsmbs/test-wcscspn.c
|
|
|
ce426f |
|
|
|
ce426f |
diff --git a/benchtests/Makefile b/benchtests/Makefile
|
|
|
ce426f |
index 015b5d6..4e811a9 100644
|
|
|
ce426f |
--- a/benchtests/Makefile
|
|
|
ce426f |
+++ b/benchtests/Makefile
|
|
|
ce426f |
@@ -39,7 +39,7 @@ string-bench := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
|
|
|
ce426f |
strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
|
|
|
ce426f |
strspn strstr strcpy_chk stpcpy_chk memrchr strsep strtok
|
|
|
ce426f |
wcsmbs-bench := wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat \
|
|
|
ce426f |
- wcsncmp wcsncmp wcschr wcschrnul wcsrchr wcsspn wcspbrk
|
|
|
ce426f |
+ wcsncmp wcsncmp wcschr wcschrnul wcsrchr wcsspn wcspbrk wcscspn
|
|
|
ce426f |
string-bench-all := $(string-bench) ${wcsmbs-bench}
|
|
|
ce426f |
|
|
|
ce426f |
stdlib-bench := strtod
|
|
|
ce426f |
diff --git a/benchtests/bench-strcspn.c b/benchtests/bench-strcspn.c
|
|
|
ce426f |
index 22b3b84..25de640 100644
|
|
|
ce426f |
--- a/benchtests/bench-strcspn.c
|
|
|
ce426f |
+++ b/benchtests/bench-strcspn.c
|
|
|
ce426f |
@@ -19,22 +19,41 @@
|
|
|
ce426f |
#define STRPBRK_RESULT(s, pos) (pos)
|
|
|
ce426f |
#define RES_TYPE size_t
|
|
|
ce426f |
#define TEST_MAIN
|
|
|
ce426f |
-#define TEST_NAME "strcspn"
|
|
|
ce426f |
+#ifndef WIDE
|
|
|
ce426f |
+# define TEST_NAME "strcspn"
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+# define TEST_NAME "wcscspn"
|
|
|
ce426f |
+#endif /* WIDE */
|
|
|
ce426f |
#include "bench-string.h"
|
|
|
ce426f |
|
|
|
ce426f |
-typedef size_t (*proto_t) (const char *, const char *);
|
|
|
ce426f |
-size_t simple_strcspn (const char *, const char *);
|
|
|
ce426f |
-size_t stupid_strcspn (const char *, const char *);
|
|
|
ce426f |
+#ifndef WIDE
|
|
|
ce426f |
+# define STRCSPN strcspn
|
|
|
ce426f |
+# define CHAR char
|
|
|
ce426f |
+# define SIMPLE_STRCSPN simple_strcspn
|
|
|
ce426f |
+# define STUPID_STRCSPN stupid_strcspn
|
|
|
ce426f |
+# define STRLEN strlen
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+# include <wchar.h>
|
|
|
ce426f |
+# define STRCSPN wcscspn
|
|
|
ce426f |
+# define CHAR wchar_t
|
|
|
ce426f |
+# define SIMPLE_STRCSPN simple_wcscspn
|
|
|
ce426f |
+# define STUPID_STRCSPN stupid_wcscspn
|
|
|
ce426f |
+# define STRLEN wcslen
|
|
|
ce426f |
+#endif /* WIDE */
|
|
|
ce426f |
|
|
|
ce426f |
-IMPL (stupid_strcspn, 0)
|
|
|
ce426f |
-IMPL (simple_strcspn, 0)
|
|
|
ce426f |
-IMPL (strcspn, 1)
|
|
|
ce426f |
+typedef size_t (*proto_t) (const CHAR *, const CHAR *);
|
|
|
ce426f |
+size_t SIMPLE_STRCSPN (const CHAR *, const CHAR *);
|
|
|
ce426f |
+size_t STUPID_STRCSPN (const CHAR *, const CHAR *);
|
|
|
ce426f |
+
|
|
|
ce426f |
+IMPL (STUPID_STRCSPN, 0)
|
|
|
ce426f |
+IMPL (SIMPLE_STRCSPN, 0)
|
|
|
ce426f |
+IMPL (STRCSPN, 1)
|
|
|
ce426f |
|
|
|
ce426f |
size_t
|
|
|
ce426f |
-simple_strcspn (const char *s, const char *rej)
|
|
|
ce426f |
+SIMPLE_STRCSPN (const CHAR *s, const CHAR *rej)
|
|
|
ce426f |
{
|
|
|
ce426f |
- const char *r, *str = s;
|
|
|
ce426f |
- char c;
|
|
|
ce426f |
+ const CHAR *r, *str = s;
|
|
|
ce426f |
+ CHAR c;
|
|
|
ce426f |
|
|
|
ce426f |
while ((c = *s++) != '\0')
|
|
|
ce426f |
for (r = rej; *r != '\0'; ++r)
|
|
|
ce426f |
@@ -44,9 +63,9 @@ simple_strcspn (const char *s, const char *rej)
|
|
|
ce426f |
}
|
|
|
ce426f |
|
|
|
ce426f |
size_t
|
|
|
ce426f |
-stupid_strcspn (const char *s, const char *rej)
|
|
|
ce426f |
+STUPID_STRCSPN (const CHAR *s, const CHAR *rej)
|
|
|
ce426f |
{
|
|
|
ce426f |
- size_t ns = strlen (s), nrej = strlen (rej);
|
|
|
ce426f |
+ size_t ns = STRLEN (s), nrej = STRLEN (rej);
|
|
|
ce426f |
size_t i, j;
|
|
|
ce426f |
|
|
|
ce426f |
for (i = 0; i < ns; ++i)
|
|
|
ce426f |
@@ -56,4 +75,6 @@ stupid_strcspn (const char *s, const char *rej)
|
|
|
ce426f |
return i;
|
|
|
ce426f |
}
|
|
|
ce426f |
|
|
|
ce426f |
+#undef CHAR
|
|
|
ce426f |
+#undef STRLEN
|
|
|
ce426f |
#include "bench-strpbrk.c"
|
|
|
ce426f |
diff --git a/benchtests/bench-wcscspn.c b/benchtests/bench-wcscspn.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..3991951
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ b/benchtests/bench-wcscspn.c
|
|
|
ce426f |
@@ -0,0 +1,20 @@
|
|
|
ce426f |
+/* Measure wcscspn functions.
|
|
|
ce426f |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#define WIDE 1
|
|
|
ce426f |
+#include "bench-strcspn.c"
|
|
|
ce426f |
diff --git a/string/strcspn.c b/string/strcspn.c
|
|
|
ce426f |
index 6290429..0c750a8 100644
|
|
|
ce426f |
--- a/string/strcspn.c
|
|
|
ce426f |
+++ b/string/strcspn.c
|
|
|
ce426f |
@@ -30,12 +30,14 @@
|
|
|
ce426f |
|
|
|
ce426f |
#undef strcspn
|
|
|
ce426f |
|
|
|
ce426f |
+#ifndef STRCSPN
|
|
|
ce426f |
+# define STRCSPN strcspn
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
+
|
|
|
ce426f |
/* Return the length of the maximum initial segment of S
|
|
|
ce426f |
which contains no characters from REJECT. */
|
|
|
ce426f |
size_t
|
|
|
ce426f |
-strcspn (s, reject)
|
|
|
ce426f |
- const char *s;
|
|
|
ce426f |
- const char *reject;
|
|
|
ce426f |
+STRCSPN (const char *s, const char *reject)
|
|
|
ce426f |
{
|
|
|
ce426f |
size_t count = 0;
|
|
|
ce426f |
|
|
|
ce426f |
diff --git a/string/test-strcspn.c b/string/test-strcspn.c
|
|
|
ce426f |
index e2863c7..3443425 100644
|
|
|
ce426f |
--- a/string/test-strcspn.c
|
|
|
ce426f |
+++ b/string/test-strcspn.c
|
|
|
ce426f |
@@ -20,22 +20,41 @@
|
|
|
ce426f |
#define STRPBRK_RESULT(s, pos) (pos)
|
|
|
ce426f |
#define RES_TYPE size_t
|
|
|
ce426f |
#define TEST_MAIN
|
|
|
ce426f |
-#define TEST_NAME "strcspn"
|
|
|
ce426f |
+#ifndef WIDE
|
|
|
ce426f |
+# define TEST_NAME "strcspn"
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+# define TEST_NAME "wcscspn"
|
|
|
ce426f |
+#endif /* WIDE */
|
|
|
ce426f |
#include "test-string.h"
|
|
|
ce426f |
|
|
|
ce426f |
-typedef size_t (*proto_t) (const char *, const char *);
|
|
|
ce426f |
-size_t simple_strcspn (const char *, const char *);
|
|
|
ce426f |
-size_t stupid_strcspn (const char *, const char *);
|
|
|
ce426f |
+#ifndef WIDE
|
|
|
ce426f |
+# define STRCSPN strcspn
|
|
|
ce426f |
+# define CHAR char
|
|
|
ce426f |
+# define SIMPLE_STRCSPN simple_strcspn
|
|
|
ce426f |
+# define STUPID_STRCSPN stupid_strcspn
|
|
|
ce426f |
+# define STRLEN strlen
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+# include <wchar.h>
|
|
|
ce426f |
+# define STRCSPN wcscspn
|
|
|
ce426f |
+# define CHAR wchar_t
|
|
|
ce426f |
+# define SIMPLE_STRCSPN simple_wcscspn
|
|
|
ce426f |
+# define STUPID_STRCSPN stupid_wcscspn
|
|
|
ce426f |
+# define STRLEN wcslen
|
|
|
ce426f |
+#endif /* WIDE */
|
|
|
ce426f |
|
|
|
ce426f |
-IMPL (stupid_strcspn, 0)
|
|
|
ce426f |
-IMPL (simple_strcspn, 0)
|
|
|
ce426f |
-IMPL (strcspn, 1)
|
|
|
ce426f |
+typedef size_t (*proto_t) (const CHAR *, const CHAR *);
|
|
|
ce426f |
+size_t SIMPLE_STRCSPN (const CHAR *, const CHAR *);
|
|
|
ce426f |
+size_t STUPID_STRCSPN (const CHAR *, const CHAR *);
|
|
|
ce426f |
+
|
|
|
ce426f |
+IMPL (STUPID_STRCSPN, 0)
|
|
|
ce426f |
+IMPL (SIMPLE_STRCSPN, 0)
|
|
|
ce426f |
+IMPL (STRCSPN, 1)
|
|
|
ce426f |
|
|
|
ce426f |
size_t
|
|
|
ce426f |
-simple_strcspn (const char *s, const char *rej)
|
|
|
ce426f |
+SIMPLE_STRCSPN (const CHAR *s, const CHAR *rej)
|
|
|
ce426f |
{
|
|
|
ce426f |
- const char *r, *str = s;
|
|
|
ce426f |
- char c;
|
|
|
ce426f |
+ const CHAR *r, *str = s;
|
|
|
ce426f |
+ CHAR c;
|
|
|
ce426f |
|
|
|
ce426f |
while ((c = *s++) != '\0')
|
|
|
ce426f |
for (r = rej; *r != '\0'; ++r)
|
|
|
ce426f |
@@ -45,9 +64,9 @@ simple_strcspn (const char *s, const char *rej)
|
|
|
ce426f |
}
|
|
|
ce426f |
|
|
|
ce426f |
size_t
|
|
|
ce426f |
-stupid_strcspn (const char *s, const char *rej)
|
|
|
ce426f |
+STUPID_STRCSPN (const CHAR *s, const CHAR *rej)
|
|
|
ce426f |
{
|
|
|
ce426f |
- size_t ns = strlen (s), nrej = strlen (rej);
|
|
|
ce426f |
+ size_t ns = STRLEN (s), nrej = STRLEN (rej);
|
|
|
ce426f |
size_t i, j;
|
|
|
ce426f |
|
|
|
ce426f |
for (i = 0; i < ns; ++i)
|
|
|
ce426f |
@@ -57,4 +76,6 @@ stupid_strcspn (const char *s, const char *rej)
|
|
|
ce426f |
return i;
|
|
|
ce426f |
}
|
|
|
ce426f |
|
|
|
ce426f |
+#undef CHAR
|
|
|
ce426f |
+#undef STRLEN
|
|
|
ce426f |
#include "test-strpbrk.c"
|
|
|
ce426f |
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
|
|
|
ce426f |
index 5765a8c..2c1fce0 100644
|
|
|
ce426f |
--- a/sysdeps/s390/multiarch/Makefile
|
|
|
ce426f |
+++ b/sysdeps/s390/multiarch/Makefile
|
|
|
ce426f |
@@ -13,7 +13,8 @@ sysdep_routines += strlen strlen-vx strlen-c \
|
|
|
ce426f |
strchrnul strchrnul-vx strchrnul-c \
|
|
|
ce426f |
strrchr strrchr-vx strrchr-c \
|
|
|
ce426f |
strspn strspn-vx strspn-c \
|
|
|
ce426f |
- strpbrk strpbrk-vx strpbrk-c
|
|
|
ce426f |
+ strpbrk strpbrk-vx strpbrk-c \
|
|
|
ce426f |
+ strcspn strcspn-vx strcspn-c
|
|
|
ce426f |
endif
|
|
|
ce426f |
|
|
|
ce426f |
ifeq ($(subdir),wcsmbs)
|
|
|
ce426f |
@@ -31,5 +32,6 @@ sysdep_routines += wcslen wcslen-vx wcslen-c \
|
|
|
ce426f |
wcschrnul wcschrnul-vx wcschrnul-c \
|
|
|
ce426f |
wcsrchr wcsrchr-vx wcsrchr-c \
|
|
|
ce426f |
wcsspn wcsspn-vx wcsspn-c \
|
|
|
ce426f |
- wcspbrk wcspbrk-vx wcspbrk-c
|
|
|
ce426f |
+ wcspbrk wcspbrk-vx wcspbrk-c \
|
|
|
ce426f |
+ wcscspn wcscspn-vx wcscspn-c
|
|
|
ce426f |
endif
|
|
|
ce426f |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
ce426f |
index b39a5c5..7f62e49 100644
|
|
|
ce426f |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
ce426f |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
ce426f |
@@ -124,6 +124,9 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
ce426f |
IFUNC_VX_IMPL (strpbrk);
|
|
|
ce426f |
IFUNC_VX_IMPL (wcspbrk);
|
|
|
ce426f |
|
|
|
ce426f |
+ IFUNC_VX_IMPL (strcspn);
|
|
|
ce426f |
+ IFUNC_VX_IMPL (wcscspn);
|
|
|
ce426f |
+
|
|
|
ce426f |
#endif /* HAVE_S390_VX_ASM_SUPPORT */
|
|
|
ce426f |
|
|
|
ce426f |
return i;
|
|
|
ce426f |
diff --git a/sysdeps/s390/multiarch/strcspn-c.c b/sysdeps/s390/multiarch/strcspn-c.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..af04b4e
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ b/sysdeps/s390/multiarch/strcspn-c.c
|
|
|
ce426f |
@@ -0,0 +1,28 @@
|
|
|
ce426f |
+/* Default strcspn implementation for S/390.
|
|
|
ce426f |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
ce426f |
+# define STRCSPN __strcspn_c
|
|
|
ce426f |
+# ifdef SHARED
|
|
|
ce426f |
+# undef libc_hidden_builtin_def
|
|
|
ce426f |
+# define libc_hidden_builtin_def(name) \
|
|
|
ce426f |
+ __hidden_ver1 (__strcspn_c, __GI_strcspn, __strcspn_c);
|
|
|
ce426f |
+# endif /* SHARED */
|
|
|
ce426f |
+
|
|
|
ce426f |
+# include <string/strcspn.c>
|
|
|
ce426f |
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
|
|
|
ce426f |
diff --git a/sysdeps/s390/multiarch/strcspn-vx.S b/sysdeps/s390/multiarch/strcspn-vx.S
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..c7113c4
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ b/sysdeps/s390/multiarch/strcspn-vx.S
|
|
|
ce426f |
@@ -0,0 +1,281 @@
|
|
|
ce426f |
+/* Vector optimized 32/64 bit S/390 version of strcspn.
|
|
|
ce426f |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
ce426f |
+
|
|
|
ce426f |
+# include "sysdep.h"
|
|
|
ce426f |
+# include "asm-syntax.h"
|
|
|
ce426f |
+
|
|
|
ce426f |
+ .text
|
|
|
ce426f |
+
|
|
|
ce426f |
+/* size_t strcspn (const char *s, const char * reject)
|
|
|
ce426f |
+ The strcspn() function calculates the length of the initial segment
|
|
|
ce426f |
+ of s which consists entirely of characters not in reject.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ This method checks the length of reject string. If it fits entirely
|
|
|
ce426f |
+ in one vector register, a fast algorithm is used, which does not need
|
|
|
ce426f |
+ to check multiple parts of accept-string. Otherwise a slower full
|
|
|
ce426f |
+ check of accept-string is used.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ register overview:
|
|
|
ce426f |
+ r3: pointer to start of reject-string
|
|
|
ce426f |
+ r2: pointer to start of search-string
|
|
|
ce426f |
+ r0: loaded byte count of vlbb search-string
|
|
|
ce426f |
+ r4: found byte index
|
|
|
ce426f |
+ r1: current return len
|
|
|
ce426f |
+ v16: search-string
|
|
|
ce426f |
+ v17: reject-string
|
|
|
ce426f |
+ v18: temp-vreg
|
|
|
ce426f |
+
|
|
|
ce426f |
+ ONLY FOR SLOW:
|
|
|
ce426f |
+ v19: first reject-string
|
|
|
ce426f |
+ v20: zero for preparing acc-vector
|
|
|
ce426f |
+ v21: global mask; 1 indicates a match between
|
|
|
ce426f |
+ search-string-vreg and any reject-character
|
|
|
ce426f |
+ v22: current mask; 1 indicates a match between
|
|
|
ce426f |
+ search-string-vreg and any reject-character in current acc-vreg
|
|
|
ce426f |
+ v24: one for result-checking of former string-part
|
|
|
ce426f |
+ v30, v31: for re-/storing registers r6, r8, r9
|
|
|
ce426f |
+ r5: current len of reject-string
|
|
|
ce426f |
+ r6: zero-index in search-string or 16 if no zero
|
|
|
ce426f |
+ or min(zero-index, loaded byte count)
|
|
|
ce426f |
+ r8: >0, if former reject-string-part contains a zero,
|
|
|
ce426f |
+ otherwise =0;
|
|
|
ce426f |
+ r9: loaded byte count of vlbb reject-string
|
|
|
ce426f |
+*/
|
|
|
ce426f |
+ENTRY(__strcspn_vx)
|
|
|
ce426f |
+ .machine "z13"
|
|
|
ce426f |
+ .machinemode "zarch_nohighgprs"
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /*
|
|
|
ce426f |
+ Check if reject-string fits in one vreg:
|
|
|
ce426f |
+ ----------------------------------------
|
|
|
ce426f |
+ */
|
|
|
ce426f |
+ vlbb %v17,0(%r3),6 /* Load reject. */
|
|
|
ce426f |
+ lghi %r1,0 /* Zero out current len. */
|
|
|
ce426f |
+ lcbb %r0,0(%r3),6
|
|
|
ce426f |
+ jo .Lcheck_onbb /* Special case if reject
|
|
|
ce426f |
+ lays on block-boundary. */
|
|
|
ce426f |
+.Lcheck_notonbb:
|
|
|
ce426f |
+ vistrbs %v17,%v17 /* Fill with zeros after first zero. */
|
|
|
ce426f |
+ je .Lfast /* Zero found -> reject fits in one vreg. */
|
|
|
ce426f |
+ j .Lslow /* No zero -> reject exceeds one vreg. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lcheck_onbb:
|
|
|
ce426f |
+ /* Reject lays on block-boundary. */
|
|
|
ce426f |
+ vfenezb %v18,%v17,%v17 /* Search zero in loaded reject bytes. */
|
|
|
ce426f |
+ vlgvb %r4,%v18,7 /* Get index of zero or 16 if not found. */
|
|
|
ce426f |
+ clrjl %r4,%r0,.Lcheck_notonbb /* Zero index < loaded bytes count ->
|
|
|
ce426f |
+ Reject fits in one vreg;
|
|
|
ce426f |
+ Fill with zeros and proceed
|
|
|
ce426f |
+ with FAST. */
|
|
|
ce426f |
+ vl %v17,0(%r3) /* Load reject, which exceeds loaded bytes. */
|
|
|
ce426f |
+ j .Lcheck_notonbb /* Check if reject fits in one vreg. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /*
|
|
|
ce426f |
+ Search s for reject in one vreg
|
|
|
ce426f |
+ -------------------------------
|
|
|
ce426f |
+ */
|
|
|
ce426f |
+.Lfast:
|
|
|
ce426f |
+ /* Complete reject-string in v17 and remaining bytes are zero. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vlbb %v16,0(%r2),6 /* Load s until next 4k-byte boundary. */
|
|
|
ce426f |
+ lcbb %r0,0(%r2),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vfaezbs %v18,%v16,%v17,0 /* Find first element in v16
|
|
|
ce426f |
+ unequal to any in v17
|
|
|
ce426f |
+ or first zero element. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vlgvb %r4,%v18,7 /* Load byte index of found element. */
|
|
|
ce426f |
+ clrjl %r4,%r0,.Lfast_loop_found2 /* If found index is within loaded
|
|
|
ce426f |
+ bytes, return with found element
|
|
|
ce426f |
+ index (=equal count). */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Align s to 16 byte. */
|
|
|
ce426f |
+ risbgn %r4,%r2,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15. */
|
|
|
ce426f |
+ lghi %r1,16 /* current_len = 16. */
|
|
|
ce426f |
+ slr %r1,%r4 /* Compute bytes to 16bytes boundary. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Process s in 16byte aligned loop. */
|
|
|
ce426f |
+.Lfast_loop:
|
|
|
ce426f |
+ vl %v16,0(%r1,%r2) /* Load search-string. */
|
|
|
ce426f |
+ vfaezbs %v18,%v16,%v17,0 /* Find first element in v16 equal to any
|
|
|
ce426f |
+ in v17 or first zero element. */
|
|
|
ce426f |
+ jno .Lfast_loop_found
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vl %v16,16(%r1,%r2)
|
|
|
ce426f |
+ vfaezbs %v18,%v16,%v17,0
|
|
|
ce426f |
+ jno .Lfast_loop_found16
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vl %v16,32(%r1,%r2)
|
|
|
ce426f |
+ vfaezbs %v18,%v16,%v17,0
|
|
|
ce426f |
+ jno .Lfast_loop_found32
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vl %v16,48(%r1,%r2)
|
|
|
ce426f |
+ vfaezbs %v18,%v16,%v17,0
|
|
|
ce426f |
+ jno .Lfast_loop_found48
|
|
|
ce426f |
+
|
|
|
ce426f |
+ aghi %r1,64
|
|
|
ce426f |
+ j .Lfast_loop /* Loop if no element was unequal to reject
|
|
|
ce426f |
+ and not zero. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Found equal or zero element. */
|
|
|
ce426f |
+.Lfast_loop_found48:
|
|
|
ce426f |
+ aghi %r1,16
|
|
|
ce426f |
+.Lfast_loop_found32:
|
|
|
ce426f |
+ aghi %r1,16
|
|
|
ce426f |
+.Lfast_loop_found16:
|
|
|
ce426f |
+ aghi %r1,16
|
|
|
ce426f |
+.Lfast_loop_found:
|
|
|
ce426f |
+ vlgvb %r4,%v18,7 /* Load byte index of found element or zero. */
|
|
|
ce426f |
+.Lfast_loop_found2:
|
|
|
ce426f |
+ algrk %r2,%r1,%r4 /* Add found index to current len. */
|
|
|
ce426f |
+ br %r14
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /*
|
|
|
ce426f |
+ Search s for reject in multiple vregs
|
|
|
ce426f |
+ -------------------------------------
|
|
|
ce426f |
+ */
|
|
|
ce426f |
+.Lslow:
|
|
|
ce426f |
+ /* Save registers. */
|
|
|
ce426f |
+ vlvgg %v30,%r6,0
|
|
|
ce426f |
+ vlvgp %v31,%r8,%r9
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Reject in v17 without zero. */
|
|
|
ce426f |
+ vlr %v19,%v17 /* Save first acc-part for a fast reload. */
|
|
|
ce426f |
+ vzero %v20 /* Zero for preparing acc-vector. */
|
|
|
ce426f |
+ vone %v24 /* One for checking result of former
|
|
|
ce426f |
+ string-part. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Align s to 16 byte. */
|
|
|
ce426f |
+ risbg %r4,%r2,60,128+63,0 /* Test if s is aligned and
|
|
|
ce426f |
+ %r4 = bits 60-63 'and' 15. */
|
|
|
ce426f |
+ je .Lslow_loop_str /* If s is aligned, loop aligned. */
|
|
|
ce426f |
+ lghi %r0,15
|
|
|
ce426f |
+ slr %r0,%r4 /* Compute highest index to load (15-x). */
|
|
|
ce426f |
+ vll %v16,%r0,0(%r2) /* Load up to 16 byte boundary (vll needs
|
|
|
ce426f |
+ highest index, remaining bytes are 0). */
|
|
|
ce426f |
+ ahi %r0,1 /* Work with loaded byte count. */
|
|
|
ce426f |
+ vzero %v21 /* Zero out global mask. */
|
|
|
ce426f |
+ lghi %r5,0 /* Set current len of reject-string to zero. */
|
|
|
ce426f |
+ vfenezb %v18,%v16,%v16 /* Find zero in current string-part. */
|
|
|
ce426f |
+ lghi %r8,0 /* There is no zero in first reject-part. */
|
|
|
ce426f |
+ vlgvb %r6,%v18,7 /* Load byte index of zero or 16 if no zero. */
|
|
|
ce426f |
+ clije %r6,0,.Lslow_end /* If first element is zero -> return 0. */
|
|
|
ce426f |
+ clr %r0,%r6 /* cc==1 if loaded byte count < zero-index. */
|
|
|
ce426f |
+ locrl %r6,%r0 /* Load on cc==1; zero-index = lbc. */
|
|
|
ce426f |
+ j .Lslow_loop_acc
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Process s in 16byte aligned loop. */
|
|
|
ce426f |
+.Lslow_next_str:
|
|
|
ce426f |
+ /* Check results of former processed str-part. */
|
|
|
ce426f |
+ vfeeb %v18,%v21,%v24 /* Find first equal match in global mask
|
|
|
ce426f |
+ (ones in element). */
|
|
|
ce426f |
+ vlgvb %r4,%v18,7 /* Get index of first one (=equal) or 16. */
|
|
|
ce426f |
+ /* Equal-index < min(zero-index, loaded byte count)
|
|
|
ce426f |
+ -> Return pointer to equal element. */
|
|
|
ce426f |
+ clrjl %r4,%r6,.Lslow_index_found
|
|
|
ce426f |
+ /* Zero-index < loaded byte count
|
|
|
ce426f |
+ -> Former str-part was last str-part
|
|
|
ce426f |
+ -> Return null */
|
|
|
ce426f |
+ clrjl %r6,%r0,.Lslow_end_not_found
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* All elements are zero (=no match) -> Proceed with next str-part. */
|
|
|
ce426f |
+ vlr %v17,%v19 /* Load first part of reject (no zero). */
|
|
|
ce426f |
+ algfr %r1,%r0 /* Add loaded byte count to current len. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_loop_str:
|
|
|
ce426f |
+ vl %v16,0(%r1,%r2) /* Load search-string. */
|
|
|
ce426f |
+ lghi %r0,16 /* Loaded byte count is 16. */
|
|
|
ce426f |
+ vzero %v21 /* Zero out global mask. */
|
|
|
ce426f |
+ lghi %r5,0 /* Set current len of reject to zero. */
|
|
|
ce426f |
+ vfenezb %v18,%v16,%v16 /* Find zero in current string-part. */
|
|
|
ce426f |
+ lghi %r8,0 /* There is no zero in first reject-part. */
|
|
|
ce426f |
+ vlgvb %r6,%v18,7 /* Load byte index of zero or 16 if no zero. */
|
|
|
ce426f |
+ clije %r6,0,.Lslow_end /* If first element is zero (end of string)
|
|
|
ce426f |
+ -> Return current length. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_loop_acc:
|
|
|
ce426f |
+ vfaeb %v22,%v16,%v17,4 /* Create matching-mask (1 in mask ->
|
|
|
ce426f |
+ Character matches any rejected character in
|
|
|
ce426f |
+ this reject-string-part) IN=0, RT=1. */
|
|
|
ce426f |
+ vlgvb %r4,%v22,0 /* Get result of first element. */
|
|
|
ce426f |
+ /* First element is equal to any rejected characters?
|
|
|
ce426f |
+ (all other parts of reject cannot lead to a match before this one)
|
|
|
ce426f |
+ -> Return current len, which is pointing to this element. */
|
|
|
ce426f |
+ clijh %r4,0,.Lslow_end
|
|
|
ce426f |
+ vo %v21,%v21,%v22 /* Global-mask = global-|matching-mask. */
|
|
|
ce426f |
+ /* Proceed with next acc until end of acc is reached. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_next_acc:
|
|
|
ce426f |
+ clijh %r8,0,.Lslow_next_str /* There was a zero in last reject-part
|
|
|
ce426f |
+ -> Add found index to current len
|
|
|
ce426f |
+ and end. */
|
|
|
ce426f |
+ vlbb %v17,16(%r5,%r3),6 /* Load next reject part. */
|
|
|
ce426f |
+ aghi %r5,16 /* Increment current len of reject-string. */
|
|
|
ce426f |
+ lcbb %r9,0(%r5,%r3),6 /* Get loaded byte count of reject-string. */
|
|
|
ce426f |
+ jo .Lslow_next_acc_onbb /* Jump away if reject-string is
|
|
|
ce426f |
+ on block-boundary. */
|
|
|
ce426f |
+.Lslow_next_acc_notonbb:
|
|
|
ce426f |
+ vistrbs %v17,%v17 /* Fill with zeros after first zero. */
|
|
|
ce426f |
+ jo .Lslow_loop_acc /* No zero found -> no preparation needed. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_next_acc_prepare_zero:
|
|
|
ce426f |
+ /* Zero in reject-part: fill zeros with first-reject-character. */
|
|
|
ce426f |
+ vlgvb %r8,%v17,0 /* Load first element of reject-part. */
|
|
|
ce426f |
+ clije %r8,0,.Lslow_next_str /* Process next str-part if first
|
|
|
ce426f |
+ character in this part of reject
|
|
|
ce426f |
+ is a zero. */
|
|
|
ce426f |
+ /* r8>0 -> zero found in this acc-part. */
|
|
|
ce426f |
+ vrepb %v18,%v17,0 /* Replicate first char accross all chars. */
|
|
|
ce426f |
+ vceqb %v22,%v20,%v17 /* Create a mask (v22) of null chars
|
|
|
ce426f |
+ by comparing with 0 (v20). */
|
|
|
ce426f |
+ vsel %v17,%v18,%v17,%v22 /* Replace null chars with first char. */
|
|
|
ce426f |
+ j .Lslow_loop_acc /* Reject-string part is prepared. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_next_acc_onbb:
|
|
|
ce426f |
+ vfenezb %v18,%v17,%v17 /* Find zero in loaded bytes of reject part. */
|
|
|
ce426f |
+ vlgvb %r8,%v18,7 /* Load byte index of zero. */
|
|
|
ce426f |
+ clrjl %r8,%r9,.Lslow_next_acc_notonbb /* Found a zero in loaded bytes
|
|
|
ce426f |
+ -> Prepare vreg. */
|
|
|
ce426f |
+ vl %v17,0(%r5,%r3) /* Load over boundary ... */
|
|
|
ce426f |
+ lghi %r8,0 /* r8=0 -> no zero in this part of acc,
|
|
|
ce426f |
+ check for zero is in jump-target. */
|
|
|
ce426f |
+ j .Lslow_next_acc_notonbb /* ... and search for zero in
|
|
|
ce426f |
+ fully loaded vreg again. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_end_not_found:
|
|
|
ce426f |
+ algfr %r1,%r6 /* Add zero-index to current len. */
|
|
|
ce426f |
+ j .Lslow_end
|
|
|
ce426f |
+.Lslow_index_found:
|
|
|
ce426f |
+ algfr %r1,%r4 /* Add found index of char to current len. */
|
|
|
ce426f |
+.Lslow_end:
|
|
|
ce426f |
+ lgr %r2,%r1
|
|
|
ce426f |
+ /* Restore registers. */
|
|
|
ce426f |
+ vlgvg %r6,%v30,0
|
|
|
ce426f |
+ vlgvg %r8,%v31,0
|
|
|
ce426f |
+ vlgvg %r9,%v31,1
|
|
|
ce426f |
+ br %r14
|
|
|
ce426f |
+END(__strcspn_vx)
|
|
|
ce426f |
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
|
|
|
ce426f |
diff --git a/sysdeps/s390/multiarch/strcspn.c b/sysdeps/s390/multiarch/strcspn.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..32b46c4
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ b/sysdeps/s390/multiarch/strcspn.c
|
|
|
ce426f |
@@ -0,0 +1,27 @@
|
|
|
ce426f |
+/* Multiple versions of strcspn.
|
|
|
ce426f |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
ce426f |
+# include <string.h>
|
|
|
ce426f |
+# include <ifunc-resolve.h>
|
|
|
ce426f |
+
|
|
|
ce426f |
+s390_vx_libc_ifunc2 (__strcspn, strcspn)
|
|
|
ce426f |
+
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+# include <string/strcspn.c>
|
|
|
ce426f |
+#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc) */
|
|
|
ce426f |
diff --git a/sysdeps/s390/multiarch/wcscspn-c.c b/sysdeps/s390/multiarch/wcscspn-c.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..95e76ae
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ b/sysdeps/s390/multiarch/wcscspn-c.c
|
|
|
ce426f |
@@ -0,0 +1,26 @@
|
|
|
ce426f |
+/* Default wcscscpn implementation for S/390.
|
|
|
ce426f |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
ce426f |
+# define WCSCSPN __wcscspn_c
|
|
|
ce426f |
+
|
|
|
ce426f |
+# include <wchar.h>
|
|
|
ce426f |
+extern __typeof (wcscspn) __wcscspn_c;
|
|
|
ce426f |
+
|
|
|
ce426f |
+# include <wcsmbs/wcscspn.c>
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
diff --git a/sysdeps/s390/multiarch/wcscspn-vx.S b/sysdeps/s390/multiarch/wcscspn-vx.S
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..aa581ce
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ b/sysdeps/s390/multiarch/wcscspn-vx.S
|
|
|
ce426f |
@@ -0,0 +1,293 @@
|
|
|
ce426f |
+/* Vector optimized 32/64 bit S/390 version of wcscspn.
|
|
|
ce426f |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
ce426f |
+
|
|
|
ce426f |
+# include "sysdep.h"
|
|
|
ce426f |
+# include "asm-syntax.h"
|
|
|
ce426f |
+
|
|
|
ce426f |
+ .text
|
|
|
ce426f |
+
|
|
|
ce426f |
+/* size_t wcscspn (const wchar_t *s, const wchar_t * reject)
|
|
|
ce426f |
+ The wcscspn() function calculates the length of the initial segment
|
|
|
ce426f |
+ of s which consists entirely of characters not in reject.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ This method checks the length of reject string. If it fits entirely
|
|
|
ce426f |
+ in one vector register, a fast algorithm is used, which does not need
|
|
|
ce426f |
+ to check multiple parts of accept-string. Otherwise a slower full
|
|
|
ce426f |
+ check of accept-string is used.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ register overview:
|
|
|
ce426f |
+ r3: pointer to start of reject-string
|
|
|
ce426f |
+ r2: pointer to start of search-string
|
|
|
ce426f |
+ r0: loaded byte count of vlbb search-string
|
|
|
ce426f |
+ r4: found byte index
|
|
|
ce426f |
+ r1: current return len
|
|
|
ce426f |
+ v16: search-string
|
|
|
ce426f |
+ v17: reject-string
|
|
|
ce426f |
+ v18: temp-vreg
|
|
|
ce426f |
+
|
|
|
ce426f |
+ ONLY FOR SLOW:
|
|
|
ce426f |
+ v19: first reject-string
|
|
|
ce426f |
+ v20: zero for preparing acc-vector
|
|
|
ce426f |
+ v21: global mask; 1 indicates a match between
|
|
|
ce426f |
+ search-string-vreg and any reject-character
|
|
|
ce426f |
+ v22: current mask; 1 indicates a match between
|
|
|
ce426f |
+ search-string-vreg and any reject-character in current acc-vreg
|
|
|
ce426f |
+ v30, v31: for re-/storing registers r6, r8, r9
|
|
|
ce426f |
+ r5: current len of reject-string
|
|
|
ce426f |
+ r6: zero-index in search-string or 16 if no zero
|
|
|
ce426f |
+ or min(zero-index, loaded byte count)
|
|
|
ce426f |
+ r8: >0, if former reject-string-part contains a zero,
|
|
|
ce426f |
+ otherwise =0;
|
|
|
ce426f |
+ r9: loaded byte count of vlbb reject-string
|
|
|
ce426f |
+*/
|
|
|
ce426f |
+ENTRY(__wcscspn_vx)
|
|
|
ce426f |
+ .machine "z13"
|
|
|
ce426f |
+ .machinemode "zarch_nohighgprs"
|
|
|
ce426f |
+
|
|
|
ce426f |
+ tmll %r2,3 /* Test if s is 4-byte aligned? */
|
|
|
ce426f |
+ jne .Lfallback /* And use common-code variant if not. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /*
|
|
|
ce426f |
+ Check if reject-string fits in one vreg:
|
|
|
ce426f |
+ ----------------------------------------
|
|
|
ce426f |
+ */
|
|
|
ce426f |
+ vlbb %v17,0(%r3),0 /* Load reject. */
|
|
|
ce426f |
+ lcbb %r0,0(%r3),0
|
|
|
ce426f |
+ jo .Lcheck_onbb /* Special case if reject
|
|
|
ce426f |
+ lays on block-boundary. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lcheck_notonbb:
|
|
|
ce426f |
+ lghi %r1,0 /* Zero out current len. */
|
|
|
ce426f |
+ vistrfs %v17,%v17 /* Fill with zeros after first zero. */
|
|
|
ce426f |
+ je .Lfast /* Zero found -> reject fits in one vreg. */
|
|
|
ce426f |
+ j .Lslow /* No zero -> reject exceeds one vreg. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lcheck_onbb:
|
|
|
ce426f |
+ /* Reject lays on block-boundary. */
|
|
|
ce426f |
+ nill %r0,65532 /* Recognize only fully loaded characters. */
|
|
|
ce426f |
+ je .Lcheck_onbb2 /* Reload vr, if we loaded no full wchar_t. */
|
|
|
ce426f |
+ vfenezf %v18,%v17,%v17 /* Search zero in loaded reject bytes. */
|
|
|
ce426f |
+ vlgvb %r4,%v18,7 /* Get index of zero or 16 if not found. */
|
|
|
ce426f |
+ clrjl %r4,%r0,.Lcheck_notonbb /* Zero index < loaded bytes count ->
|
|
|
ce426f |
+ Reject fits in one vreg;
|
|
|
ce426f |
+ Fill with zeros and proceed
|
|
|
ce426f |
+ with FAST. */
|
|
|
ce426f |
+.Lcheck_onbb2:
|
|
|
ce426f |
+ vl %v17,0(%r3) /* Load reject, which exceeds loaded bytes. */
|
|
|
ce426f |
+ j .Lcheck_notonbb /* Check if reject fits in one vreg. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /*
|
|
|
ce426f |
+ Search s for reject in one vreg
|
|
|
ce426f |
+ -------------------------------
|
|
|
ce426f |
+ */
|
|
|
ce426f |
+.Lfast:
|
|
|
ce426f |
+ /* Complete reject-string in v17 and remaining bytes are zero. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vlbb %v16,0(%r2),6 /* Load s until next 4k-byte boundary. */
|
|
|
ce426f |
+ lcbb %r0,0(%r2),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vfaezfs %v18,%v16,%v17,0 /* Find first element in v16
|
|
|
ce426f |
+ unequal to any in v17
|
|
|
ce426f |
+ or first zero element. */
|
|
|
ce426f |
+ vlgvb %r4,%v18,7 /* Load byte index of found element. */
|
|
|
ce426f |
+ clrjl %r4,%r0,.Lfast_loop_found2 /* If found index is within loaded
|
|
|
ce426f |
+ bytes, return with found element
|
|
|
ce426f |
+ index (=equal count). */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Align s to 16 byte. */
|
|
|
ce426f |
+ risbgn %r4,%r2,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15. */
|
|
|
ce426f |
+ lghi %r1,16 /* current_len = 16. */
|
|
|
ce426f |
+ slr %r1,%r4 /* Compute bytes to 16bytes boundary. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Process s in 16byte aligned loop. */
|
|
|
ce426f |
+.Lfast_loop:
|
|
|
ce426f |
+ vl %v16,0(%r1,%r2) /* Load search-string. */
|
|
|
ce426f |
+ vfaezfs %v18,%v16,%v17,0 /* Find first element in v16 equal to any
|
|
|
ce426f |
+ in v17 or first zero element. */
|
|
|
ce426f |
+ jno .Lfast_loop_found
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vl %v16,16(%r1,%r2)
|
|
|
ce426f |
+ vfaezfs %v18,%v16,%v17,0
|
|
|
ce426f |
+ jno .Lfast_loop_found16
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vl %v16,32(%r1,%r2)
|
|
|
ce426f |
+ vfaezfs %v18,%v16,%v17,0
|
|
|
ce426f |
+ jno .Lfast_loop_found32
|
|
|
ce426f |
+
|
|
|
ce426f |
+ vl %v16,48(%r1,%r2)
|
|
|
ce426f |
+ vfaezfs %v18,%v16,%v17,0
|
|
|
ce426f |
+ jno .Lfast_loop_found48
|
|
|
ce426f |
+
|
|
|
ce426f |
+ aghi %r1,64
|
|
|
ce426f |
+ j .Lfast_loop /* Loop if no element was unequal to reject
|
|
|
ce426f |
+ and not zero. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Found equal or zero element. */
|
|
|
ce426f |
+.Lfast_loop_found48:
|
|
|
ce426f |
+ aghi %r1,16
|
|
|
ce426f |
+.Lfast_loop_found32:
|
|
|
ce426f |
+ aghi %r1,16
|
|
|
ce426f |
+.Lfast_loop_found16:
|
|
|
ce426f |
+ aghi %r1,16
|
|
|
ce426f |
+.Lfast_loop_found:
|
|
|
ce426f |
+ vlgvb %r4,%v18,7 /* Load byte index of found element or zero. */
|
|
|
ce426f |
+.Lfast_loop_found2:
|
|
|
ce426f |
+ algrk %r2,%r1,%r4 /* Add found index to current len. */
|
|
|
ce426f |
+ srlg %r2,%r2,2 /* Convert byte-count to character-count. */
|
|
|
ce426f |
+ br %r14
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /*
|
|
|
ce426f |
+ Search s for reject in multiple vregs
|
|
|
ce426f |
+ -------------------------------------
|
|
|
ce426f |
+ */
|
|
|
ce426f |
+.Lslow:
|
|
|
ce426f |
+ /* Save registers. */
|
|
|
ce426f |
+ vlvgg %v30,%r6,0
|
|
|
ce426f |
+ vlvgp %v31,%r8,%r9
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Reject in v17 without zero. */
|
|
|
ce426f |
+ vlr %v19,%v17 /* Save first acc-part for a fast reload. */
|
|
|
ce426f |
+ vzero %v20 /* Zero for preparing acc-vector. */
|
|
|
ce426f |
+ vone %v24 /* One for checking result of former
|
|
|
ce426f |
+ string-part. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Align s to 16 byte. */
|
|
|
ce426f |
+ risbg %r4,%r2,60,128+63,0 /* Test if s is aligned and
|
|
|
ce426f |
+ %r4 = bits 60-63 'and' 15. */
|
|
|
ce426f |
+ je .Lslow_loop_str /* If s is aligned, loop aligned. */
|
|
|
ce426f |
+ lghi %r0,15
|
|
|
ce426f |
+ slr %r0,%r4 /* Compute highest index to load (15-x). */
|
|
|
ce426f |
+ vll %v16,%r0,0(%r2) /* Load up to 16byte boundary (vll needs
|
|
|
ce426f |
+ highest index, remaining bytes are 0). */
|
|
|
ce426f |
+ ahi %r0,1 /* Work with loaded byte count. */
|
|
|
ce426f |
+ vzero %v21 /* Zero out global mask. */
|
|
|
ce426f |
+ lghi %r5,0 /* Set current len of reject-string to zero. */
|
|
|
ce426f |
+ vfenezf %v18,%v16,%v16 /* Find zero in current string-part. */
|
|
|
ce426f |
+ lghi %r8,0 /* There is no zero in first reject-part. */
|
|
|
ce426f |
+ vlgvb %r6,%v18,7 /* Load byte index of zero or 16 if no zero. */
|
|
|
ce426f |
+ clije %r6,0,.Lslow_end /* If first element is zero -> return 0. */
|
|
|
ce426f |
+ clr %r0,%r6 /* cc==1 if loaded byte count < zero-index. */
|
|
|
ce426f |
+ locrl %r6,%r0 /* Load on cc==1; zero-index = lbc. */
|
|
|
ce426f |
+ j .Lslow_loop_acc
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* Process s in 16byte aligned loop. */
|
|
|
ce426f |
+.Lslow_next_str:
|
|
|
ce426f |
+ /* Check results of former processed str-part. */
|
|
|
ce426f |
+ vfeef %v18,%v21,%v24 /* Find first equal match in global mask
|
|
|
ce426f |
+ (ones in element). */
|
|
|
ce426f |
+ vlgvb %r4,%v18,7 /* Get index of first one (=equal) or 16. */
|
|
|
ce426f |
+ /* Equal-index < min(zero-index, loaded byte count)
|
|
|
ce426f |
+ -> Return pointer to equal element. */
|
|
|
ce426f |
+ clrjl %r4,%r6,.Lslow_index_found
|
|
|
ce426f |
+ /* Zero-index < loaded byte count
|
|
|
ce426f |
+ -> Former str-part was last str-part
|
|
|
ce426f |
+ -> Return null */
|
|
|
ce426f |
+ clrjl %r6,%r0,.Lslow_end_not_found
|
|
|
ce426f |
+
|
|
|
ce426f |
+ /* All elements are zero (=no match) -> proceed with next str-part. */
|
|
|
ce426f |
+ vlr %v17,%v19 /* Load first part of reject (no zero). */
|
|
|
ce426f |
+ algfr %r1,%r0 /* Add loaded byte count to current len. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_loop_str:
|
|
|
ce426f |
+ vl %v16,0(%r1,%r2) /* Load search-string. */
|
|
|
ce426f |
+ lghi %r0,16 /* Loaded byte count is 16. */
|
|
|
ce426f |
+ vzero %v21 /* Zero out global mask. */
|
|
|
ce426f |
+ lghi %r5,0 /* Set current len of reject to zero. */
|
|
|
ce426f |
+ vfenezf %v18,%v16,%v16 /* Find zero in current string-part. */
|
|
|
ce426f |
+ lghi %r8,0 /* There is no zero in first reject-part. */
|
|
|
ce426f |
+ vlgvb %r6,%v18,7 /* Load byte index of zero or 16 if no zero. */
|
|
|
ce426f |
+ clije %r6,0,.Lslow_end /* If first element is zero (end of string)
|
|
|
ce426f |
+ -> Return current length. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_loop_acc:
|
|
|
ce426f |
+ vfaef %v22,%v16,%v17,4 /* Create matching-mask (1 in mask ->
|
|
|
ce426f |
+ Character matches any rejected character in
|
|
|
ce426f |
+ this reject-string-part) IN=0, RT=1. */
|
|
|
ce426f |
+ vlgvf %r4,%v22,0 /* Get result of first element. */
|
|
|
ce426f |
+ /* First element is equal to any rejected characters?
|
|
|
ce426f |
+ (All other parts of reject cannot lead to a match before this one)
|
|
|
ce426f |
+ -> Return current len, which is pointing to this element. */
|
|
|
ce426f |
+ clijh %r4,0,.Lslow_end
|
|
|
ce426f |
+ vo %v21,%v21,%v22 /* Global-mask = global-|matching-mask. */
|
|
|
ce426f |
+ /* Proceed with next acc until end of acc is reached. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_next_acc:
|
|
|
ce426f |
+ clijh %r8,0,.Lslow_next_str /* There was a zero in last reject-part
|
|
|
ce426f |
+ -> Add found index to current len
|
|
|
ce426f |
+ and end. */
|
|
|
ce426f |
+ vlbb %v17,16(%r5,%r3),6 /* Load next reject part. */
|
|
|
ce426f |
+ aghi %r5,16 /* Increment current len of reject-string. */
|
|
|
ce426f |
+ lcbb %r9,0(%r5,%r3),6 /* Get loaded byte count of reject-string. */
|
|
|
ce426f |
+ jo .Lslow_next_acc_onbb /* Jump away if reject-string is
|
|
|
ce426f |
+ on block-boundary. */
|
|
|
ce426f |
+.Lslow_next_acc_notonbb:
|
|
|
ce426f |
+ vistrfs %v17,%v17 /* Fill with zeros after first zero. */
|
|
|
ce426f |
+ jo .Lslow_loop_acc /* No zero found -> no preparation needed. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_next_acc_prepare_zero:
|
|
|
ce426f |
+ /* Zero in reject-part: fill zeros with first-reject-character. */
|
|
|
ce426f |
+ vlgvf %r8,%v17,0 /* Load first element of reject-part. */
|
|
|
ce426f |
+ clije %r8,0,.Lslow_next_str /* Process next str-part if first
|
|
|
ce426f |
+ character in this part of reject
|
|
|
ce426f |
+ is a zero. */
|
|
|
ce426f |
+ /* r8>0 -> zero found in this acc-part. */
|
|
|
ce426f |
+ vrepf %v18,%v17,0 /* Replicate first char accross all chars. */
|
|
|
ce426f |
+ vceqf %v22,%v20,%v17 /* Create a mask (v22) of null chars
|
|
|
ce426f |
+ by comparing with 0 (v20). */
|
|
|
ce426f |
+ vsel %v17,%v18,%v17,%v22 /* Replace null chars with first char. */
|
|
|
ce426f |
+ j .Lslow_loop_acc /* Reject-string part is prepared. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_next_acc_onbb:
|
|
|
ce426f |
+ nill %r9,65532 /* Recognize only fully loaded characters. */
|
|
|
ce426f |
+ je .Lslow_next_acc_onbb2 /* Reload vr, if no full wchar_t
|
|
|
ce426f |
+ loaded. */
|
|
|
ce426f |
+ vfenezf %v18,%v17,%v17 /* Find zero in loaded bytes of reject part. */
|
|
|
ce426f |
+ vlgvb %r8,%v18,7 /* Load byte index of zero. */
|
|
|
ce426f |
+ clrjl %r8,%r9,.Lslow_next_acc_notonbb /* Found a zero in loaded bytes
|
|
|
ce426f |
+ -> Prepare vreg. */
|
|
|
ce426f |
+.Lslow_next_acc_onbb2:
|
|
|
ce426f |
+ vl %v17,0(%r5,%r3) /* Load over boundary ... */
|
|
|
ce426f |
+ lghi %r8,0 /* r8=0 -> no zero in this part of acc,
|
|
|
ce426f |
+ check for zero is in jump-target. */
|
|
|
ce426f |
+ j .Lslow_next_acc_notonbb /* ... and search for zero in
|
|
|
ce426f |
+ fully loaded vreg again. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+.Lslow_end_not_found:
|
|
|
ce426f |
+ algfr %r1,%r6 /* Add zero-index to current len. */
|
|
|
ce426f |
+ j .Lslow_end
|
|
|
ce426f |
+.Lslow_index_found:
|
|
|
ce426f |
+ algfr %r1,%r4 /* Add found index of char to current len. */
|
|
|
ce426f |
+.Lslow_end:
|
|
|
ce426f |
+ srlg %r2,%r1,2 /* Convert byte-count to character-count. */
|
|
|
ce426f |
+ /* Restore registers. */
|
|
|
ce426f |
+ vlgvg %r6,%v30,0
|
|
|
ce426f |
+ vlgvg %r8,%v31,0
|
|
|
ce426f |
+ vlgvg %r9,%v31,1
|
|
|
ce426f |
+ br %r14
|
|
|
ce426f |
+.Lfallback:
|
|
|
ce426f |
+ jg __wcscspn_c
|
|
|
ce426f |
+END(__wcscspn_vx)
|
|
|
ce426f |
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
|
|
|
ce426f |
diff --git a/sysdeps/s390/multiarch/wcscspn.c b/sysdeps/s390/multiarch/wcscspn.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..3cb4516
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ b/sysdeps/s390/multiarch/wcscspn.c
|
|
|
ce426f |
@@ -0,0 +1,27 @@
|
|
|
ce426f |
+/* Multiple versions of wcscspn.
|
|
|
ce426f |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
ce426f |
+# include <wchar.h>
|
|
|
ce426f |
+# include <ifunc-resolve.h>
|
|
|
ce426f |
+
|
|
|
ce426f |
+s390_vx_libc_ifunc2 (__wcscspn, wcscspn)
|
|
|
ce426f |
+
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+# include <wcsmbs/wcscspn.c>
|
|
|
ce426f |
+#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc) */
|
|
|
ce426f |
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
|
|
|
ce426f |
index 7ecff8b..9730b00 100644
|
|
|
ce426f |
--- a/wcsmbs/Makefile
|
|
|
ce426f |
+++ b/wcsmbs/Makefile
|
|
|
ce426f |
@@ -42,7 +42,8 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
|
|
|
ce426f |
mbrtoc16 c16rtomb
|
|
|
ce426f |
|
|
|
ce426f |
strop-tests := wcscmp wcsncmp wmemcmp wcslen wcschr wcsrchr wcscpy wcsnlen \
|
|
|
ce426f |
- wcpcpy wcsncpy wcpncpy wcscat wcsncat wcschrnul wcsspn wcspbrk
|
|
|
ce426f |
+ wcpcpy wcsncpy wcpncpy wcscat wcsncat wcschrnul wcsspn wcspbrk \
|
|
|
ce426f |
+ wcscspn
|
|
|
ce426f |
tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
|
|
|
ce426f |
tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
|
|
|
ce426f |
tst-c16c32-1 wcsatcliff $(addprefix test-,$(strop-tests))
|
|
|
ce426f |
diff --git a/wcsmbs/test-wcscspn-ifunc.c b/wcsmbs/test-wcscspn-ifunc.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..e5dcdaf
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ b/wcsmbs/test-wcscspn-ifunc.c
|
|
|
ce426f |
@@ -0,0 +1,20 @@
|
|
|
ce426f |
+/* Test and measure IFUNC implementations of wcscspn function.
|
|
|
ce426f |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#define TEST_IFUNC 1
|
|
|
ce426f |
+#include "test-wcscspn.c"
|
|
|
ce426f |
diff --git a/wcsmbs/test-wcscspn.c b/wcsmbs/test-wcscspn.c
|
|
|
ce426f |
new file mode 100644
|
|
|
ce426f |
index 0000000..d09cd3d
|
|
|
ce426f |
--- /dev/null
|
|
|
ce426f |
+++ b/wcsmbs/test-wcscspn.c
|
|
|
ce426f |
@@ -0,0 +1,20 @@
|
|
|
ce426f |
+/* Test wcscspn functions.
|
|
|
ce426f |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
ce426f |
+ This file is part of the GNU C Library.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
ce426f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
ce426f |
+ License as published by the Free Software Foundation; either
|
|
|
ce426f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
ce426f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ce426f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
ce426f |
+ Lesser General Public License for more details.
|
|
|
ce426f |
+
|
|
|
ce426f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
ce426f |
+ License along with the GNU C Library; if not, see
|
|
|
ce426f |
+ <http://www.gnu.org/licenses/>. */
|
|
|
ce426f |
+
|
|
|
ce426f |
+#define WIDE 1
|
|
|
ce426f |
+#include "../string/test-strcspn.c"
|
|
|
ce426f |
diff --git a/wcsmbs/wcscspn.c b/wcsmbs/wcscspn.c
|
|
|
ce426f |
index 5d38d07..9e84226 100644
|
|
|
ce426f |
--- a/wcsmbs/wcscspn.c
|
|
|
ce426f |
+++ b/wcsmbs/wcscspn.c
|
|
|
ce426f |
@@ -18,6 +18,9 @@
|
|
|
ce426f |
|
|
|
ce426f |
#include <wchar.h>
|
|
|
ce426f |
|
|
|
ce426f |
+#ifdef WCSCSPN
|
|
|
ce426f |
+# define wcscspn WCSCSPN
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
|
|
|
ce426f |
/* Return the length of the maximum initial segment
|
|
|
ce426f |
of WCS which contains only wide-characters not in REJECT. */
|
|
|
ce426f |
--
|
|
|
ce426f |
2.3.0
|
|
|
ce426f |
|