about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.vnet.ibm.com>2015-08-26 10:26:19 +0200
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2015-08-26 10:26:19 +0200
commitfd484e057dd4d2813182df08584a4c48d6f1dd7a (patch)
tree427e56a86a946d2f3e3dcaba23300e7f666c40b9
parent4f0a1cea34c05fb2acc16f1a2d291f53230eb4fb (diff)
downloadglibc-fd484e057dd4d2813182df08584a4c48d6f1dd7a.tar.gz
glibc-fd484e057dd4d2813182df08584a4c48d6f1dd7a.tar.xz
glibc-fd484e057dd4d2813182df08584a4c48d6f1dd7a.zip
S390: Ifunc resolver macro for vector instructions.
This patch introduces a s390 specific ifunc resolver macro for 32/64bit,
which chooses <func>_vx with vector instructions if HWCAP_S390_VX flag
in hwcaps is set or <func>_c if not.

ChangeLog:

	* sysdeps/s390/multiarch/ifunc-resolve.h (s390_vx_libc_ifunc,
	s390_vx_libc_ifunc2): New macro function.
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/s390/multiarch/ifunc-resolve.h19
2 files changed, 24 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 19d089acc8..9304378573 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2015-08-26  Stefan Liebler  <stli@linux.vnet.ibm.com>
 
+	* sysdeps/s390/multiarch/ifunc-resolve.h (s390_vx_libc_ifunc,
+	s390_vx_libc_ifunc2): New macro function.
+
+2015-08-26  Stefan Liebler  <stli@linux.vnet.ibm.com>
+
 	* config.h.in (HAVE_S390_VX_ASM_SUPPORT): New macro undefine.
 	* sysdeps/s390/configure.ac: Add test for S390 vector instruction
 	assembler support.
diff --git a/sysdeps/s390/multiarch/ifunc-resolve.h b/sysdeps/s390/multiarch/ifunc-resolve.h
index 491df68a61..e9fd90e26b 100644
--- a/sysdeps/s390/multiarch/ifunc-resolve.h
+++ b/sysdeps/s390/multiarch/ifunc-resolve.h
@@ -73,3 +73,22 @@
     else								\
       return &__##FUNC##_default;					\
   }
+
+#define s390_vx_libc_ifunc(FUNC)		\
+  s390_vx_libc_ifunc2(FUNC, FUNC)
+
+#define s390_vx_libc_ifunc2(RESOLVERFUNC, FUNC)				\
+  /* Make the declarations of the optimized functions hidden in order
+     to prevent GOT slots being generated for them.  */			\
+  extern __typeof (FUNC) RESOLVERFUNC##_vx attribute_hidden;		\
+  extern __typeof (FUNC) RESOLVERFUNC##_c attribute_hidden;		\
+  extern void *__resolve_##RESOLVERFUNC (unsigned long int) __asm__ (#FUNC); \
+									\
+  void *__resolve_##RESOLVERFUNC (unsigned long int dl_hwcap)		\
+  {									\
+    if (dl_hwcap & HWCAP_S390_VX)					\
+      return &RESOLVERFUNC##_vx;					\
+    else								\
+      return &RESOLVERFUNC##_c;						\
+  }									\
+ __asm__ (".type " #FUNC ", %gnu_indirect_function");