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