From: Stefan Liebler <stli@linux.vnet.ibm.com>
To: libc-alpha@sourceware.org
Subject: Re: [PATCH 12/14] S390: Fix utf32 to utf16 handling of low surrogates (disable cu42).
Date: Thu, 21 Apr 2016 15:30:00 -0000 [thread overview]
Message-ID: <nfapbe$1bi$10@ger.gmane.org> (raw)
In-Reply-To: <1456219278-5258-13-git-send-email-stli@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 10854 bytes --]
Here is an updated patch, where the labels in inline assemblies are
out-dented as suggested by Florian.
On 02/23/2016 10:21 AM, Stefan Liebler wrote:
> According to the latest Unicode standard, a conversion from/to UTF-xx has
> to report an error if the character value is in range of an utf16 surrogate
> (0xd800..0xdfff). See https://sourceware.org/ml/libc-help/2015-12/msg00015.html.
>
> Thus the cu42 instruction, which converts from utf32 to utf16, has to be
> disabled because it does not report an error in case of a value in range of
> a low surrogate (0xdc00..0xdfff). The etf3eh variant is removed and the c,
> vector variant is adjusted to handle the value in range of an utf16 low
> surrogate correctly.
>
> ChangeLog:
>
> * sysdeps/s390/utf16-utf32-z9.c: Disable cu42 instruction and report
> an error in case of a value in range of an utf16 low surrogate.
> ---
> sysdeps/s390/utf16-utf32-z9.c | 155 +++++++++++++++++-------------------------
> 1 file changed, 62 insertions(+), 93 deletions(-)
>
> diff --git a/sysdeps/s390/utf16-utf32-z9.c b/sysdeps/s390/utf16-utf32-z9.c
> index ecf06bd..70aa640 100644
> --- a/sysdeps/s390/utf16-utf32-z9.c
> +++ b/sysdeps/s390/utf16-utf32-z9.c
> @@ -145,42 +145,6 @@ gconv_end (struct __gconv_step *data)
> free (data->__data);
> }
>
> -/* The macro for the hardware loop. This is used for both
> - directions. */
> -#define HARDWARE_CONVERT(INSTRUCTION) \
> - { \
> - register const unsigned char* pInput __asm__ ("8") = inptr; \
> - register size_t inlen __asm__ ("9") = inend - inptr; \
> - register unsigned char* pOutput __asm__ ("10") = outptr; \
> - register size_t outlen __asm__("11") = outend - outptr; \
> - unsigned long cc = 0; \
> - \
> - __asm__ __volatile__ (".machine push \n\t" \
> - ".machine \"z9-109\" \n\t" \
> - ".machinemode \"zarch_nohighgprs\"\n\t" \
> - "0: " INSTRUCTION " \n\t" \
> - ".machine pop \n\t" \
> - " jo 0b \n\t" \
> - " ipm %2 \n" \
> - : "+a" (pOutput), "+a" (pInput), "+d" (cc), \
> - "+d" (outlen), "+d" (inlen) \
> - : \
> - : "cc", "memory"); \
> - \
> - inptr = pInput; \
> - outptr = pOutput; \
> - cc >>= 28; \
> - \
> - if (cc == 1) \
> - { \
> - result = __GCONV_FULL_OUTPUT; \
> - } \
> - else if (cc == 2) \
> - { \
> - result = __GCONV_ILLEGAL_INPUT; \
> - } \
> - }
> -
> #define PREPARE_LOOP \
> enum direction dir = ((struct utf16_data *) step->__data)->dir; \
> int emit_bom = ((struct utf16_data *) step->__data)->emit_bom; \
> @@ -310,7 +274,7 @@ gconv_end (struct __gconv_step *data)
> "slgr %[R_OUTLEN],%[R_TMP3]\n\t" \
> /* Calculate remaining uint16_t values in loaded vrs. */ \
> "12: lghi %[R_TMP2],16\n\t" \
> - "sgr %[R_TMP2],%[R_TMP]\n\t" \
> + "slgr %[R_TMP2],%[R_TMP]\n\t" \
> "srl %[R_TMP2],1\n\t" \
> "llh %[R_TMP],0(%[R_IN])\n\t" \
> "aghi %[R_OUTLEN],-4\n\t" \
> @@ -437,7 +401,7 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
> uint32_t c = get32 (inptr); \
> \
> if (__builtin_expect (c <= 0xd7ff, 1) \
> - || (c >=0xdc00 && c <= 0xffff)) \
> + || (c > 0xdfff && c <= 0xffff)) \
> { \
> /* Two UTF-16 chars. */ \
> put16 (outptr, c); \
> @@ -475,29 +439,10 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
> inptr += 4; \
> }
>
> -#define BODY_TO_ETF3EH \
> - { \
> - HARDWARE_CONVERT ("cu42 %0, %1"); \
> - \
> - if (__glibc_likely (inptr == inend) \
> - || result == __GCONV_FULL_OUTPUT) \
> - break; \
> - \
> - if (inptr + 4 > inend) \
> - { \
> - result = __GCONV_INCOMPLETE_INPUT; \
> - break; \
> - } \
> - \
> - STANDARD_TO_LOOP_ERR_HANDLER (4); \
> - }
> -
> #define BODY_TO_VX \
> { \
> - register const unsigned char* pInput asm ("8") = inptr; \
> - register size_t inlen asm ("9") = inend - inptr; \
> - register unsigned char* pOutput asm ("10") = outptr; \
> - register size_t outlen asm("11") = outend - outptr; \
> + size_t inlen = inend - inptr; \
> + size_t outlen = outend - outptr; \
> unsigned long tmp, tmp2, tmp3; \
> asm volatile (".machine push\n\t" \
> ".machine \"z13\"\n\t" \
> @@ -509,8 +454,8 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
> CONVERT_32BIT_SIZE_T ([R_OUTLEN]) \
> /* Loop which handles UTF-16 chars \
> ch < 0xd800 || (ch > 0xdfff && ch < 0x10000). */ \
> - "0: clgijl %[R_INLEN],32,20f\n\t" \
> - "clgijl %[R_OUTLEN],16,20f\n\t" \
> + "0: clgijl %[R_INLEN],32,2f\n\t" \
> + "clgijl %[R_OUTLEN],16,2f\n\t" \
> "1: vlm %%v16,%%v17,0(%[R_IN])\n\t" \
> "lghi %[R_TMP2],0\n\t" \
> /* Shorten to UTF-16. */ \
> @@ -526,9 +471,15 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
> "aghi %[R_INLEN],-32\n\t" \
> "aghi %[R_OUTLEN],-16\n\t" \
> "la %[R_OUT],16(%[R_OUT])\n\t" \
> - "clgijl %[R_INLEN],32,20f\n\t" \
> - "clgijl %[R_OUTLEN],16,20f\n\t" \
> + "clgijl %[R_INLEN],32,2f\n\t" \
> + "clgijl %[R_OUTLEN],16,2f\n\t" \
> "j 1b\n\t" \
> + /* Calculate remaining uint32_t values in inptr. */ \
> + "2:\n\t" \
> + "clgije %[R_INLEN],0,99f\n\t" \
> + "clgijl %[R_INLEN],4,92f\n\t" \
> + "srlg %[R_TMP2],%[R_INLEN],2\n\t" \
> + "j 20f\n\t" \
> /* Setup to check for ch >= 0xd800 && ch <= 0xdfff \
> and check for ch >= 0x10000. (v30, v31) */ \
> "9: .long 0xd800,0xdfff,0x10000,0x10000\n\t" \
> @@ -540,21 +491,59 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
> "agr %[R_TMP],%[R_TMP2]\n\t" \
> "srlg %[R_TMP3],%[R_TMP],1\n\t" /* Number of out bytes. */ \
> "ahik %[R_TMP2],%[R_TMP3],-1\n\t" /* Highest index to store. */ \
> - "jl 20f\n\t" \
> + "jl 12f\n\t" \
> "vstl %%v18,%[R_TMP2],0(%[R_OUT])\n\t" \
> /* Update pointers. */ \
> "la %[R_IN],0(%[R_TMP],%[R_IN])\n\t" \
> "slgr %[R_INLEN],%[R_TMP]\n\t" \
> "la %[R_OUT],0(%[R_TMP3],%[R_OUT])\n\t" \
> "slgr %[R_OUTLEN],%[R_TMP3]\n\t" \
> - /* Handles UTF16 surrogates with convert instruction. */ \
> - "20: cu42 %[R_OUT],%[R_IN]\n\t" \
> - "jo 0b\n\t" /* Try vector implemenation again. */ \
> - "lochil %[R_RES],%[RES_OUT_FULL]\n\t" /* cc == 1. */ \
> - "lochih %[R_RES],%[RES_IN_ILL]\n\t" /* cc == 2. */ \
> + /* Calculate remaining uint32_t values in vrs. */ \
> + "12: lghi %[R_TMP2],8\n\t" \
> + "srlg %[R_TMP3],%[R_TMP3],1\n\t" \
> + "slgr %[R_TMP2],%[R_TMP3]\n\t" \
> + /* Handle remaining UTF-32 characters. */ \
> + "20: l %[R_TMP],0(%[R_IN])\n\t" \
> + "aghi %[R_INLEN],-4\n\t" \
> + /* Test if ch is 2byte UTF-16 char. */ \
> + "clfi %[R_TMP],0xffff\n\t" \
> + "jh 21f\n\t" \
> + /* Handle 2 byte UTF16 char. */ \
> + "lgr %[R_TMP3],%[R_TMP]\n\t" \
> + "nilf %[R_TMP],0xf800\n\t" \
> + "clfi %[R_TMP],0xd800\n\t" \
> + "je 91f\n\t" /* Do not accept UTF-16 surrogates. */ \
> + "slgfi %[R_OUTLEN],2\n\t" \
> + "jl 90f \n\t" \
> + "sth %[R_TMP3],0(%[R_OUT])\n\t" \
> + "la %[R_IN],4(%[R_IN])\n\t" \
> + "la %[R_OUT],2(%[R_OUT])\n\t" \
> + "brctg %[R_TMP2],20b\n\t" \
> + "j 0b\n\t" /* Switch to vx-loop. */ \
> + /* Test if ch is 4byte UTF-16 char. */ \
> + "21: clfi %[R_TMP],0x10ffff\n\t" \
> + "jh 91f\n\t" /* ch > 0x10ffff is not allowed! */ \
> + /* Handle 4 byte UTF16 char. */ \
> + "slgfi %[R_OUTLEN],4\n\t" \
> + "jl 90f \n\t" \
> + "slfi %[R_TMP],0x10000\n\t" /* zabcd = uvwxy - 1. */ \
> + "llilf %[R_TMP3],0xd800dc00\n\t" \
> + "la %[R_IN],4(%[R_IN])\n\t" \
> + "risbgn %[R_TMP3],%[R_TMP],38,47,6\n\t" /* High surrogate. */ \
> + "risbgn %[R_TMP3],%[R_TMP],54,63,0\n\t" /* Low surrogate. */ \
> + "st %[R_TMP3],0(%[R_OUT])\n\t" \
> + "la %[R_OUT],4(%[R_OUT])\n\t" \
> + "brctg %[R_TMP2],20b\n\t" \
> + "j 0b\n\t" /* Switch to vx-loop. */ \
> + "92: lghi %[R_RES],%[RES_IN_FULL]\n\t" \
> + "j 99f\n\t" \
> + "91: lghi %[R_RES],%[RES_IN_ILL]\n\t" \
> + "j 99f\n\t" \
> + "90: lghi %[R_RES],%[RES_OUT_FULL]\n\t" \
> + "99:\n\t" \
> ".machine pop" \
> - : /* outputs */ [R_IN] "+a" (pInput) \
> - , [R_INLEN] "+d" (inlen), [R_OUT] "+a" (pOutput) \
> + : /* outputs */ [R_IN] "+a" (inptr) \
> + , [R_INLEN] "+d" (inlen), [R_OUT] "+a" (outptr) \
> , [R_OUTLEN] "+d" (outlen), [R_TMP] "=a" (tmp) \
> , [R_TMP2] "=d" (tmp2), [R_TMP3] "=a" (tmp3) \
> , [R_RES] "+d" (result) \
> @@ -567,17 +556,10 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
> ASM_CLOBBER_VR ("v18") ASM_CLOBBER_VR ("v19") \
> ASM_CLOBBER_VR ("v30") ASM_CLOBBER_VR ("v31") \
> ); \
> - inptr = pInput; \
> - outptr = pOutput; \
> - \
> if (__glibc_likely (inptr == inend) \
> - || result == __GCONV_FULL_OUTPUT) \
> + || result != __GCONV_ILLEGAL_INPUT) \
> break; \
> - if (inptr + 4 > inend) \
> - { \
> - result = __GCONV_INCOMPLETE_INPUT; \
> - break; \
> - } \
> + \
> STANDARD_TO_LOOP_ERR_HANDLER (4); \
> }
>
> @@ -590,15 +572,6 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
> #define BODY BODY_TO_C
> #include <iconv/loop.c>
>
> -/* Generate loop-function with hardware utf-convert instruction. */
> -#define MIN_NEEDED_INPUT MIN_NEEDED_TO
> -#define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
> -#define MAX_NEEDED_OUTPUT MAX_NEEDED_FROM
> -#define LOOPFCT __to_utf16_loop_etf3eh
> -#define LOOP_NEED_FLAGS
> -#define BODY BODY_TO_ETF3EH
> -#include <iconv/loop.c>
> -
> #if defined HAVE_S390_VX_ASM_SUPPORT
> /* Generate loop-function with hardware vector instructions. */
> # define MIN_NEEDED_INPUT MIN_NEEDED_TO
> @@ -623,10 +596,6 @@ __to_utf16_loop_resolver (unsigned long int dl_hwcap)
> return __to_utf16_loop_vx;
> else
> #endif
> - if (dl_hwcap & HWCAP_S390_ZARCH && dl_hwcap & HWCAP_S390_HIGH_GPRS
> - && dl_hwcap & HWCAP_S390_ETF3EH)
> - return __to_utf16_loop_etf3eh;
> - else
> return __to_utf16_loop_c;
> }
>
>
[-- Attachment #2: 0012-S390-Fix-utf32-to-utf16-handling-of-low-surrogates-d.patch --]
[-- Type: text/x-patch, Size: 10621 bytes --]
From 9af543d67eca5e22c79c590ff82a0d517c9fb3bf Mon Sep 17 00:00:00 2001
From: Stefan Liebler <stli@linux.vnet.ibm.com>
Date: Thu, 21 Apr 2016 12:42:49 +0200
Subject: [PATCH 12/14] S390: Fix utf32 to utf16 handling of low surrogates
(disable cu42).
According to the latest Unicode standard, a conversion from/to UTF-xx has
to report an error if the character value is in range of an utf16 surrogate
(0xd800..0xdfff). See https://sourceware.org/ml/libc-help/2015-12/msg00015.html.
Thus the cu42 instruction, which converts from utf32 to utf16, has to be
disabled because it does not report an error in case of a value in range of
a low surrogate (0xdc00..0xdfff). The etf3eh variant is removed and the c,
vector variant is adjusted to handle the value in range of an utf16 low
surrogate correctly.
ChangeLog:
* sysdeps/s390/utf16-utf32-z9.c: Disable cu42 instruction and report
an error in case of a value in range of an utf16 low surrogate.
---
sysdeps/s390/utf16-utf32-z9.c | 155 +++++++++++++++++-------------------------
1 file changed, 62 insertions(+), 93 deletions(-)
diff --git a/sysdeps/s390/utf16-utf32-z9.c b/sysdeps/s390/utf16-utf32-z9.c
index 8d42ab8..5d2ac44 100644
--- a/sysdeps/s390/utf16-utf32-z9.c
+++ b/sysdeps/s390/utf16-utf32-z9.c
@@ -145,42 +145,6 @@ gconv_end (struct __gconv_step *data)
free (data->__data);
}
-/* The macro for the hardware loop. This is used for both
- directions. */
-#define HARDWARE_CONVERT(INSTRUCTION) \
- { \
- register const unsigned char* pInput __asm__ ("8") = inptr; \
- register size_t inlen __asm__ ("9") = inend - inptr; \
- register unsigned char* pOutput __asm__ ("10") = outptr; \
- register size_t outlen __asm__("11") = outend - outptr; \
- unsigned long cc = 0; \
- \
- __asm__ __volatile__ (".machine push \n\t" \
- ".machine \"z9-109\" \n\t" \
- ".machinemode \"zarch_nohighgprs\"\n\t" \
- "0: " INSTRUCTION " \n\t" \
- ".machine pop \n\t" \
- " jo 0b \n\t" \
- " ipm %2 \n" \
- : "+a" (pOutput), "+a" (pInput), "+d" (cc), \
- "+d" (outlen), "+d" (inlen) \
- : \
- : "cc", "memory"); \
- \
- inptr = pInput; \
- outptr = pOutput; \
- cc >>= 28; \
- \
- if (cc == 1) \
- { \
- result = __GCONV_FULL_OUTPUT; \
- } \
- else if (cc == 2) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- } \
- }
-
#define PREPARE_LOOP \
enum direction dir = ((struct utf16_data *) step->__data)->dir; \
int emit_bom = ((struct utf16_data *) step->__data)->emit_bom; \
@@ -310,7 +274,7 @@ gconv_end (struct __gconv_step *data)
" slgr %[R_OUTLEN],%[R_TMP3]\n\t" \
/* Calculate remaining uint16_t values in loaded vrs. */ \
"12: lghi %[R_TMP2],16\n\t" \
- " sgr %[R_TMP2],%[R_TMP]\n\t" \
+ " slgr %[R_TMP2],%[R_TMP]\n\t" \
" srl %[R_TMP2],1\n\t" \
" llh %[R_TMP],0(%[R_IN])\n\t" \
" aghi %[R_OUTLEN],-4\n\t" \
@@ -437,7 +401,7 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
uint32_t c = get32 (inptr); \
\
if (__builtin_expect (c <= 0xd7ff, 1) \
- || (c >=0xdc00 && c <= 0xffff)) \
+ || (c > 0xdfff && c <= 0xffff)) \
{ \
/* Two UTF-16 chars. */ \
put16 (outptr, c); \
@@ -475,29 +439,10 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
inptr += 4; \
}
-#define BODY_TO_ETF3EH \
- { \
- HARDWARE_CONVERT ("cu42 %0, %1"); \
- \
- if (__glibc_likely (inptr == inend) \
- || result == __GCONV_FULL_OUTPUT) \
- break; \
- \
- if (inptr + 4 > inend) \
- { \
- result = __GCONV_INCOMPLETE_INPUT; \
- break; \
- } \
- \
- STANDARD_TO_LOOP_ERR_HANDLER (4); \
- }
-
#define BODY_TO_VX \
{ \
- register const unsigned char* pInput asm ("8") = inptr; \
- register size_t inlen asm ("9") = inend - inptr; \
- register unsigned char* pOutput asm ("10") = outptr; \
- register size_t outlen asm("11") = outend - outptr; \
+ size_t inlen = inend - inptr; \
+ size_t outlen = outend - outptr; \
unsigned long tmp, tmp2, tmp3; \
asm volatile (".machine push\n\t" \
".machine \"z13\"\n\t" \
@@ -509,8 +454,8 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
CONVERT_32BIT_SIZE_T ([R_OUTLEN]) \
/* Loop which handles UTF-16 chars \
ch < 0xd800 || (ch > 0xdfff && ch < 0x10000). */ \
- "0: clgijl %[R_INLEN],32,20f\n\t" \
- " clgijl %[R_OUTLEN],16,20f\n\t" \
+ "0: clgijl %[R_INLEN],32,2f\n\t" \
+ " clgijl %[R_OUTLEN],16,2f\n\t" \
"1: vlm %%v16,%%v17,0(%[R_IN])\n\t" \
" lghi %[R_TMP2],0\n\t" \
/* Shorten to UTF-16. */ \
@@ -526,9 +471,15 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
" aghi %[R_INLEN],-32\n\t" \
" aghi %[R_OUTLEN],-16\n\t" \
" la %[R_OUT],16(%[R_OUT])\n\t" \
- " clgijl %[R_INLEN],32,20f\n\t" \
- " clgijl %[R_OUTLEN],16,20f\n\t" \
+ " clgijl %[R_INLEN],32,2f\n\t" \
+ " clgijl %[R_OUTLEN],16,2f\n\t" \
" j 1b\n\t" \
+ /* Calculate remaining uint32_t values in inptr. */ \
+ "2: \n\t" \
+ " clgije %[R_INLEN],0,99f\n\t" \
+ " clgijl %[R_INLEN],4,92f\n\t" \
+ " srlg %[R_TMP2],%[R_INLEN],2\n\t" \
+ " j 20f\n\t" \
/* Setup to check for ch >= 0xd800 && ch <= 0xdfff \
and check for ch >= 0x10000. (v30, v31) */ \
"9: .long 0xd800,0xdfff,0x10000,0x10000\n\t" \
@@ -540,21 +491,59 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
" agr %[R_TMP],%[R_TMP2]\n\t" \
" srlg %[R_TMP3],%[R_TMP],1\n\t" /* Number of out bytes. */ \
" ahik %[R_TMP2],%[R_TMP3],-1\n\t" /* Highest index to store. */ \
- " jl 20f\n\t" \
+ " jl 12f\n\t" \
" vstl %%v18,%[R_TMP2],0(%[R_OUT])\n\t" \
/* Update pointers. */ \
" la %[R_IN],0(%[R_TMP],%[R_IN])\n\t" \
" slgr %[R_INLEN],%[R_TMP]\n\t" \
" la %[R_OUT],0(%[R_TMP3],%[R_OUT])\n\t" \
" slgr %[R_OUTLEN],%[R_TMP3]\n\t" \
- /* Handles UTF16 surrogates with convert instruction. */ \
- "20: cu42 %[R_OUT],%[R_IN]\n\t" \
- " jo 0b\n\t" /* Try vector implemenation again. */ \
- " lochil %[R_RES],%[RES_OUT_FULL]\n\t" /* cc == 1. */ \
- " lochih %[R_RES],%[RES_IN_ILL]\n\t" /* cc == 2. */ \
+ /* Calculate remaining uint32_t values in vrs. */ \
+ "12: lghi %[R_TMP2],8\n\t" \
+ " srlg %[R_TMP3],%[R_TMP3],1\n\t" \
+ " slgr %[R_TMP2],%[R_TMP3]\n\t" \
+ /* Handle remaining UTF-32 characters. */ \
+ "20: l %[R_TMP],0(%[R_IN])\n\t" \
+ " aghi %[R_INLEN],-4\n\t" \
+ /* Test if ch is 2byte UTF-16 char. */ \
+ " clfi %[R_TMP],0xffff\n\t" \
+ " jh 21f\n\t" \
+ /* Handle 2 byte UTF16 char. */ \
+ " lgr %[R_TMP3],%[R_TMP]\n\t" \
+ " nilf %[R_TMP],0xf800\n\t" \
+ " clfi %[R_TMP],0xd800\n\t" \
+ " je 91f\n\t" /* Do not accept UTF-16 surrogates. */ \
+ " slgfi %[R_OUTLEN],2\n\t" \
+ " jl 90f \n\t" \
+ " sth %[R_TMP3],0(%[R_OUT])\n\t" \
+ " la %[R_IN],4(%[R_IN])\n\t" \
+ " la %[R_OUT],2(%[R_OUT])\n\t" \
+ " brctg %[R_TMP2],20b\n\t" \
+ " j 0b\n\t" /* Switch to vx-loop. */ \
+ /* Test if ch is 4byte UTF-16 char. */ \
+ "21: clfi %[R_TMP],0x10ffff\n\t" \
+ " jh 91f\n\t" /* ch > 0x10ffff is not allowed! */ \
+ /* Handle 4 byte UTF16 char. */ \
+ " slgfi %[R_OUTLEN],4\n\t" \
+ " jl 90f \n\t" \
+ " slfi %[R_TMP],0x10000\n\t" /* zabcd = uvwxy - 1. */ \
+ " llilf %[R_TMP3],0xd800dc00\n\t" \
+ " la %[R_IN],4(%[R_IN])\n\t" \
+ " risbgn %[R_TMP3],%[R_TMP],38,47,6\n\t" /* High surrogate. */ \
+ " risbgn %[R_TMP3],%[R_TMP],54,63,0\n\t" /* Low surrogate. */ \
+ " st %[R_TMP3],0(%[R_OUT])\n\t" \
+ " la %[R_OUT],4(%[R_OUT])\n\t" \
+ " brctg %[R_TMP2],20b\n\t" \
+ " j 0b\n\t" /* Switch to vx-loop. */ \
+ "92: lghi %[R_RES],%[RES_IN_FULL]\n\t" \
+ " j 99f\n\t" \
+ "91: lghi %[R_RES],%[RES_IN_ILL]\n\t" \
+ " j 99f\n\t" \
+ "90: lghi %[R_RES],%[RES_OUT_FULL]\n\t" \
+ "99: \n\t" \
".machine pop" \
- : /* outputs */ [R_IN] "+a" (pInput) \
- , [R_INLEN] "+d" (inlen), [R_OUT] "+a" (pOutput) \
+ : /* outputs */ [R_IN] "+a" (inptr) \
+ , [R_INLEN] "+d" (inlen), [R_OUT] "+a" (outptr) \
, [R_OUTLEN] "+d" (outlen), [R_TMP] "=a" (tmp) \
, [R_TMP2] "=d" (tmp2), [R_TMP3] "=a" (tmp3) \
, [R_RES] "+d" (result) \
@@ -567,17 +556,10 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
ASM_CLOBBER_VR ("v18") ASM_CLOBBER_VR ("v19") \
ASM_CLOBBER_VR ("v30") ASM_CLOBBER_VR ("v31") \
); \
- inptr = pInput; \
- outptr = pOutput; \
- \
if (__glibc_likely (inptr == inend) \
- || result == __GCONV_FULL_OUTPUT) \
+ || result != __GCONV_ILLEGAL_INPUT) \
break; \
- if (inptr + 4 > inend) \
- { \
- result = __GCONV_INCOMPLETE_INPUT; \
- break; \
- } \
+ \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
}
@@ -590,15 +572,6 @@ strong_alias (__from_utf16_loop_c_single, __from_utf16_loop_single)
#define BODY BODY_TO_C
#include <iconv/loop.c>
-/* Generate loop-function with hardware utf-convert instruction. */
-#define MIN_NEEDED_INPUT MIN_NEEDED_TO
-#define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
-#define MAX_NEEDED_OUTPUT MAX_NEEDED_FROM
-#define LOOPFCT __to_utf16_loop_etf3eh
-#define LOOP_NEED_FLAGS
-#define BODY BODY_TO_ETF3EH
-#include <iconv/loop.c>
-
#if defined HAVE_S390_VX_ASM_SUPPORT
/* Generate loop-function with hardware vector instructions. */
# define MIN_NEEDED_INPUT MIN_NEEDED_TO
@@ -623,10 +596,6 @@ __to_utf16_loop_resolver (unsigned long int dl_hwcap)
return __to_utf16_loop_vx;
else
#endif
- if (dl_hwcap & HWCAP_S390_ZARCH && dl_hwcap & HWCAP_S390_HIGH_GPRS
- && dl_hwcap & HWCAP_S390_ETF3EH)
- return __to_utf16_loop_etf3eh;
- else
return __to_utf16_loop_c;
}
--
2.5.5
next prev parent reply other threads:[~2016-04-21 15:30 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 9:22 [PATCH 00/14] S390: Optimize iconv modules Stefan Liebler
2016-02-23 9:21 ` [PATCH 13/14] Fix ucs4le_internal_loop in error case Stefan Liebler
2016-02-23 17:42 ` Joseph Myers
2016-02-25 9:00 ` Stefan Liebler
2016-03-18 13:04 ` Stefan Liebler
2016-03-31 9:20 ` Stefan Liebler
2016-03-31 9:45 ` Andreas Schwab
2016-02-23 9:21 ` [PATCH 01/14] S390: Get rid of make warning: overriding recipe for target gconv-modules Stefan Liebler
2016-04-14 14:16 ` Stefan Liebler
2016-04-21 15:00 ` Stefan Liebler
2016-04-28 6:55 ` Stefan Liebler
2016-05-04 13:15 ` [PING] " Stefan Liebler
2016-05-04 13:40 ` Andreas Schwab
2016-05-09 14:33 ` Stefan Liebler
2016-05-18 15:28 ` Stefan Liebler
2016-05-24 15:02 ` Stefan Liebler
2016-05-25 15:29 ` [COMMITTED] " Stefan Liebler
2016-05-25 15:37 ` Joseph Myers
2016-05-25 15:58 ` Stefan Liebler
2016-05-25 16:32 ` Joseph Myers
2016-02-23 9:21 ` [PATCH 02/14] S390: Mention s390-specific gconv-modues before common ones Stefan Liebler
2016-04-15 10:27 ` Florian Weimer
2016-04-21 14:50 ` Stefan Liebler
2016-02-23 9:22 ` [PATCH 06/14] S390: Optimize iso-8859-1 to ibm037 iconv-module Stefan Liebler
2016-04-21 15:05 ` Stefan Liebler
2016-02-23 9:22 ` [PATCH 03/14] S390: Configure check for vector support in gcc Stefan Liebler
2016-02-23 9:22 ` [PATCH 12/14] S390: Fix utf32 to utf16 handling of low surrogates (disable cu42) Stefan Liebler
2016-04-21 15:30 ` Stefan Liebler [this message]
2016-02-23 9:22 ` [PATCH 08/14] S390: Optimize utf8-utf16 module Stefan Liebler
2016-04-21 15:20 ` Stefan Liebler
2016-02-23 9:22 ` [PATCH 11/14] S390: Fix utf32 to utf8 handling of low surrogates (disable cu41) Stefan Liebler
2016-04-21 15:25 ` Stefan Liebler
2016-02-23 9:22 ` [PATCH 05/14] S390: Optimize builtin iconv-modules Stefan Liebler
2016-03-18 12:58 ` Stefan Liebler
2016-04-21 14:51 ` Stefan Liebler
2016-02-23 9:22 ` [PATCH 04/14] S390: Optimize 8bit-generic iconv modules Stefan Liebler
2016-04-15 13:05 ` Florian Weimer
2016-04-21 15:35 ` Stefan Liebler
2016-02-23 9:22 ` [PATCH 07/14] S390: Optimize utf8-utf32 module Stefan Liebler
2016-04-21 15:15 ` Stefan Liebler
2016-02-23 9:22 ` [PATCH 09/14] S390: Optimize utf16-utf32 module Stefan Liebler
2016-04-21 14:55 ` Stefan Liebler
2016-02-23 9:23 ` [PATCH 10/14] S390: Use s390-64 specific ionv-modules on s390-32, too Stefan Liebler
2016-02-23 12:06 ` Stefan Liebler
2016-04-21 15:10 ` Stefan Liebler
2016-02-23 9:23 ` [PATCH 14/14] Fix UTF-16 surrogate handling Stefan Liebler
2016-02-23 17:57 ` Joseph Myers
2016-02-25 12:57 ` Stefan Liebler
2016-03-18 13:05 ` Stefan Liebler
2016-03-22 14:39 ` Stefan Liebler
2016-03-31 9:18 ` Stefan Liebler
2016-04-07 14:35 ` Stefan Liebler
2016-04-07 15:18 ` Andreas Schwab
2016-03-01 15:01 ` [PATCH 00/14] S390: Optimize iconv modules Stefan Liebler
2016-03-08 12:33 ` Stefan Liebler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='nfapbe$1bi$10@ger.gmane.org' \
--to=stli@linux.vnet.ibm.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).