This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] [s390x] Fix build of z9 iconv rountines on z900 with <binutils-2.23
- From: Mike Frysinger <vapier at gentoo dot org>
- To: libc-alpha at sourceware dot org
- Cc: Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- Date: Sun, 12 Aug 2012 01:35:20 -0400
- Subject: [PATCH] [s390x] Fix build of z9 iconv rountines on z900 with <binutils-2.23
- References: <20110318102022.GA5262@bart>
From: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
the attached patch fixes the problem mentioned by Aurelien in:
http://sourceware.org/ml/libc-alpha/2011-03/msg00000.html
http://sourceware.org/ml/libc-alpha/2011-03/msg00036.html
The UTF conversion modules detect at runtime whether the conversion
instructions can be used or not. So 'as' should not reject them when
building for a lower CPU level. On the other hand it should
nevertheless be possible to build the modules optimizing for a higher
CPU level without as rejecting new instructions. One way is to
introduce -march=all in 'as' in order to basically disable the
instruction checks. I've committed a patch to binutils introducing
-march=all so that it can be used in the future:
http://sourceware.org/ml/binutils/2011-03/msg00355.html
But we cannot use that option right now since it would bind glibc
build to upstream binutils. For now I don't see a way around
replacing the mnemonics with .insn .
Done with the attached patch. I've verified that the same binary code
is generated for the modules.
2011-03-18 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* sysdeps/s390/s390-64/utf16-utf32-z9.c: Replace UTF conversion
mnemonics with .insn.
* sysdeps/s390/s390-64/utf8-utf16-z9.c: Likewise.
* sysdeps/s390/s390-64/utf8-utf32-z9.c: Likewise.
---
Seems like this was never merged. Anyone mind if I do it?
sysdeps/s390/s390-64/utf16-utf32-z9.c | 6 ++++--
sysdeps/s390/s390-64/utf8-utf16-z9.c | 8 +++++---
sysdeps/s390/s390-64/utf8-utf32-z9.c | 6 ++++--
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/sysdeps/s390/s390-64/utf16-utf32-z9.c b/sysdeps/s390/s390-64/utf16-utf32-z9.c
index 9eaa1a5..91066fb 100644
--- a/sysdeps/s390/s390-64/utf16-utf32-z9.c
+++ b/sysdeps/s390/s390-64/utf16-utf32-z9.c
@@ -210,7 +210,8 @@ gconv_end (struct __gconv_step *data)
until this gets resolved. */ \
if (0) /* (GLRO (dl_hwcap) & HWCAP_S390_ETF3EH) */ \
{ \
- HARDWARE_CONVERT ("cu24 %0, %1, 1"); \
+ /* cu24 %0, %1, 1 */ \
+ HARDWARE_CONVERT (".insn rrf,0xb9b10000,%0,%1,1,0"); \
if (inptr != inend) \
{ \
/* Check if the third byte is \
@@ -280,7 +281,8 @@ gconv_end (struct __gconv_step *data)
{ \
if (GLRO (dl_hwcap) & HWCAP_S390_ETF3EH) \
{ \
- HARDWARE_CONVERT ("cu42 %0, %1"); \
+ /* cu42 %0, %1 */ \
+ HARDWARE_CONVERT (".insn rre,0xb9b30000,%0,%1"); \
\
if (inptr != inend) \
{ \
diff --git a/sysdeps/s390/s390-64/utf8-utf16-z9.c b/sysdeps/s390/s390-64/utf8-utf16-z9.c
index 9f59177..94d5b08 100644
--- a/sysdeps/s390/s390-64/utf8-utf16-z9.c
+++ b/sysdeps/s390/s390-64/utf8-utf16-z9.c
@@ -188,7 +188,8 @@ gconv_end (struct __gconv_step *data)
{ \
if (GLRO (dl_hwcap) & HWCAP_S390_ETF3EH) \
{ \
- HARDWARE_CONVERT ("cu12 %0, %1, 1"); \
+ /* cu12 %0, %1, 1 */ \
+ HARDWARE_CONVERT (".insn rrf,0xb2a70000,%0,%1,1,0"); \
\
if (inptr != inend) \
{ \
@@ -196,7 +197,7 @@ gconv_end (struct __gconv_step *data)
for (i = 1; inptr + i < inend; ++i) \
if ((inptr[i] & 0xc0) != 0x80) \
break; \
- \
+ \
if (__builtin_expect (inptr + i == inend, 1)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
@@ -352,7 +353,8 @@ gconv_end (struct __gconv_step *data)
until this gets resolved. */ \
if (0) /* (GLRO (dl_hwcap) & HWCAP_S390_ETF3EH) */ \
{ \
- HARDWARE_CONVERT ("cu21 %0, %1, 1"); \
+ /* cu21 %0, %1, 1 */ \
+ HARDWARE_CONVERT (".insn rrf,0xb2a60000,%0,%1,1,0"); \
if (inptr != inend) \
{ \
/* Check if the third byte is \
diff --git a/sysdeps/s390/s390-64/utf8-utf32-z9.c b/sysdeps/s390/s390-64/utf8-utf32-z9.c
index a807980..62eab74 100644
--- a/sysdeps/s390/s390-64/utf8-utf32-z9.c
+++ b/sysdeps/s390/s390-64/utf8-utf32-z9.c
@@ -192,7 +192,8 @@ gconv_end (struct __gconv_step *data)
{ \
if (GLRO (dl_hwcap) & HWCAP_S390_ETF3EH) \
{ \
- HARDWARE_CONVERT ("cu14 %0, %1, 1"); \
+ /* cu14 %0, %1, 1 */ \
+ HARDWARE_CONVERT (".insn rrf,0xb9b00000,%0,%1,1,0"); \
\
if (inptr != inend) \
{ \
@@ -419,7 +420,8 @@ gconv_end (struct __gconv_step *data)
{ \
if (GLRO (dl_hwcap) & HWCAP_S390_ETF3EH) \
{ \
- HARDWARE_CONVERT ("cu41 %0, %1"); \
+ /* cu41 %0, %1 */ \
+ HARDWARE_CONVERT (".insn rre,0xb9b20000,%0,%1"); \
\
if (inptr != inend) \
{ \
--
1.7.9.7