S390: Optimize utf8-utf16 module

System Internals / glibc - Stefan Liebler [linux.vnet.ibm.com] - 25 May 2016 10:18 UTC

This patch reworks the s390 specific module to convert between utf8 and utf16. Now ifunc is used to choose either the c or etf3eh (with convert utf instruction)
variants at runtime. Furthermore a new vector variant for z13 is introduced which will be build and chosen if vector support is available at build / runtime.

In case of converting utf 8 to utf16, the vector variant optimizes input of 1byte utf8 characters. The convert utf instruction is used if a multibyte utf8 character is found.

For the other direction utf16 to utf8, the cu21 instruction can't be re-enabled, because it does not report an error, if the input-stream consists of a single low surrogate utf16 char (e.g. 0xdc00). This applies to the newest z13, too. Thus there is only the c or the new vector variant, which can handle 1..4 byte utf8 characters.

The c variant from utf16 to utf8 has beed fixed. If a high surrogate was at the end of the input-buffer, then errno was set to EINVAL and the input-pointer pointed just after the high surrogate. Now it points to the beginning of the high surrogate.

This patch also fixes some whitespace errors. The c variant from utf8 to utf16 is now checking that tail-bytes starts with 0b10... and the value is not in range of an utf16 surrogate.

Furthermore, the etf3eh variants are handling the "UTF-xx//IGNORE" case now. Before they ignored the ignore-case and always stopped at an error.

ChangeLog:

- sysdeps/s390/s390-64/utf8-utf16-z9.c: Use ifunc to select c, etf3eh or new vector loop-variant.

5bd11b1 S390: Optimize utf8-utf16 module.
ChangeLog | 5 +
sysdeps/s390/s390-64/utf8-utf16-z9.c | 547 +++++++++++++++++++++++++++-------
2 files changed, 446 insertions(+), 106 deletions(-)

Upstream: sourceware.org


  • Share