|
|
147e83 |
From 9acd7055583a99e912d353ded6a3b4715ee2562a Mon Sep 17 00:00:00 2001
|
|
|
147e83 |
From: Stefan Liebler <stli@linux.vnet.ibm.com>
|
|
|
147e83 |
Date: Thu, 27 Jul 2017 10:53:58 +0200
|
|
|
147e83 |
Subject: [PATCH 04/10] S390: Move utf16-utf32-z9.c to multiarch folder and use
|
|
|
147e83 |
s390_libc_ifunc_expr macro.
|
|
|
147e83 |
|
|
|
147e83 |
upstream-commit 85286aaf1dd7216a64964752d147c5ce3c4067d0
|
|
|
147e83 |
|
|
|
147e83 |
The utf16-utf32-z9.c iconv module is using ifunc and thus the ifunc part should
|
|
|
147e83 |
be in multiarch folder. Otherwise ifunc is used even if you configure
|
|
|
147e83 |
with --disable-multi-arch.
|
|
|
147e83 |
|
|
|
147e83 |
This patch moves the ifunc resolvers to the new file
|
|
|
147e83 |
sysdeps/s390/multiarch/utf16-utf32-z9.c. The resolvers are now implemented
|
|
|
147e83 |
with s390_libc_ifunc_expr macro instead of using gcc attribute ifunc directly.
|
|
|
147e83 |
|
|
|
147e83 |
The ifunc versions are implemented in sysdeps/s390/utf16-utf32-z9.c.
|
|
|
147e83 |
Each version is only implemented if needed or supported. Therefore there is
|
|
|
147e83 |
a block at beginning of the file which selects the versions which should be
|
|
|
147e83 |
defined depending on support for multiarch, vector-support and used minimum
|
|
|
147e83 |
architecture level. This block defines HAVE_[FROM|TO]_[C|VX] to 1 or 0.
|
|
|
147e83 |
The code below is rearranged and surrounded
|
|
|
147e83 |
by #if HAVE_[FROM|TO]_[C|VX] == 1. There is no functional change.
|
|
|
147e83 |
|
|
|
147e83 |
ChangeLog:
|
|
|
147e83 |
|
|
|
147e83 |
* sysdeps/s390/multiarch/utf16-utf32-z9.c: New File.
|
|
|
147e83 |
* sysdeps/s390/utf16-utf32-z9.c: Move ifunc resolvers to multiarch
|
|
|
147e83 |
folder and define ifunc versions depending on HAVE_[FROM|TO]_[C|VX].
|
|
|
147e83 |
(HAVE_FROM_C, HAVE_FROM_VX, HAVE_TO_C, HAVE_TO_VX, FROM_LOOP_DEFAULT,
|
|
|
147e83 |
FROM_LOOP_C, FROM_LOOP_VX, TO_LOOP_DEFAULT, TO_LOOP_C, TO_LOOP_VX):
|
|
|
147e83 |
New Define.
|
|
|
147e83 |
---
|
|
|
147e83 |
sysdeps/s390/multiarch/utf16-utf32-z9.c | 44 ++++++++++
|
|
|
147e83 |
sysdeps/s390/utf16-utf32-z9.c | 142 ++++++++++++++++----------------
|
|
|
147e83 |
2 files changed, 114 insertions(+), 72 deletions(-)
|
|
|
147e83 |
create mode 100644 sysdeps/s390/multiarch/utf16-utf32-z9.c
|
|
|
147e83 |
|
|
|
147e83 |
diff --git a/sysdeps/s390/multiarch/utf16-utf32-z9.c b/sysdeps/s390/multiarch/utf16-utf32-z9.c
|
|
|
147e83 |
new file mode 100644
|
|
|
147e83 |
index 0000000..6e64169
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/sysdeps/s390/multiarch/utf16-utf32-z9.c
|
|
|
147e83 |
@@ -0,0 +1,44 @@
|
|
|
147e83 |
+/* Conversion between UTF-16 and UTF-32 BE/internal - multiarch s390 version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ Copyright (C) 2017 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 |
+#include <sysdeps/s390/utf16-utf32-z9.c>
|
|
|
147e83 |
+#include <ifunc-resolve.h>
|
|
|
147e83 |
+
|
|
|
147e83 |
+#undef FROM_LOOP
|
|
|
147e83 |
+#define FROM_LOOP __from_utf16_loop
|
|
|
147e83 |
+#undef TO_LOOP
|
|
|
147e83 |
+#define TO_LOOP __to_utf16_loop
|
|
|
147e83 |
+
|
|
|
147e83 |
+#define _SINGLE_NAME(NAME) NAME##_single
|
|
|
147e83 |
+#define SINGLE_NAME(NAME) _SINGLE_NAME(NAME)
|
|
|
147e83 |
+strong_alias (SINGLE_NAME (FROM_LOOP_DEFAULT), SINGLE_NAME (FROM_LOOP))
|
|
|
147e83 |
+strong_alias (SINGLE_NAME (TO_LOOP_DEFAULT), SINGLE_NAME (TO_LOOP))
|
|
|
147e83 |
+
|
|
|
147e83 |
+/* Generate ifunc'ed loop functions for FROM/TO_LOOP. */
|
|
|
147e83 |
+s390_libc_ifunc_expr (FROM_LOOP_DEFAULT, FROM_LOOP,
|
|
|
147e83 |
+ (HAVE_FROM_VX && (hwcap & HWCAP_S390_VX))
|
|
|
147e83 |
+ ? FROM_LOOP_VX
|
|
|
147e83 |
+ : FROM_LOOP_DEFAULT);
|
|
|
147e83 |
+
|
|
|
147e83 |
+s390_libc_ifunc_expr (TO_LOOP_DEFAULT, TO_LOOP,
|
|
|
147e83 |
+ (HAVE_TO_VX && (hwcap & HWCAP_S390_VX))
|
|
|
147e83 |
+ ? TO_LOOP_VX
|
|
|
147e83 |
+ : TO_LOOP_DEFAULT);
|
|
|
147e83 |
+
|
|
|
147e83 |
+#include <iconv/skeleton.c>
|
|
|
147e83 |
diff --git a/sysdeps/s390/utf16-utf32-z9.c b/sysdeps/s390/utf16-utf32-z9.c
|
|
|
147e83 |
index 5d2ac44..5a39d5d 100644
|
|
|
147e83 |
--- a/sysdeps/s390/utf16-utf32-z9.c
|
|
|
147e83 |
+++ b/sysdeps/s390/utf16-utf32-z9.c
|
|
|
147e83 |
@@ -27,8 +27,23 @@
|
|
|
147e83 |
#include <dlfcn.h>
|
|
|
147e83 |
#include <stdint.h>
|
|
|
147e83 |
#include <unistd.h>
|
|
|
147e83 |
-#include <dl-procinfo.h>
|
|
|
147e83 |
#include <gconv.h>
|
|
|
147e83 |
+#include <string.h>
|
|
|
147e83 |
+
|
|
|
147e83 |
+/* Select which versions should be defined depending on support
|
|
|
147e83 |
+ for multiarch, vector and used minimum architecture level. */
|
|
|
147e83 |
+#define HAVE_FROM_C 1
|
|
|
147e83 |
+#define FROM_LOOP_DEFAULT FROM_LOOP_C
|
|
|
147e83 |
+#define HAVE_TO_C 1
|
|
|
147e83 |
+#define TO_LOOP_DEFAULT TO_LOOP_C
|
|
|
147e83 |
+
|
|
|
147e83 |
+#if defined HAVE_S390_VX_ASM_SUPPORT && defined USE_MULTIARCH
|
|
|
147e83 |
+# define HAVE_FROM_VX 1
|
|
|
147e83 |
+# define HAVE_TO_VX 1
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+# define HAVE_FROM_VX 0
|
|
|
147e83 |
+# define HAVE_TO_VX 0
|
|
|
147e83 |
+#endif
|
|
|
147e83 |
|
|
|
147e83 |
#if defined HAVE_S390_VX_GCC_SUPPORT
|
|
|
147e83 |
# define ASM_CLOBBER_VR(NR) , NR
|
|
|
147e83 |
@@ -53,8 +68,8 @@
|
|
|
147e83 |
#define MIN_NEEDED_FROM 2
|
|
|
147e83 |
#define MAX_NEEDED_FROM 4
|
|
|
147e83 |
#define MIN_NEEDED_TO 4
|
|
|
147e83 |
-#define FROM_LOOP __from_utf16_loop
|
|
|
147e83 |
-#define TO_LOOP __to_utf16_loop
|
|
|
147e83 |
+#define FROM_LOOP FROM_LOOP_DEFAULT
|
|
|
147e83 |
+#define TO_LOOP TO_LOOP_DEFAULT
|
|
|
147e83 |
#define FROM_DIRECTION (dir == from_utf16)
|
|
|
147e83 |
#define ONE_DIRECTION 0
|
|
|
147e83 |
|
|
|
147e83 |
@@ -174,9 +189,10 @@ gconv_end (struct __gconv_step *data)
|
|
|
147e83 |
|
|
|
147e83 |
/* Conversion function from UTF-16 to UTF-32 internal/BE. */
|
|
|
147e83 |
|
|
|
147e83 |
+#if HAVE_FROM_C == 1
|
|
|
147e83 |
/* The software routine is copied from utf-16.c (minus bytes
|
|
|
147e83 |
swapping). */
|
|
|
147e83 |
-#define BODY_FROM_C \
|
|
|
147e83 |
+# define BODY_FROM_C \
|
|
|
147e83 |
{ \
|
|
|
147e83 |
uint16_t u1 = get16 (inptr); \
|
|
|
147e83 |
\
|
|
|
147e83 |
@@ -220,7 +236,22 @@ gconv_end (struct __gconv_step *data)
|
|
|
147e83 |
outptr += 4; \
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
-#define BODY_FROM_VX \
|
|
|
147e83 |
+
|
|
|
147e83 |
+/* Generate loop-function with software routing. */
|
|
|
147e83 |
+# define MIN_NEEDED_INPUT MIN_NEEDED_FROM
|
|
|
147e83 |
+# define MAX_NEEDED_INPUT MAX_NEEDED_FROM
|
|
|
147e83 |
+# define MIN_NEEDED_OUTPUT MIN_NEEDED_TO
|
|
|
147e83 |
+# define FROM_LOOP_C __from_utf16_loop_c
|
|
|
147e83 |
+# define LOOPFCT FROM_LOOP_C
|
|
|
147e83 |
+# define LOOP_NEED_FLAGS
|
|
|
147e83 |
+# define BODY BODY_FROM_C
|
|
|
147e83 |
+# include <iconv/loop.c>
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+# define FROM_LOOP_C NULL
|
|
|
147e83 |
+#endif /* HAVE_FROM_C != 1 */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#if HAVE_FROM_VX == 1
|
|
|
147e83 |
+# define BODY_FROM_VX \
|
|
|
147e83 |
{ \
|
|
|
147e83 |
size_t inlen = inend - inptr; \
|
|
|
147e83 |
size_t outlen = outend - outptr; \
|
|
|
147e83 |
@@ -255,7 +286,7 @@ gconv_end (struct __gconv_step *data)
|
|
|
147e83 |
/* Setup to check for ch >= 0xd800 && ch <= 0xdfff. (v30, v31) */ \
|
|
|
147e83 |
"9: .short 0xd800,0xdfff,0x0,0x0,0x0,0x0,0x0,0x0\n\t" \
|
|
|
147e83 |
" .short 0xa000,0xc000,0x0,0x0,0x0,0x0,0x0,0x0\n\t" \
|
|
|
147e83 |
- /* At least on uint16_t is in range of surrogates. \
|
|
|
147e83 |
+ /* At least one uint16_t is in range of surrogates. \
|
|
|
147e83 |
Store the preceding chars. */ \
|
|
|
147e83 |
"10: vlgvb %[R_TMP],%%v19,7\n\t" \
|
|
|
147e83 |
" vuplhh %%v17,%%v16\n\t" \
|
|
|
147e83 |
@@ -351,52 +382,26 @@ gconv_end (struct __gconv_step *data)
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
|
|
|
147e83 |
-/* Generate loop-function with software routing. */
|
|
|
147e83 |
-#define MIN_NEEDED_INPUT MIN_NEEDED_FROM
|
|
|
147e83 |
-#define MAX_NEEDED_INPUT MAX_NEEDED_FROM
|
|
|
147e83 |
-#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO
|
|
|
147e83 |
-#if defined HAVE_S390_VX_ASM_SUPPORT
|
|
|
147e83 |
-# define LOOPFCT __from_utf16_loop_c
|
|
|
147e83 |
-# define LOOP_NEED_FLAGS
|
|
|
147e83 |
-# define BODY BODY_FROM_C
|
|
|
147e83 |
-# include <iconv/loop.c>
|
|
|
147e83 |
-
|
|
|
147e83 |
/* Generate loop-function with hardware vector instructions. */
|
|
|
147e83 |
# define MIN_NEEDED_INPUT MIN_NEEDED_FROM
|
|
|
147e83 |
# define MAX_NEEDED_INPUT MAX_NEEDED_FROM
|
|
|
147e83 |
# define MIN_NEEDED_OUTPUT MIN_NEEDED_TO
|
|
|
147e83 |
-# define LOOPFCT __from_utf16_loop_vx
|
|
|
147e83 |
+# define FROM_LOOP_VX __from_utf16_loop_vx
|
|
|
147e83 |
+# define LOOPFCT FROM_LOOP_VX
|
|
|
147e83 |
# define LOOP_NEED_FLAGS
|
|
|
147e83 |
# define BODY BODY_FROM_VX
|
|
|
147e83 |
# include <iconv/loop.c>
|
|
|
147e83 |
-
|
|
|
147e83 |
-/* Generate ifunc'ed loop function. */
|
|
|
147e83 |
-__typeof(__from_utf16_loop_c)
|
|
|
147e83 |
-__attribute__ ((ifunc ("__from_utf16_loop_resolver")))
|
|
|
147e83 |
-__from_utf16_loop;
|
|
|
147e83 |
-
|
|
|
147e83 |
-static void *
|
|
|
147e83 |
-__from_utf16_loop_resolver (unsigned long int dl_hwcap)
|
|
|
147e83 |
-{
|
|
|
147e83 |
- if (dl_hwcap & HWCAP_S390_VX)
|
|
|
147e83 |
- return __from_utf16_loop_vx;
|
|
|
147e83 |
- else
|
|
|
147e83 |
- return __from_utf16_loop_c;
|
|
|
147e83 |
-}
|
|
|
147e83 |
-
|
|
|
147e83 |
-strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
|
|
|
147e83 |
#else
|
|
|
147e83 |
-# define LOOPFCT FROM_LOOP
|
|
|
147e83 |
-# define LOOP_NEED_FLAGS
|
|
|
147e83 |
-# define BODY BODY_FROM_C
|
|
|
147e83 |
-# include <iconv/loop.c>
|
|
|
147e83 |
-#endif
|
|
|
147e83 |
+# define FROM_LOOP_VX NULL
|
|
|
147e83 |
+#endif /* HAVE_FROM_VX != 1 */
|
|
|
147e83 |
+
|
|
|
147e83 |
|
|
|
147e83 |
/* Conversion from UTF-32 internal/BE to UTF-16. */
|
|
|
147e83 |
|
|
|
147e83 |
+#if HAVE_TO_C == 1
|
|
|
147e83 |
/* The software routine is copied from utf-16.c (minus bytes
|
|
|
147e83 |
swapping). */
|
|
|
147e83 |
-#define BODY_TO_C \
|
|
|
147e83 |
+# define BODY_TO_C \
|
|
|
147e83 |
{ \
|
|
|
147e83 |
uint32_t c = get32 (inptr); \
|
|
|
147e83 |
\
|
|
|
147e83 |
@@ -439,7 +444,21 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
|
|
|
147e83 |
inptr += 4; \
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
-#define BODY_TO_VX \
|
|
|
147e83 |
+/* Generate loop-function with software routing. */
|
|
|
147e83 |
+# define MIN_NEEDED_INPUT MIN_NEEDED_TO
|
|
|
147e83 |
+# define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
|
|
|
147e83 |
+# define MAX_NEEDED_OUTPUT MAX_NEEDED_FROM
|
|
|
147e83 |
+# define TO_LOOP_C __to_utf16_loop_c
|
|
|
147e83 |
+# define LOOPFCT TO_LOOP_C
|
|
|
147e83 |
+# define LOOP_NEED_FLAGS
|
|
|
147e83 |
+# define BODY BODY_TO_C
|
|
|
147e83 |
+# include <iconv/loop.c>
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+# define TO_LOOP_C NULL
|
|
|
147e83 |
+#endif /* HAVE_TO_C != 1 */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#if HAVE_TO_VX == 1
|
|
|
147e83 |
+# define BODY_TO_VX \
|
|
|
147e83 |
{ \
|
|
|
147e83 |
size_t inlen = inend - inptr; \
|
|
|
147e83 |
size_t outlen = outend - outptr; \
|
|
|
147e83 |
@@ -563,43 +582,22 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
|
|
|
147e83 |
STANDARD_TO_LOOP_ERR_HANDLER (4); \
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
-/* Generate loop-function with software routing. */
|
|
|
147e83 |
-#define MIN_NEEDED_INPUT MIN_NEEDED_TO
|
|
|
147e83 |
-#define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
|
|
|
147e83 |
-#define MAX_NEEDED_OUTPUT MAX_NEEDED_FROM
|
|
|
147e83 |
-#define LOOPFCT __to_utf16_loop_c
|
|
|
147e83 |
-#define LOOP_NEED_FLAGS
|
|
|
147e83 |
-#define BODY BODY_TO_C
|
|
|
147e83 |
-#include <iconv/loop.c>
|
|
|
147e83 |
-
|
|
|
147e83 |
-#if defined HAVE_S390_VX_ASM_SUPPORT
|
|
|
147e83 |
/* Generate loop-function with hardware vector instructions. */
|
|
|
147e83 |
# define MIN_NEEDED_INPUT MIN_NEEDED_TO
|
|
|
147e83 |
# define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
|
|
|
147e83 |
# define MAX_NEEDED_OUTPUT MAX_NEEDED_FROM
|
|
|
147e83 |
-# define LOOPFCT __to_utf16_loop_vx
|
|
|
147e83 |
+# define TO_LOOP_VX __to_utf16_loop_vx
|
|
|
147e83 |
+# define LOOPFCT TO_LOOP_VX
|
|
|
147e83 |
# define LOOP_NEED_FLAGS
|
|
|
147e83 |
# define BODY BODY_TO_VX
|
|
|
147e83 |
# include <iconv/loop.c>
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+# define TO_LOOP_VX NULL
|
|
|
147e83 |
+#endif /* HAVE_TO_VX != 1 */
|
|
|
147e83 |
+
|
|
|
147e83 |
+/* This file also exists in sysdeps/s390/multiarch/ which
|
|
|
147e83 |
+ generates ifunc resolvers for FROM/TO_LOOP functions
|
|
|
147e83 |
+ and includes iconv/skeleton.c afterwards. */
|
|
|
147e83 |
+#if ! defined USE_MULTIARCH
|
|
|
147e83 |
+# include <iconv/skeleton.c>
|
|
|
147e83 |
#endif
|
|
|
147e83 |
-
|
|
|
147e83 |
-/* Generate ifunc'ed loop function. */
|
|
|
147e83 |
-__typeof(__to_utf16_loop_c)
|
|
|
147e83 |
-__attribute__ ((ifunc ("__to_utf16_loop_resolver")))
|
|
|
147e83 |
-__to_utf16_loop;
|
|
|
147e83 |
-
|
|
|
147e83 |
-static void *
|
|
|
147e83 |
-__to_utf16_loop_resolver (unsigned long int dl_hwcap)
|
|
|
147e83 |
-{
|
|
|
147e83 |
-#if defined HAVE_S390_VX_ASM_SUPPORT
|
|
|
147e83 |
- if (dl_hwcap & HWCAP_S390_VX)
|
|
|
147e83 |
- return __to_utf16_loop_vx;
|
|
|
147e83 |
- else
|
|
|
147e83 |
-#endif
|
|
|
147e83 |
- return __to_utf16_loop_c;
|
|
|
147e83 |
-}
|
|
|
147e83 |
-
|
|
|
147e83 |
-strong_alias (__to_utf16_loop_c_single, __to_utf16_loop_single)
|
|
|
147e83 |
-
|
|
|
147e83 |
-
|
|
|
147e83 |
-#include <iconv/skeleton.c>
|
|
|
147e83 |
--
|
|
|
147e83 |
1.8.3.1
|
|
|
147e83 |
|