This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] S/390: UTF conversion modules - use .insn to avoid 'as'errors


Hi,

the attached patch fixes the problem mentioned by Aurelien in:
http://sources.redhat.com/ml/libc-alpha/2011-03/msg00000.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.

Bye,

-Andreas-


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.

Index: glibc/sysdeps/s390/s390-64/utf16-utf32-z9.c
===================================================================
--- glibc.orig/sysdeps/s390/s390-64/utf16-utf32-z9.c
+++ glibc/sysdeps/s390/s390-64/utf16-utf32-z9.c
@@ -208,7 +208,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				\
@@ -278,7 +279,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)						\
 	  {								\
Index: glibc/sysdeps/s390/s390-64/utf8-utf16-z9.c
===================================================================
--- glibc.orig/sysdeps/s390/s390-64/utf8-utf16-z9.c
+++ glibc/sysdeps/s390/s390-64/utf8-utf16-z9.c
@@ -186,7 +186,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)						\
 	  {								\
@@ -194,7 +195,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;			\
@@ -350,7 +351,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				\
Index: glibc/sysdeps/s390/s390-64/utf8-utf32-z9.c
===================================================================
--- glibc.orig/sysdeps/s390/s390-64/utf8-utf32-z9.c
+++ glibc/sysdeps/s390/s390-64/utf8-utf32-z9.c
@@ -190,7 +190,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)						\
 	  {								\
@@ -417,7 +418,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)					\
 	  {							\


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]