bdc76f
commit 12f0dcb8da2c7c74d673583ec3286c0354273f52
bdc76f
Author: Stefan Liebler <stli@linux.ibm.com>
bdc76f
Date:   Tue Dec 18 13:57:25 2018 +0100
bdc76f
bdc76f
    S390: Refactor gconv_simple ifunc handling.
bdc76f
    
bdc76f
    The ifunc handling for various __gconv_transform_* functions
bdc76f
    which are using IFUNC on s390x are adjusted in order to omit ifunc
bdc76f
    if the minimum architecture level already supports newer CPUs by default.
bdc76f
    Instead those functions are just an alias to the vector variants.
bdc76f
    
bdc76f
    Furthermore the ifunc-macro s390_libc_ifunc_expr is now used instead of
bdc76f
    s390_vx_libc_ifunc.
bdc76f
    
bdc76f
    ChangeLog:
bdc76f
    
bdc76f
            * sysdeps/s390/multiarch/gconv_simple.c (ICONV_VX_IFUNC):
bdc76f
            Define macro dependent on HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT.
bdc76f
bdc76f
diff --git a/sysdeps/s390/multiarch/gconv_simple.c b/sysdeps/s390/multiarch/gconv_simple.c
bdc76f
index aaa1ebf74acf4dde..078d992c13eb548c 100644
bdc76f
--- a/sysdeps/s390/multiarch/gconv_simple.c
bdc76f
+++ b/sysdeps/s390/multiarch/gconv_simple.c
bdc76f
@@ -27,17 +27,18 @@
bdc76f
 
bdc76f
 # define ICONV_C_NAME(NAME) __##NAME##_c
bdc76f
 # define ICONV_VX_NAME(NAME) __##NAME##_vx
bdc76f
-# define ICONV_VX_IFUNC(FUNC)						\
bdc76f
-  extern __typeof (ICONV_C_NAME (FUNC)) __##FUNC;			\
bdc76f
-  s390_vx_libc_ifunc (__##FUNC)						\
bdc76f
-  int FUNC (struct __gconv_step *step, struct __gconv_step_data *data,	\
bdc76f
-	    const unsigned char **inptrp, const unsigned char *inend,	\
bdc76f
-	    unsigned char **outbufstart, size_t *irreversible,		\
bdc76f
-	    int do_flush, int consume_incomplete)			\
bdc76f
-  {									\
bdc76f
-    return __##FUNC (step, data, inptrp, inend,outbufstart,		\
bdc76f
-		     irreversible, do_flush, consume_incomplete);	\
bdc76f
-  }
bdc76f
+# ifdef HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT
bdc76f
+/* We support z13 instructions by default -> Just use the vector variant.  */
bdc76f
+#  define ICONV_VX_IFUNC(FUNC) strong_alias (ICONV_VX_NAME (FUNC), FUNC)
bdc76f
+# else
bdc76f
+/* We have to use ifunc to determine if z13 instructions are supported.  */
bdc76f
+#  define ICONV_VX_IFUNC(FUNC)						\
bdc76f
+  s390_libc_ifunc_expr (ICONV_C_NAME (FUNC), FUNC,			\
bdc76f
+			(hwcap & HWCAP_S390_VX)				\
bdc76f
+			? ICONV_VX_NAME (FUNC)				\
bdc76f
+			: ICONV_C_NAME (FUNC)				\
bdc76f
+			)
bdc76f
+# endif
bdc76f
 # define ICONV_VX_SINGLE(NAME)						\
bdc76f
   static __typeof (NAME##_single) __##NAME##_vx_single __attribute__((alias(#NAME "_single")));
bdc76f