about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/s390/multiarch/gconv_simple.c23
2 files changed, 17 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index b7302b00d9..b2271e15c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-12-18  Stefan Liebler  <stli@linux.ibm.com>
 
+	* sysdeps/s390/multiarch/gconv_simple.c (ICONV_VX_IFUNC):
+	Define macro dependent on HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT.
+
+2018-12-18  Stefan Liebler  <stli@linux.ibm.com>
+
 	* sysdeps/s390/multiarch/Makefile
 	(sysdep_routines): Remove wmemcmp variants.
 	* sysdeps/s390/Makefile (sysdep_routines): Add wmemcmp variants.
diff --git a/sysdeps/s390/multiarch/gconv_simple.c b/sysdeps/s390/multiarch/gconv_simple.c
index aaa1ebf74a..078d992c13 100644
--- a/sysdeps/s390/multiarch/gconv_simple.c
+++ b/sysdeps/s390/multiarch/gconv_simple.c
@@ -27,17 +27,18 @@
 
 # define ICONV_C_NAME(NAME) __##NAME##_c
 # define ICONV_VX_NAME(NAME) __##NAME##_vx
-# define ICONV_VX_IFUNC(FUNC)						\
-  extern __typeof (ICONV_C_NAME (FUNC)) __##FUNC;			\
-  s390_vx_libc_ifunc (__##FUNC)						\
-  int FUNC (struct __gconv_step *step, struct __gconv_step_data *data,	\
-	    const unsigned char **inptrp, const unsigned char *inend,	\
-	    unsigned char **outbufstart, size_t *irreversible,		\
-	    int do_flush, int consume_incomplete)			\
-  {									\
-    return __##FUNC (step, data, inptrp, inend,outbufstart,		\
-		     irreversible, do_flush, consume_incomplete);	\
-  }
+# ifdef HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT
+/* We support z13 instructions by default -> Just use the vector variant.  */
+#  define ICONV_VX_IFUNC(FUNC) strong_alias (ICONV_VX_NAME (FUNC), FUNC)
+# else
+/* We have to use ifunc to determine if z13 instructions are supported.  */
+#  define ICONV_VX_IFUNC(FUNC)						\
+  s390_libc_ifunc_expr (ICONV_C_NAME (FUNC), FUNC,			\
+			(hwcap & HWCAP_S390_VX)				\
+			? ICONV_VX_NAME (FUNC)				\
+			: ICONV_C_NAME (FUNC)				\
+			)
+# endif
 # define ICONV_VX_SINGLE(NAME)						\
   static __typeof (NAME##_single) __##NAME##_vx_single __attribute__((alias(#NAME "_single")));