|
|
147e83 |
From 43b14a5489db870aeeda0766bde25e29747f6864 Mon Sep 17 00:00:00 2001
|
|
|
147e83 |
From: Stefan Liebler <stli@linux.vnet.ibm.com>
|
|
|
147e83 |
Date: Thu, 8 Oct 2015 11:13:14 +0200
|
|
|
147e83 |
Subject: [PATCH 16/30] S390: Optimize strcat and wcscat.
|
|
|
147e83 |
|
|
|
147e83 |
upstream-commit-id: d626a24f235dbd4c446b241211a9a264a1eedb9e
|
|
|
147e83 |
https://www.sourceware.org/ml/libc-alpha/2015-07/msg00155.html
|
|
|
147e83 |
|
|
|
147e83 |
This patch provides optimized versions of strcat and wcscat with the z13
|
|
|
147e83 |
vector instructions.
|
|
|
147e83 |
|
|
|
147e83 |
ChangeLog:
|
|
|
147e83 |
|
|
|
147e83 |
* sysdeps/s390/multiarch/strcat-c.c: New File.
|
|
|
147e83 |
* sysdeps/s390/multiarch/strcat-vx.S: Likewise.
|
|
|
147e83 |
* sysdeps/s390/multiarch/strcat.c: Likewise.
|
|
|
147e83 |
* sysdeps/s390/multiarch/wcscat-c.c: Likewise.
|
|
|
147e83 |
* sysdeps/s390/multiarch/wcscat-vx.S: Likewise.
|
|
|
147e83 |
* sysdeps/s390/multiarch/wcscat.c: Likewise.
|
|
|
147e83 |
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcat and
|
|
|
147e83 |
wcscat functions.
|
|
|
147e83 |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
147e83 |
(__libc_ifunc_impl_list): Add ifunc test for strcat, wcscat.
|
|
|
147e83 |
* string/strcat.c (STRCAT): Define and use macro.
|
|
|
147e83 |
* wcsmbs/wcscat.c: Use WCSCAT if defined.
|
|
|
147e83 |
* string/test-strcat.c: Add wcscat support.
|
|
|
147e83 |
* wcsmbs/test-wcscat.c: New File.
|
|
|
147e83 |
* wcsmbs/Makefile (strop-tests): Add wcscat.
|
|
|
147e83 |
* benchtests/bench-strcat.c: Add wcscat support.
|
|
|
147e83 |
* benchtests/bench-wcscat.c: New File.
|
|
|
147e83 |
* benchtests/Makefile (wcsmbs-bench): Add wcscat.
|
|
|
147e83 |
---
|
|
|
147e83 |
benchtests/Makefile | 2 +-
|
|
|
147e83 |
benchtests/bench-strcat.c | 90 ++++++++++------
|
|
|
147e83 |
benchtests/bench-wcscat.c | 20 ++++
|
|
|
147e83 |
string/strcat.c | 8 +-
|
|
|
147e83 |
string/test-strcat.c | 124 ++++++++++++++--------
|
|
|
147e83 |
sysdeps/s390/multiarch/Makefile | 6 +-
|
|
|
147e83 |
sysdeps/s390/multiarch/ifunc-impl-list.c | 3 +
|
|
|
147e83 |
sysdeps/s390/multiarch/strcat-c.c | 28 +++++
|
|
|
147e83 |
sysdeps/s390/multiarch/strcat-vx.S | 161 ++++++++++++++++++++++++++++
|
|
|
147e83 |
sysdeps/s390/multiarch/strcat.c | 27 +++++
|
|
|
147e83 |
sysdeps/s390/multiarch/wcscat-c.c | 25 +++++
|
|
|
147e83 |
sysdeps/s390/multiarch/wcscat-vx.S | 175 +++++++++++++++++++++++++++++++
|
|
|
147e83 |
sysdeps/s390/multiarch/wcscat.c | 28 +++++
|
|
|
147e83 |
wcsmbs/Makefile | 2 +-
|
|
|
147e83 |
wcsmbs/test-wcscat-ifunc.c | 20 ++++
|
|
|
147e83 |
wcsmbs/test-wcscat.c | 20 ++++
|
|
|
147e83 |
wcsmbs/wcscat.c | 5 +
|
|
|
147e83 |
17 files changed, 660 insertions(+), 84 deletions(-)
|
|
|
147e83 |
create mode 100644 benchtests/bench-wcscat.c
|
|
|
147e83 |
create mode 100644 sysdeps/s390/multiarch/strcat-c.c
|
|
|
147e83 |
create mode 100644 sysdeps/s390/multiarch/strcat-vx.S
|
|
|
147e83 |
create mode 100644 sysdeps/s390/multiarch/strcat.c
|
|
|
147e83 |
create mode 100644 sysdeps/s390/multiarch/wcscat-c.c
|
|
|
147e83 |
create mode 100644 sysdeps/s390/multiarch/wcscat-vx.S
|
|
|
147e83 |
create mode 100644 sysdeps/s390/multiarch/wcscat.c
|
|
|
147e83 |
create mode 100644 wcsmbs/test-wcscat-ifunc.c
|
|
|
147e83 |
create mode 100644 wcsmbs/test-wcscat.c
|
|
|
147e83 |
|
|
|
147e83 |
diff --git a/benchtests/Makefile b/benchtests/Makefile
|
|
|
147e83 |
index dfab95f..91db23c 100644
|
|
|
147e83 |
--- a/benchtests/Makefile
|
|
|
147e83 |
+++ b/benchtests/Makefile
|
|
|
147e83 |
@@ -38,7 +38,7 @@ string-bench := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
|
|
|
147e83 |
strcat strchr strchrnul strcmp strcpy strcspn strlen \
|
|
|
147e83 |
strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
|
|
|
147e83 |
strspn strstr strcpy_chk stpcpy_chk memrchr strsep strtok
|
|
|
147e83 |
-wcsmbs-bench := wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy
|
|
|
147e83 |
+wcsmbs-bench := wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat
|
|
|
147e83 |
string-bench-all := $(string-bench) ${wcsmbs-bench}
|
|
|
147e83 |
|
|
|
147e83 |
stdlib-bench := strtod
|
|
|
147e83 |
diff --git a/benchtests/bench-strcat.c b/benchtests/bench-strcat.c
|
|
|
147e83 |
index 6602009..1abf6d3 100644
|
|
|
147e83 |
--- a/benchtests/bench-strcat.c
|
|
|
147e83 |
+++ b/benchtests/bench-strcat.c
|
|
|
147e83 |
@@ -1,5 +1,5 @@
|
|
|
147e83 |
/* Measure strcat functions.
|
|
|
147e83 |
- Copyright (C) 2013 Free Software Foundation, Inc.
|
|
|
147e83 |
+ Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
|
|
147e83 |
This file is part of the GNU C Library.
|
|
|
147e83 |
|
|
|
147e83 |
The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
@@ -17,19 +17,45 @@
|
|
|
147e83 |
<http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
|
|
|
147e83 |
#define TEST_MAIN
|
|
|
147e83 |
-#define TEST_NAME "strcat"
|
|
|
147e83 |
+#ifndef WIDE
|
|
|
147e83 |
+# define TEST_NAME "strcat"
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+# define TEST_NAME "wcscat"
|
|
|
147e83 |
+#endif /* WIDE */
|
|
|
147e83 |
#include "bench-string.h"
|
|
|
147e83 |
|
|
|
147e83 |
-typedef char *(*proto_t) (char *, const char *);
|
|
|
147e83 |
-char *simple_strcat (char *, const char *);
|
|
|
147e83 |
-
|
|
|
147e83 |
-IMPL (simple_strcat, 0)
|
|
|
147e83 |
-IMPL (strcat, 1)
|
|
|
147e83 |
-
|
|
|
147e83 |
-char *
|
|
|
147e83 |
-simple_strcat (char *dst, const char *src)
|
|
|
147e83 |
+#ifndef WIDE
|
|
|
147e83 |
+# define STRCAT strcat
|
|
|
147e83 |
+# define CHAR char
|
|
|
147e83 |
+# define sfmt "s"
|
|
|
147e83 |
+# define SIMPLE_STRCAT simple_strcat
|
|
|
147e83 |
+# define STRLEN strlen
|
|
|
147e83 |
+# define STRCMP strcmp
|
|
|
147e83 |
+# define BIG_CHAR CHAR_MAX
|
|
|
147e83 |
+# define SMALL_CHAR 127
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+# include <wchar.h>
|
|
|
147e83 |
+# define STRCAT wcscat
|
|
|
147e83 |
+# define CHAR wchar_t
|
|
|
147e83 |
+# define sfmt "ls"
|
|
|
147e83 |
+# define SIMPLE_STRCAT simple_wcscat
|
|
|
147e83 |
+# define STRLEN wcslen
|
|
|
147e83 |
+# define STRCMP wcscmp
|
|
|
147e83 |
+# define BIG_CHAR WCHAR_MAX
|
|
|
147e83 |
+# define SMALL_CHAR 1273
|
|
|
147e83 |
+#endif /* WIDE */
|
|
|
147e83 |
+
|
|
|
147e83 |
+
|
|
|
147e83 |
+typedef CHAR *(*proto_t) (CHAR *, const CHAR *);
|
|
|
147e83 |
+CHAR *SIMPLE_STRCAT (CHAR *, const CHAR *);
|
|
|
147e83 |
+
|
|
|
147e83 |
+IMPL (SIMPLE_STRCAT, 0)
|
|
|
147e83 |
+IMPL (STRCAT, 1)
|
|
|
147e83 |
+
|
|
|
147e83 |
+CHAR *
|
|
|
147e83 |
+SIMPLE_STRCAT (CHAR *dst, const CHAR *src)
|
|
|
147e83 |
{
|
|
|
147e83 |
- char *ret = dst;
|
|
|
147e83 |
+ CHAR *ret = dst;
|
|
|
147e83 |
while (*dst++ != '\0');
|
|
|
147e83 |
--dst;
|
|
|
147e83 |
while ((*dst++ = *src++) != '\0');
|
|
|
147e83 |
@@ -37,9 +63,9 @@ simple_strcat (char *dst, const char *src)
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
static void
|
|
|
147e83 |
-do_one_test (impl_t *impl, char *dst, const char *src)
|
|
|
147e83 |
+do_one_test (impl_t *impl, CHAR *dst, const CHAR *src)
|
|
|
147e83 |
{
|
|
|
147e83 |
- size_t k = strlen (dst), i, iters = INNER_LOOP_ITERS;
|
|
|
147e83 |
+ size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS;
|
|
|
147e83 |
timing_t start, stop, cur;
|
|
|
147e83 |
|
|
|
147e83 |
if (CALL (impl, dst, src) != dst)
|
|
|
147e83 |
@@ -50,9 +76,9 @@ do_one_test (impl_t *impl, char *dst, const char *src)
|
|
|
147e83 |
return;
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
- if (strcmp (dst + k, src) != 0)
|
|
|
147e83 |
+ if (STRCMP (dst + k, src) != 0)
|
|
|
147e83 |
{
|
|
|
147e83 |
- error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
|
|
|
147e83 |
+ error (0, 0, "Wrong result in function %s dst \"%" sfmt "\" src \"%" sfmt "\"",
|
|
|
147e83 |
impl->name, dst, src);
|
|
|
147e83 |
ret = 1;
|
|
|
147e83 |
return;
|
|
|
147e83 |
@@ -75,18 +101,18 @@ static void
|
|
|
147e83 |
do_test (size_t align1, size_t align2, size_t len1, size_t len2, int max_char)
|
|
|
147e83 |
{
|
|
|
147e83 |
size_t i;
|
|
|
147e83 |
- char *s1, *s2;
|
|
|
147e83 |
+ CHAR *s1, *s2;
|
|
|
147e83 |
|
|
|
147e83 |
align1 &= 7;
|
|
|
147e83 |
- if (align1 + len1 >= page_size)
|
|
|
147e83 |
+ if ((align1 + len1) * sizeof (CHAR) >= page_size)
|
|
|
147e83 |
return;
|
|
|
147e83 |
|
|
|
147e83 |
align2 &= 7;
|
|
|
147e83 |
- if (align2 + len1 + len2 >= page_size)
|
|
|
147e83 |
+ if ((align2 + len1 + len2) * sizeof (CHAR) >= page_size)
|
|
|
147e83 |
return;
|
|
|
147e83 |
|
|
|
147e83 |
- s1 = (char *) (buf1 + align1);
|
|
|
147e83 |
- s2 = (char *) (buf2 + align2);
|
|
|
147e83 |
+ s1 = (CHAR *) (buf1) + align1;
|
|
|
147e83 |
+ s2 = (CHAR *) (buf2) + align2;
|
|
|
147e83 |
|
|
|
147e83 |
for (i = 0; i < len1; ++i)
|
|
|
147e83 |
s1[i] = 32 + 23 * i % (max_char - 32);
|
|
|
147e83 |
@@ -120,26 +146,26 @@ test_main (void)
|
|
|
147e83 |
|
|
|
147e83 |
for (i = 0; i < 16; ++i)
|
|
|
147e83 |
{
|
|
|
147e83 |
- do_test (0, 0, i, i, 127);
|
|
|
147e83 |
- do_test (0, 0, i, i, 255);
|
|
|
147e83 |
- do_test (0, i, i, i, 127);
|
|
|
147e83 |
- do_test (i, 0, i, i, 255);
|
|
|
147e83 |
+ do_test (0, 0, i, i, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (0, 0, i, i, BIG_CHAR);
|
|
|
147e83 |
+ do_test (0, i, i, i, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (i, 0, i, i, BIG_CHAR);
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
for (i = 1; i < 8; ++i)
|
|
|
147e83 |
{
|
|
|
147e83 |
- do_test (0, 0, 8 << i, 8 << i, 127);
|
|
|
147e83 |
- do_test (8 - i, 2 * i, 8 << i, 8 << i, 127);
|
|
|
147e83 |
- do_test (0, 0, 8 << i, 2 << i, 127);
|
|
|
147e83 |
- do_test (8 - i, 2 * i, 8 << i, 2 << i, 127);
|
|
|
147e83 |
+ do_test (0, 0, 8 << i, 8 << i, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (8 - i, 2 * i, 8 << i, 8 << i, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (0, 0, 8 << i, 2 << i, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (8 - i, 2 * i, 8 << i, 2 << i, SMALL_CHAR);
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
for (i = 1; i < 8; ++i)
|
|
|
147e83 |
{
|
|
|
147e83 |
- do_test (i, 2 * i, 8 << i, 1, 127);
|
|
|
147e83 |
- do_test (2 * i, i, 8 << i, 1, 255);
|
|
|
147e83 |
- do_test (i, i, 8 << i, 10, 127);
|
|
|
147e83 |
- do_test (i, i, 8 << i, 10, 255);
|
|
|
147e83 |
+ do_test (i, 2 * i, 8 << i, 1, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (2 * i, i, 8 << i, 1, BIG_CHAR);
|
|
|
147e83 |
+ do_test (i, i, 8 << i, 10, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (i, i, 8 << i, 10, BIG_CHAR);
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
return ret;
|
|
|
147e83 |
diff --git a/benchtests/bench-wcscat.c b/benchtests/bench-wcscat.c
|
|
|
147e83 |
new file mode 100644
|
|
|
147e83 |
index 0000000..cd0dbc0
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/benchtests/bench-wcscat.c
|
|
|
147e83 |
@@ -0,0 +1,20 @@
|
|
|
147e83 |
+/* Measure wcscat functions.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#define WIDE 1
|
|
|
147e83 |
+#include "bench-strcat.c"
|
|
|
147e83 |
diff --git a/string/strcat.c b/string/strcat.c
|
|
|
147e83 |
index f9e4bc6..017bb41 100644
|
|
|
147e83 |
--- a/string/strcat.c
|
|
|
147e83 |
+++ b/string/strcat.c
|
|
|
147e83 |
@@ -20,11 +20,13 @@
|
|
|
147e83 |
|
|
|
147e83 |
#undef strcat
|
|
|
147e83 |
|
|
|
147e83 |
+#ifndef STRCAT
|
|
|
147e83 |
+# define STRCAT strcat
|
|
|
147e83 |
+#endif
|
|
|
147e83 |
+
|
|
|
147e83 |
/* Append SRC on the end of DEST. */
|
|
|
147e83 |
char *
|
|
|
147e83 |
-strcat (dest, src)
|
|
|
147e83 |
- char *dest;
|
|
|
147e83 |
- const char *src;
|
|
|
147e83 |
+STRCAT (char *dest, const char *src)
|
|
|
147e83 |
{
|
|
|
147e83 |
char *s1 = dest;
|
|
|
147e83 |
const char *s2 = src;
|
|
|
147e83 |
diff --git a/string/test-strcat.c b/string/test-strcat.c
|
|
|
147e83 |
index 2dc189a..a822733 100644
|
|
|
147e83 |
--- a/string/test-strcat.c
|
|
|
147e83 |
+++ b/string/test-strcat.c
|
|
|
147e83 |
@@ -18,19 +18,52 @@
|
|
|
147e83 |
<http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
|
|
|
147e83 |
#define TEST_MAIN
|
|
|
147e83 |
-#define TEST_NAME "strcat"
|
|
|
147e83 |
+#ifndef WIDE
|
|
|
147e83 |
+# define TEST_NAME "strcat"
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+# define TEST_NAME "wcscat"
|
|
|
147e83 |
+#endif /* WIDE */
|
|
|
147e83 |
#include "test-string.h"
|
|
|
147e83 |
|
|
|
147e83 |
-typedef char *(*proto_t) (char *, const char *);
|
|
|
147e83 |
-char *simple_strcat (char *, const char *);
|
|
|
147e83 |
+#ifndef WIDE
|
|
|
147e83 |
+# define STRCAT strcat
|
|
|
147e83 |
+# define CHAR char
|
|
|
147e83 |
+# define UCHAR unsigned char
|
|
|
147e83 |
+# define sfmt "s"
|
|
|
147e83 |
+# define SIMPLE_STRCAT simple_strcat
|
|
|
147e83 |
+# define STRLEN strlen
|
|
|
147e83 |
+# define STRCMP strcmp
|
|
|
147e83 |
+# define MEMSET memset
|
|
|
147e83 |
+# define MEMCPY memcpy
|
|
|
147e83 |
+# define MEMCMP memcmp
|
|
|
147e83 |
+# define BIG_CHAR CHAR_MAX
|
|
|
147e83 |
+# define SMALL_CHAR 127
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+# include <wchar.h>
|
|
|
147e83 |
+# define STRCAT wcscat
|
|
|
147e83 |
+# define CHAR wchar_t
|
|
|
147e83 |
+# define UCHAR wchar_t
|
|
|
147e83 |
+# define sfmt "ls"
|
|
|
147e83 |
+# define SIMPLE_STRCAT simple_wcscat
|
|
|
147e83 |
+# define STRLEN wcslen
|
|
|
147e83 |
+# define STRCMP wcscmp
|
|
|
147e83 |
+# define MEMSET wmemset
|
|
|
147e83 |
+# define MEMCPY wmemcpy
|
|
|
147e83 |
+# define MEMCMP wmemcmp
|
|
|
147e83 |
+# define BIG_CHAR WCHAR_MAX
|
|
|
147e83 |
+# define SMALL_CHAR 1273
|
|
|
147e83 |
+#endif /* WIDE */
|
|
|
147e83 |
|
|
|
147e83 |
-IMPL (simple_strcat, 0)
|
|
|
147e83 |
-IMPL (strcat, 1)
|
|
|
147e83 |
+typedef CHAR *(*proto_t) (CHAR *, const CHAR *);
|
|
|
147e83 |
+CHAR *SIMPLE_STRCAT (CHAR *, const CHAR *);
|
|
|
147e83 |
|
|
|
147e83 |
-char *
|
|
|
147e83 |
-simple_strcat (char *dst, const char *src)
|
|
|
147e83 |
+IMPL (SIMPLE_STRCAT, 0)
|
|
|
147e83 |
+IMPL (STRCAT, 1)
|
|
|
147e83 |
+
|
|
|
147e83 |
+CHAR *
|
|
|
147e83 |
+SIMPLE_STRCAT (CHAR *dst, const CHAR *src)
|
|
|
147e83 |
{
|
|
|
147e83 |
- char *ret = dst;
|
|
|
147e83 |
+ CHAR *ret = dst;
|
|
|
147e83 |
while (*dst++ != '\0');
|
|
|
147e83 |
--dst;
|
|
|
147e83 |
while ((*dst++ = *src++) != '\0');
|
|
|
147e83 |
@@ -38,9 +71,9 @@ simple_strcat (char *dst, const char *src)
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
static void
|
|
|
147e83 |
-do_one_test (impl_t *impl, char *dst, const char *src)
|
|
|
147e83 |
+do_one_test (impl_t *impl, CHAR *dst, const char *src)
|
|
|
147e83 |
{
|
|
|
147e83 |
- size_t k = strlen (dst);
|
|
|
147e83 |
+ size_t k = STRLEN (dst);
|
|
|
147e83 |
if (CALL (impl, dst, src) != dst)
|
|
|
147e83 |
{
|
|
|
147e83 |
error (0, 0, "Wrong result in function %s %p %p", impl->name,
|
|
|
147e83 |
@@ -49,9 +82,9 @@ do_one_test (impl_t *impl, char *dst, const char *src)
|
|
|
147e83 |
return;
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
- if (strcmp (dst + k, src) != 0)
|
|
|
147e83 |
+ if (STRCMP (dst + k, src) != 0)
|
|
|
147e83 |
{
|
|
|
147e83 |
- error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
|
|
|
147e83 |
+ error (0, 0, "Wrong result in function %s dst \"%" sfmt "\" src \"%" sfmt "\"",
|
|
|
147e83 |
impl->name, dst, src);
|
|
|
147e83 |
ret = 1;
|
|
|
147e83 |
return;
|
|
|
147e83 |
@@ -62,18 +95,18 @@ static void
|
|
|
147e83 |
do_test (size_t align1, size_t align2, size_t len1, size_t len2, int max_char)
|
|
|
147e83 |
{
|
|
|
147e83 |
size_t i;
|
|
|
147e83 |
- char *s1, *s2;
|
|
|
147e83 |
+ CHAR *s1, *s2;
|
|
|
147e83 |
|
|
|
147e83 |
align1 &= 7;
|
|
|
147e83 |
- if (align1 + len1 >= page_size)
|
|
|
147e83 |
+ if ((align1 + len1) * sizeof (CHAR) >= page_size)
|
|
|
147e83 |
return;
|
|
|
147e83 |
|
|
|
147e83 |
align2 &= 7;
|
|
|
147e83 |
- if (align2 + len1 + len2 >= page_size)
|
|
|
147e83 |
+ if ((align2 + len1 + len2) * sizeof (CHAR) >= page_size)
|
|
|
147e83 |
return;
|
|
|
147e83 |
|
|
|
147e83 |
- s1 = (char *) (buf1 + align1);
|
|
|
147e83 |
- s2 = (char *) (buf2 + align2);
|
|
|
147e83 |
+ s1 = (CHAR *) (buf1) + align1;
|
|
|
147e83 |
+ s2 = (CHAR *) (buf2) + align2;
|
|
|
147e83 |
|
|
|
147e83 |
for (i = 0; i < len1; ++i)
|
|
|
147e83 |
s1[i] = 32 + 23 * i % (max_char - 32);
|
|
|
147e83 |
@@ -93,9 +126,10 @@ static void
|
|
|
147e83 |
do_random_tests (void)
|
|
|
147e83 |
{
|
|
|
147e83 |
size_t i, j, n, align1, align2, len1, len2;
|
|
|
147e83 |
- unsigned char *p1 = buf1 + page_size - 512;
|
|
|
147e83 |
- unsigned char *p2 = buf2 + page_size - 512;
|
|
|
147e83 |
- unsigned char *res;
|
|
|
147e83 |
+ UCHAR *p1 = (UCHAR *) (buf1 + page_size) - 512;
|
|
|
147e83 |
+ UCHAR *p2 = (UCHAR *) (buf2 + page_size) - 512;
|
|
|
147e83 |
+ UCHAR *p3 = (UCHAR *) buf1;
|
|
|
147e83 |
+ UCHAR *res;
|
|
|
147e83 |
|
|
|
147e83 |
for (n = 0; n < ITERATIONS; n++)
|
|
|
147e83 |
{
|
|
|
147e83 |
@@ -132,26 +166,26 @@ do_random_tests (void)
|
|
|
147e83 |
p1[i] = 0;
|
|
|
147e83 |
else
|
|
|
147e83 |
{
|
|
|
147e83 |
- p1[i] = random () & 255;
|
|
|
147e83 |
+ p1[i] = random () & BIG_CHAR;
|
|
|
147e83 |
if (i >= align1 && i < len1 + align1 && !p1[i])
|
|
|
147e83 |
- p1[i] = (random () & 127) + 3;
|
|
|
147e83 |
+ p1[i] = (random () & SMALL_CHAR) + 3;
|
|
|
147e83 |
}
|
|
|
147e83 |
}
|
|
|
147e83 |
for (i = 0; i < len2; i++)
|
|
|
147e83 |
{
|
|
|
147e83 |
- buf1[i] = random () & 255;
|
|
|
147e83 |
- if (!buf1[i])
|
|
|
147e83 |
- buf1[i] = (random () & 127) + 3;
|
|
|
147e83 |
+ p3[i] = random () & BIG_CHAR;
|
|
|
147e83 |
+ if (!p3[i])
|
|
|
147e83 |
+ p3[i] = (random () & SMALL_CHAR) + 3;
|
|
|
147e83 |
}
|
|
|
147e83 |
- buf1[len2] = 0;
|
|
|
147e83 |
+ p3[len2] = 0;
|
|
|
147e83 |
|
|
|
147e83 |
FOR_EACH_IMPL (impl, 1)
|
|
|
147e83 |
{
|
|
|
147e83 |
- memset (p2 - 64, '\1', align2 + 64);
|
|
|
147e83 |
- memset (p2 + align2 + len2 + 1, '\1', 512 - align2 - len2 - 1);
|
|
|
147e83 |
- memcpy (p2 + align2, buf1, len2 + 1);
|
|
|
147e83 |
- res = (unsigned char *) CALL (impl, (char *) (p2 + align2),
|
|
|
147e83 |
- (char *) (p1 + align1));
|
|
|
147e83 |
+ MEMSET (p2 - 64, '\1', align2 + 64);
|
|
|
147e83 |
+ MEMSET (p2 + align2 + len2 + 1, '\1', 512 - align2 - len2 - 1);
|
|
|
147e83 |
+ MEMCPY (p2 + align2, p3, len2 + 1);
|
|
|
147e83 |
+ res = (UCHAR *) CALL (impl, (CHAR *) (p2 + align2),
|
|
|
147e83 |
+ (CHAR *) (p1 + align1));
|
|
|
147e83 |
if (res != p2 + align2)
|
|
|
147e83 |
{
|
|
|
147e83 |
error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd %zd) %p != %p",
|
|
|
147e83 |
@@ -169,7 +203,7 @@ do_random_tests (void)
|
|
|
147e83 |
break;
|
|
|
147e83 |
}
|
|
|
147e83 |
}
|
|
|
147e83 |
- if (memcmp (p2 + align2, buf1, len2))
|
|
|
147e83 |
+ if (MEMCMP (p2 + align2, p3, len2))
|
|
|
147e83 |
{
|
|
|
147e83 |
error (0, 0, "Iteration %zd - garbage in string before, %s (%zd, %zd, %zd, %zd)",
|
|
|
147e83 |
n, impl->name, align1, align2, len1, len2);
|
|
|
147e83 |
@@ -185,7 +219,7 @@ do_random_tests (void)
|
|
|
147e83 |
break;
|
|
|
147e83 |
}
|
|
|
147e83 |
}
|
|
|
147e83 |
- if (memcmp (p1 + align1, p2 + align2 + len2, len1 + 1))
|
|
|
147e83 |
+ if (MEMCMP (p1 + align1, p2 + align2 + len2, len1 + 1))
|
|
|
147e83 |
{
|
|
|
147e83 |
error (0, 0, "Iteration %zd - different strings, %s (%zd, %zd, %zd, %zd)",
|
|
|
147e83 |
n, impl->name, align1, align2, len1, len2);
|
|
|
147e83 |
@@ -209,26 +243,26 @@ test_main (void)
|
|
|
147e83 |
|
|
|
147e83 |
for (i = 0; i < 16; ++i)
|
|
|
147e83 |
{
|
|
|
147e83 |
- do_test (0, 0, i, i, 127);
|
|
|
147e83 |
- do_test (0, 0, i, i, 255);
|
|
|
147e83 |
- do_test (0, i, i, i, 127);
|
|
|
147e83 |
- do_test (i, 0, i, i, 255);
|
|
|
147e83 |
+ do_test (0, 0, i, i, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (0, 0, i, i, BIG_CHAR);
|
|
|
147e83 |
+ do_test (0, i, i, i, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (i, 0, i, i, BIG_CHAR);
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
for (i = 1; i < 8; ++i)
|
|
|
147e83 |
{
|
|
|
147e83 |
- do_test (0, 0, 8 << i, 8 << i, 127);
|
|
|
147e83 |
- do_test (8 - i, 2 * i, 8 << i, 8 << i, 127);
|
|
|
147e83 |
- do_test (0, 0, 8 << i, 2 << i, 127);
|
|
|
147e83 |
- do_test (8 - i, 2 * i, 8 << i, 2 << i, 127);
|
|
|
147e83 |
+ do_test (0, 0, 8 << i, 8 << i, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (8 - i, 2 * i, 8 << i, 8 << i, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (0, 0, 8 << i, 2 << i, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (8 - i, 2 * i, 8 << i, 2 << i, SMALL_CHAR);
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
for (i = 1; i < 8; ++i)
|
|
|
147e83 |
{
|
|
|
147e83 |
- do_test (i, 2 * i, 8 << i, 1, 127);
|
|
|
147e83 |
- do_test (2 * i, i, 8 << i, 1, 255);
|
|
|
147e83 |
- do_test (i, i, 8 << i, 10, 127);
|
|
|
147e83 |
- do_test (i, i, 8 << i, 10, 255);
|
|
|
147e83 |
+ do_test (i, 2 * i, 8 << i, 1, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (2 * i, i, 8 << i, 1, BIG_CHAR);
|
|
|
147e83 |
+ do_test (i, i, 8 << i, 10, SMALL_CHAR);
|
|
|
147e83 |
+ do_test (i, i, 8 << i, 10, BIG_CHAR);
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
do_random_tests ();
|
|
|
147e83 |
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
|
|
|
147e83 |
index 98b588f..6283999 100644
|
|
|
147e83 |
--- a/sysdeps/s390/multiarch/Makefile
|
|
|
147e83 |
+++ b/sysdeps/s390/multiarch/Makefile
|
|
|
147e83 |
@@ -4,7 +4,8 @@ sysdep_routines += strlen strlen-vx strlen-c \
|
|
|
147e83 |
strcpy strcpy-vx \
|
|
|
147e83 |
stpcpy stpcpy-vx stpcpy-c \
|
|
|
147e83 |
strncpy strncpy-vx \
|
|
|
147e83 |
- stpncpy stpncpy-vx stpncpy-c
|
|
|
147e83 |
+ stpncpy stpncpy-vx stpncpy-c \
|
|
|
147e83 |
+ strcat strcat-vx strcat-c
|
|
|
147e83 |
endif
|
|
|
147e83 |
|
|
|
147e83 |
ifeq ($(subdir),wcsmbs)
|
|
|
147e83 |
@@ -13,5 +14,6 @@ sysdep_routines += wcslen wcslen-vx wcslen-c \
|
|
|
147e83 |
wcscpy wcscpy-vx wcscpy-c \
|
|
|
147e83 |
wcpcpy wcpcpy-vx wcpcpy-c \
|
|
|
147e83 |
wcsncpy wcsncpy-vx wcsncpy-c \
|
|
|
147e83 |
- wcpncpy wcpncpy-vx wcpncpy-c
|
|
|
147e83 |
+ wcpncpy wcpncpy-vx wcpncpy-c \
|
|
|
147e83 |
+ wcscat wcscat-vx wcscat-c
|
|
|
147e83 |
endif
|
|
|
147e83 |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
147e83 |
index ca69983..ccf4dea 100644
|
|
|
147e83 |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
147e83 |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
147e83 |
@@ -97,6 +97,9 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
147e83 |
IFUNC_VX_IMPL (stpncpy);
|
|
|
147e83 |
IFUNC_VX_IMPL (wcpncpy);
|
|
|
147e83 |
|
|
|
147e83 |
+ IFUNC_VX_IMPL (strcat);
|
|
|
147e83 |
+ IFUNC_VX_IMPL (wcscat);
|
|
|
147e83 |
+
|
|
|
147e83 |
#endif /* HAVE_S390_VX_ASM_SUPPORT */
|
|
|
147e83 |
|
|
|
147e83 |
return i;
|
|
|
147e83 |
diff --git a/sysdeps/s390/multiarch/strcat-c.c b/sysdeps/s390/multiarch/strcat-c.c
|
|
|
147e83 |
new file mode 100644
|
|
|
147e83 |
index 0000000..da4fad8
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/sysdeps/s390/multiarch/strcat-c.c
|
|
|
147e83 |
@@ -0,0 +1,28 @@
|
|
|
147e83 |
+/* Default strcat implementation for S/390.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
147e83 |
+# define STRCAT __strcat_c
|
|
|
147e83 |
+# ifdef SHARED
|
|
|
147e83 |
+# undef libc_hidden_builtin_def
|
|
|
147e83 |
+# define libc_hidden_builtin_def(name) \
|
|
|
147e83 |
+ __hidden_ver1 (__strcat_c, __GI_strcat, __strcat_c);
|
|
|
147e83 |
+# endif /* SHARED */
|
|
|
147e83 |
+
|
|
|
147e83 |
+# include <string/strcat.c>
|
|
|
147e83 |
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
|
|
|
147e83 |
diff --git a/sysdeps/s390/multiarch/strcat-vx.S b/sysdeps/s390/multiarch/strcat-vx.S
|
|
|
147e83 |
new file mode 100644
|
|
|
147e83 |
index 0000000..3915097
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/sysdeps/s390/multiarch/strcat-vx.S
|
|
|
147e83 |
@@ -0,0 +1,161 @@
|
|
|
147e83 |
+/* Vector optimized 32/64 bit S/390 version of strcat.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
147e83 |
+
|
|
|
147e83 |
+# include "sysdep.h"
|
|
|
147e83 |
+# include "asm-syntax.h"
|
|
|
147e83 |
+
|
|
|
147e83 |
+ .text
|
|
|
147e83 |
+
|
|
|
147e83 |
+/* char * strcat (const char *dest, const char *src)
|
|
|
147e83 |
+ Concatenate two strings.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ Register usage:
|
|
|
147e83 |
+ -r0=saved dest pointer for return
|
|
|
147e83 |
+ -r1=tmp
|
|
|
147e83 |
+ -r2=dest
|
|
|
147e83 |
+ -r3=src
|
|
|
147e83 |
+ -r4=tmp
|
|
|
147e83 |
+ -r5=current_len
|
|
|
147e83 |
+ -v16=part of src
|
|
|
147e83 |
+ -v17=index of zero
|
|
|
147e83 |
+ -v18=part of src
|
|
|
147e83 |
+*/
|
|
|
147e83 |
+ENTRY(__strcat_vx)
|
|
|
147e83 |
+ .machine "z13"
|
|
|
147e83 |
+ .machinemode "zarch_nohighgprs"
|
|
|
147e83 |
+
|
|
|
147e83 |
+ lgr %r0,%r2 /* Save destination pointer for return. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* STRLEN
|
|
|
147e83 |
+ r1 = loaded bytes (tmp)
|
|
|
147e83 |
+ r4 = zero byte index (tmp)
|
|
|
147e83 |
+ r2 = dst
|
|
|
147e83 |
+ */
|
|
|
147e83 |
+ vlbb %v16,0(%r2),6 /* Load s until next 4k-byte boundary. */
|
|
|
147e83 |
+ lcbb %r1,0(%r2),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ vfenezb %v16,%v16,%v16 /* Find element not equal with zero search. */
|
|
|
147e83 |
+ vlgvb %r5,%v16,7 /* Load zero index or 16 if not found. */
|
|
|
147e83 |
+ clrjl %r5,%r1,.Llen_end /* Found zero within loaded bytes, end. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* Align s to 16 byte. */
|
|
|
147e83 |
+ risbgn %r1,%r2,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15. */
|
|
|
147e83 |
+ lghi %r5,16 /* current_len = 16. */
|
|
|
147e83 |
+ slr %r5,%r1 /* Compute bytes to 16bytes boundary. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* Find zero in 16byte aligned loop. */
|
|
|
147e83 |
+.Llen_loop:
|
|
|
147e83 |
+ vl %v16,0(%r5,%r2) /* Load s. */
|
|
|
147e83 |
+ vfenezbs %v16,%v16,%v16 /* Find element not equal with zero search. */
|
|
|
147e83 |
+ je .Llen_found /* Jump away if zero was found. */
|
|
|
147e83 |
+ vl %v16,16(%r5,%r2)
|
|
|
147e83 |
+ vfenezbs %v16,%v16,%v16
|
|
|
147e83 |
+ je .Llen_found16
|
|
|
147e83 |
+ vl %v16,32(%r5,%r2)
|
|
|
147e83 |
+ vfenezbs %v16,%v16,%v16
|
|
|
147e83 |
+ je .Llen_found32
|
|
|
147e83 |
+ vl %v16,48(%r5,%r2)
|
|
|
147e83 |
+ vfenezbs %v16,%v16,%v16
|
|
|
147e83 |
+ je .Llen_found48
|
|
|
147e83 |
+
|
|
|
147e83 |
+ aghi %r5,64
|
|
|
147e83 |
+ j .Llen_loop /* No zero -> loop. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+.Llen_found48:
|
|
|
147e83 |
+ aghi %r5,16
|
|
|
147e83 |
+.Llen_found32:
|
|
|
147e83 |
+ aghi %r5,16
|
|
|
147e83 |
+.Llen_found16:
|
|
|
147e83 |
+ aghi %r5,16
|
|
|
147e83 |
+.Llen_found:
|
|
|
147e83 |
+ vlgvb %r4,%v16,7 /* Load byte index of zero. */
|
|
|
147e83 |
+ algr %r5,%r4
|
|
|
147e83 |
+
|
|
|
147e83 |
+.Llen_end:
|
|
|
147e83 |
+ /* STRCPY
|
|
|
147e83 |
+ %r1 = loaded bytes (tmp)
|
|
|
147e83 |
+ %r4 = zero byte index (tmp)
|
|
|
147e83 |
+ %r3 = curr src pointer
|
|
|
147e83 |
+ %r2 = curr dst pointer
|
|
|
147e83 |
+ */
|
|
|
147e83 |
+ la %r2,0(%r5,%r2) /* strcpy at end of dst-string. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ vlbb %v16,0(%r3),6 /* Load s until next 4k-byte boundary. */
|
|
|
147e83 |
+ lcbb %r1,0(%r3),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ vfenezb %v17,%v16,%v16 /* Find element not equal with zero search. */
|
|
|
147e83 |
+ vlgvb %r5,%v17,7 /* Load zero index or 16 if not found. */
|
|
|
147e83 |
+ clrjl %r5,%r1,.Lcpy_found_align /* If found zero within loaded bytes,
|
|
|
147e83 |
+ copy bytes before and return. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* Align s to 16 byte. */
|
|
|
147e83 |
+ risbgn %r4,%r3,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15. */
|
|
|
147e83 |
+ lghi %r5,15 /* current_len = 15. */
|
|
|
147e83 |
+ slr %r5,%r4 /* Compute highest index to 16byte boundary. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ vstl %v16,%r5,0(%r2) /* Copy loaded characters - no zero. */
|
|
|
147e83 |
+ ahi %r5,1 /* Start loop at next character. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* Find zero in 16byte aligned loop. */
|
|
|
147e83 |
+.Lcpy_loop:
|
|
|
147e83 |
+ vl %v16,0(%r5,%r3) /* Load s. */
|
|
|
147e83 |
+ vfenezbs %v17,%v16,%v16 /* Find element not equal with zero search. */
|
|
|
147e83 |
+ je .Lcpy_found_v16_0 /* Jump away if zero was found. */
|
|
|
147e83 |
+ vl %v18,16(%r5,%r3)/* Load next part of s. */
|
|
|
147e83 |
+ vst %v16,0(%r5,%r2) /* Store previous part without zero to dst. */
|
|
|
147e83 |
+ vfenezbs %v17,%v18,%v18
|
|
|
147e83 |
+ je .Lcpy_found_v18_16
|
|
|
147e83 |
+ vl %v16,32(%r5,%r3)
|
|
|
147e83 |
+ vst %v18,16(%r5,%r2)
|
|
|
147e83 |
+ vfenezbs %v17,%v16,%v16
|
|
|
147e83 |
+ je .Lcpy_found_v16_32
|
|
|
147e83 |
+ vl %v18,48(%r5,%r3)
|
|
|
147e83 |
+ vst %v16,32(%r5,%r2)
|
|
|
147e83 |
+ vfenezbs %v17,%v18,%v18
|
|
|
147e83 |
+ je .Lcpy_found_v18_48
|
|
|
147e83 |
+ vst %v18,48(%r5,%r2)
|
|
|
147e83 |
+
|
|
|
147e83 |
+ aghi %r5,64
|
|
|
147e83 |
+ j .Lcpy_loop /* No zero -> loop. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+.Lcpy_found_v16_32:
|
|
|
147e83 |
+ aghi %r5,32
|
|
|
147e83 |
+.Lcpy_found_v16_0:
|
|
|
147e83 |
+ la %r4,0(%r5,%r2)
|
|
|
147e83 |
+ vlgvb %r1,%v17,7 /* Load byte index of zero. */
|
|
|
147e83 |
+ vstl %v16,%r1,0(%r4) /* Copy characters including zero. */
|
|
|
147e83 |
+ lgr %r2,%r0 /* Load saved dest-ptr. */
|
|
|
147e83 |
+ br %r14
|
|
|
147e83 |
+
|
|
|
147e83 |
+.Lcpy_found_v18_48:
|
|
|
147e83 |
+ aghi %r5,32
|
|
|
147e83 |
+.Lcpy_found_v18_16:
|
|
|
147e83 |
+ la %r4,16(%r5,%r2)
|
|
|
147e83 |
+ vlgvb %r1,%v17,7 /* Load byte index of zero. */
|
|
|
147e83 |
+ vstl %v18,%r1,0(%r4) /* Copy characters including zero. */
|
|
|
147e83 |
+ lgr %r2,%r0 /* Load saved dest-ptr. */
|
|
|
147e83 |
+ br %r14
|
|
|
147e83 |
+
|
|
|
147e83 |
+.Lcpy_found_align:
|
|
|
147e83 |
+ vstl %v16,%r5,0(%r2) /* Copy characters including zero. */
|
|
|
147e83 |
+ lgr %r2,%r0 /* Load saved dest-ptr. */
|
|
|
147e83 |
+ br %r14
|
|
|
147e83 |
+END(__strcat_vx)
|
|
|
147e83 |
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
|
|
|
147e83 |
diff --git a/sysdeps/s390/multiarch/strcat.c b/sysdeps/s390/multiarch/strcat.c
|
|
|
147e83 |
new file mode 100644
|
|
|
147e83 |
index 0000000..8b5c47e
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/sysdeps/s390/multiarch/strcat.c
|
|
|
147e83 |
@@ -0,0 +1,27 @@
|
|
|
147e83 |
+/* Multiple versions of strcat.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
147e83 |
+# include <string.h>
|
|
|
147e83 |
+# include <ifunc-resolve.h>
|
|
|
147e83 |
+
|
|
|
147e83 |
+s390_vx_libc_ifunc2 (__strcat, strcat)
|
|
|
147e83 |
+
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+# include <string/strcat.c>
|
|
|
147e83 |
+#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc) */
|
|
|
147e83 |
diff --git a/sysdeps/s390/multiarch/wcscat-c.c b/sysdeps/s390/multiarch/wcscat-c.c
|
|
|
147e83 |
new file mode 100644
|
|
|
147e83 |
index 0000000..49fb64b
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/sysdeps/s390/multiarch/wcscat-c.c
|
|
|
147e83 |
@@ -0,0 +1,25 @@
|
|
|
147e83 |
+/* Default wcscat implementation for S/390.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
147e83 |
+# define WCSCAT __wcscat_c
|
|
|
147e83 |
+
|
|
|
147e83 |
+# include <wchar.h>
|
|
|
147e83 |
+extern __typeof (__wcscat) __wcscat_c;
|
|
|
147e83 |
+# include <wcsmbs/wcscat.c>
|
|
|
147e83 |
+#endif
|
|
|
147e83 |
diff --git a/sysdeps/s390/multiarch/wcscat-vx.S b/sysdeps/s390/multiarch/wcscat-vx.S
|
|
|
147e83 |
new file mode 100644
|
|
|
147e83 |
index 0000000..7ee185f
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/sysdeps/s390/multiarch/wcscat-vx.S
|
|
|
147e83 |
@@ -0,0 +1,175 @@
|
|
|
147e83 |
+/* Vector optimized 32/64 bit S/390 version of wcscat.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
147e83 |
+
|
|
|
147e83 |
+# include "sysdep.h"
|
|
|
147e83 |
+# include "asm-syntax.h"
|
|
|
147e83 |
+
|
|
|
147e83 |
+ .text
|
|
|
147e83 |
+
|
|
|
147e83 |
+/* wchar_t * wcscat (wchar_t *dest, const wchar_t *src)
|
|
|
147e83 |
+ Concatenate two strings.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ Register usage:
|
|
|
147e83 |
+ -r0=saved dest pointer for return
|
|
|
147e83 |
+ -r1=tmp
|
|
|
147e83 |
+ -r2=dest
|
|
|
147e83 |
+ -r3=src
|
|
|
147e83 |
+ -r4=tmp
|
|
|
147e83 |
+ -r5=current_len
|
|
|
147e83 |
+ -v16=part of src
|
|
|
147e83 |
+ -v17=index of zero
|
|
|
147e83 |
+ -v18=part of src
|
|
|
147e83 |
+*/
|
|
|
147e83 |
+ENTRY(__wcscat_vx)
|
|
|
147e83 |
+ .machine "z13"
|
|
|
147e83 |
+ .machinemode "zarch_nohighgprs"
|
|
|
147e83 |
+
|
|
|
147e83 |
+ vlbb %v16,0(%r2),6 /* Load s until next 4k-byte boundary. */
|
|
|
147e83 |
+ lcbb %r1,0(%r2),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* __wcslen_c can handle non 4byte aligned pointers,
|
|
|
147e83 |
+ but __wcscpy_c not. Thus if either src or dest is
|
|
|
147e83 |
+ not 4byte aligned, use __wcscat_c. */
|
|
|
147e83 |
+ tmll %r2,3 /* Test if s is 4-byte aligned? */
|
|
|
147e83 |
+ jne .Lfallback /* And use common-code variant if not. */
|
|
|
147e83 |
+ tmll %r3,3 /* Test if src is 4-byte aligned? */
|
|
|
147e83 |
+ jne .Lfallback /* And use common-code variant if not. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ lgr %r0,%r2 /* Save destination pointer for return. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* WCSLEN
|
|
|
147e83 |
+ r1 = loaded bytes (tmp)
|
|
|
147e83 |
+ r4 = zero byte index (tmp)
|
|
|
147e83 |
+ r2 = dst
|
|
|
147e83 |
+ */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ vfenezf %v16,%v16,%v16 /* Find element not equal with zero search. */
|
|
|
147e83 |
+ vlgvb %r5,%v16,7 /* Load zero index or 16 if not found. */
|
|
|
147e83 |
+ clrjl %r5,%r1,.Llen_end /* Found zero within loaded bytes, end. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* Align s to 16 byte. */
|
|
|
147e83 |
+ risbgn %r1,%r2,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15. */
|
|
|
147e83 |
+ lghi %r5,16 /* current_len = 16. */
|
|
|
147e83 |
+ slr %r5,%r1 /* Compute bytes to 16bytes boundary. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* Find zero in 16byte aligned loop. */
|
|
|
147e83 |
+.Llen_loop:
|
|
|
147e83 |
+ vl %v16,0(%r5,%r2) /* Load s. */
|
|
|
147e83 |
+ vfenezfs %v16,%v16,%v16 /* Find element not equal with zero search. */
|
|
|
147e83 |
+ je .Llen_found /* Jump away if zero was found. */
|
|
|
147e83 |
+ vl %v16,16(%r5,%r2)
|
|
|
147e83 |
+ vfenezfs %v16,%v16,%v16
|
|
|
147e83 |
+ je .Llen_found16
|
|
|
147e83 |
+ vl %v16,32(%r5,%r2)
|
|
|
147e83 |
+ vfenezfs %v16,%v16,%v16
|
|
|
147e83 |
+ je .Llen_found32
|
|
|
147e83 |
+ vl %v16,48(%r5,%r2)
|
|
|
147e83 |
+ vfenezfs %v16,%v16,%v16
|
|
|
147e83 |
+ je .Llen_found48
|
|
|
147e83 |
+
|
|
|
147e83 |
+ aghi %r5,64
|
|
|
147e83 |
+ j .Llen_loop /* No zero -> loop. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+.Llen_found48:
|
|
|
147e83 |
+ aghi %r5,16
|
|
|
147e83 |
+.Llen_found32:
|
|
|
147e83 |
+ aghi %r5,16
|
|
|
147e83 |
+.Llen_found16:
|
|
|
147e83 |
+ aghi %r5,16
|
|
|
147e83 |
+.Llen_found:
|
|
|
147e83 |
+ vlgvb %r4,%v16,7 /* Load byte index of zero. */
|
|
|
147e83 |
+ algr %r5,%r4
|
|
|
147e83 |
+
|
|
|
147e83 |
+.Llen_end:
|
|
|
147e83 |
+ /* WCSCPY
|
|
|
147e83 |
+ %r1 = loaded bytes (tmp)
|
|
|
147e83 |
+ %r4 = zero byte index (tmp)
|
|
|
147e83 |
+ %r3 = curr src pointer
|
|
|
147e83 |
+ %r2 = curr dst pointer
|
|
|
147e83 |
+ */
|
|
|
147e83 |
+ la %r2,0(%r5,%r2) /* strcpy at end of dst-string. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ vlbb %v16,0(%r3),6 /* Load s until next 4k-byte boundary. */
|
|
|
147e83 |
+ lcbb %r1,0(%r3),6 /* Get bytes to 4k-byte boundary or 16. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ vfenezf %v17,%v16,%v16 /* Find element not equal with zero search. */
|
|
|
147e83 |
+ vlgvb %r5,%v17,7 /* Load zero index or 16 if not found. */
|
|
|
147e83 |
+ clrjl %r5,%r1,.Lcpy_found_align /* If found zero within loaded bytes,
|
|
|
147e83 |
+ copy bytes before and return. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* Align s to 16 byte. */
|
|
|
147e83 |
+ risbgn %r4,%r3,60,128+63,0 /* %r3 = bits 60-63 of %r2 'and' 15. */
|
|
|
147e83 |
+ lghi %r5,15 /* current_len = 15. */
|
|
|
147e83 |
+ slr %r5,%r4 /* Compute highest index to 16byte boundary. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ vstl %v16,%r5,0(%r2) /* Copy loaded characters - no zero. */
|
|
|
147e83 |
+ ahi %r5,1 /* Start loop at next character. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ /* Find zero in 16byte aligned loop. */
|
|
|
147e83 |
+.Lcpy_loop:
|
|
|
147e83 |
+ vl %v16,0(%r5,%r3) /* Load s. */
|
|
|
147e83 |
+ vfenezfs %v17,%v16,%v16 /* Find element not equal with zero search. */
|
|
|
147e83 |
+ je .Lcpy_found_v16_0 /* Jump away if zero was found. */
|
|
|
147e83 |
+ vl %v18,16(%r5,%r3) /* Load next part of s. */
|
|
|
147e83 |
+ vst %v16,0(%r5,%r2) /* Save previous part without zero to dst. */
|
|
|
147e83 |
+ vfenezfs %v17,%v18,%v18
|
|
|
147e83 |
+ je .Lcpy_found_v18_16
|
|
|
147e83 |
+ vl %v16,32(%r5,%r3)
|
|
|
147e83 |
+ vst %v18,16(%r5,%r2)
|
|
|
147e83 |
+ vfenezfs %v17,%v16,%v16
|
|
|
147e83 |
+ je .Lcpy_found_v16_32
|
|
|
147e83 |
+ vl %v18,48(%r5,%r3)
|
|
|
147e83 |
+ vst %v16,32(%r5,%r2)
|
|
|
147e83 |
+ vfenezfs %v17,%v18,%v18
|
|
|
147e83 |
+ je .Lcpy_found_v18_48
|
|
|
147e83 |
+ vst %v18,48(%r5,%r2)
|
|
|
147e83 |
+
|
|
|
147e83 |
+ aghi %r5,64
|
|
|
147e83 |
+ j .Lcpy_loop /* No zero -> loop. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+.Lcpy_found_v16_32:
|
|
|
147e83 |
+ aghi %r5,32
|
|
|
147e83 |
+.Lcpy_found_v16_0:
|
|
|
147e83 |
+ la %r4,0(%r5,%r2)
|
|
|
147e83 |
+ vlgvb %r1,%v17,7 /* Load byte index of zero. */
|
|
|
147e83 |
+ aghi %r1,3 /* Also copy remaining bytes of zero. */
|
|
|
147e83 |
+ vstl %v16,%r1,0(%r4) /* Copy characters including zero. */
|
|
|
147e83 |
+ lgr %r2,%r0 /* Load saved dest-ptr. */
|
|
|
147e83 |
+ br %r14
|
|
|
147e83 |
+
|
|
|
147e83 |
+.Lcpy_found_v18_48:
|
|
|
147e83 |
+ aghi %r5,32
|
|
|
147e83 |
+.Lcpy_found_v18_16:
|
|
|
147e83 |
+ la %r4,16(%r5,%r2)
|
|
|
147e83 |
+ vlgvb %r1,%v17,7 /* Load byte index of zero. */
|
|
|
147e83 |
+ aghi %r1,3 /* Also copy remaining bytes of zero. */
|
|
|
147e83 |
+ vstl %v18,%r1,0(%r4) /* Copy characters including zero. */
|
|
|
147e83 |
+ lgr %r2,%r0 /* Load saved dest-ptr. */
|
|
|
147e83 |
+ br %r14
|
|
|
147e83 |
+
|
|
|
147e83 |
+.Lcpy_found_align:
|
|
|
147e83 |
+ aghi %r5,3 /* Also copy remaining bytes of found zero. */
|
|
|
147e83 |
+ vstl %v16,%r5,0(%r2) /* Copy characters including zero. */
|
|
|
147e83 |
+ lgr %r2,%r0 /* Load saved dest-ptr. */
|
|
|
147e83 |
+ br %r14
|
|
|
147e83 |
+.Lfallback:
|
|
|
147e83 |
+ jg __wcscat_c
|
|
|
147e83 |
+END(__wcscat_vx)
|
|
|
147e83 |
+#endif /* HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc */
|
|
|
147e83 |
diff --git a/sysdeps/s390/multiarch/wcscat.c b/sysdeps/s390/multiarch/wcscat.c
|
|
|
147e83 |
new file mode 100644
|
|
|
147e83 |
index 0000000..c6fdaa7
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/sysdeps/s390/multiarch/wcscat.c
|
|
|
147e83 |
@@ -0,0 +1,28 @@
|
|
|
147e83 |
+/* Multiple versions of wcscat.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#if defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc
|
|
|
147e83 |
+# include <wchar.h>
|
|
|
147e83 |
+# include <ifunc-resolve.h>
|
|
|
147e83 |
+
|
|
|
147e83 |
+s390_vx_libc_ifunc (__wcscat)
|
|
|
147e83 |
+weak_alias (__wcscat, wcscat)
|
|
|
147e83 |
+
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+# include <wcsmbs/wcscat.c>
|
|
|
147e83 |
+#endif /* !(defined HAVE_S390_VX_ASM_SUPPORT && !defined NOT_IN_libc) */
|
|
|
147e83 |
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
|
|
|
147e83 |
index 89b5b3b..9bfc78c 100644
|
|
|
147e83 |
--- a/wcsmbs/Makefile
|
|
|
147e83 |
+++ b/wcsmbs/Makefile
|
|
|
147e83 |
@@ -42,7 +42,7 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
|
|
|
147e83 |
mbrtoc16 c16rtomb
|
|
|
147e83 |
|
|
|
147e83 |
strop-tests := wcscmp wmemcmp wcslen wcschr wcsrchr wcscpy wcsnlen \
|
|
|
147e83 |
- wcpcpy wcsncpy wcpncpy
|
|
|
147e83 |
+ wcpcpy wcsncpy wcpncpy wcscat
|
|
|
147e83 |
tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
|
|
|
147e83 |
tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
|
|
|
147e83 |
tst-c16c32-1 wcsatcliff $(addprefix test-,$(strop-tests))
|
|
|
147e83 |
diff --git a/wcsmbs/test-wcscat-ifunc.c b/wcsmbs/test-wcscat-ifunc.c
|
|
|
147e83 |
new file mode 100644
|
|
|
147e83 |
index 0000000..53305c6
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/wcsmbs/test-wcscat-ifunc.c
|
|
|
147e83 |
@@ -0,0 +1,20 @@
|
|
|
147e83 |
+/* Test and measure IFUNC implementations of wcscat function.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#define TEST_IFUNC 1
|
|
|
147e83 |
+#include "test-wcscat.c"
|
|
|
147e83 |
diff --git a/wcsmbs/test-wcscat.c b/wcsmbs/test-wcscat.c
|
|
|
147e83 |
new file mode 100644
|
|
|
147e83 |
index 0000000..9bab33b
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/wcsmbs/test-wcscat.c
|
|
|
147e83 |
@@ -0,0 +1,20 @@
|
|
|
147e83 |
+/* Test wcscat functions.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#define WIDE 1
|
|
|
147e83 |
+#include "../string/test-strcat.c"
|
|
|
147e83 |
diff --git a/wcsmbs/wcscat.c b/wcsmbs/wcscat.c
|
|
|
147e83 |
index 0d34d76..4eb2d93 100644
|
|
|
147e83 |
--- a/wcsmbs/wcscat.c
|
|
|
147e83 |
+++ b/wcsmbs/wcscat.c
|
|
|
147e83 |
@@ -18,6 +18,9 @@
|
|
|
147e83 |
|
|
|
147e83 |
#include <wchar.h>
|
|
|
147e83 |
|
|
|
147e83 |
+#ifdef WCSCAT
|
|
|
147e83 |
+# define __wcscat WCSCAT
|
|
|
147e83 |
+#endif
|
|
|
147e83 |
|
|
|
147e83 |
/* Append SRC on the end of DEST. */
|
|
|
147e83 |
wchar_t *
|
|
|
147e83 |
@@ -47,4 +50,6 @@ __wcscat (dest, src)
|
|
|
147e83 |
|
|
|
147e83 |
return dest;
|
|
|
147e83 |
}
|
|
|
147e83 |
+#ifndef WCSCAT
|
|
|
147e83 |
weak_alias (__wcscat, wcscat)
|
|
|
147e83 |
+#endif
|
|
|
147e83 |
--
|
|
|
147e83 |
2.3.0
|
|
|
147e83 |
|