arrfab / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh1380680-2.patch

147e83
From 29f8926b153d59ba18f67ce5445dce66bacc0cbf Mon Sep 17 00:00:00 2001
147e83
From: Stefan Liebler <stli@linux.vnet.ibm.com>
147e83
Date: Mon, 7 Nov 2016 15:25:04 +0100
147e83
Subject: [PATCH 02/17] S390: Configure check for vector support in gcc.
147e83
147e83
Upstream commit 9b7f05599a92dead97d6683bc838a57bc63ac52b
147e83
147e83
The S390 specific test checks if the gcc has support for vector registers
147e83
by compiling an inline assembly which clobbers vector registers.
147e83
On success the macro HAVE_S390_VX_GCC_SUPPORT is defined.
147e83
This macro can be used to determine if e.g. clobbering vector registers
147e83
is allowed or not.
147e83
147e83
ChangeLog:
147e83
147e83
	* config.h.in (HAVE_S390_VX_GCC_SUPPORT): New macro undefine.
147e83
	* sysdeps/s390/configure.in: Add test for S390 vector register
147e83
	support in gcc.
147e83
	* sysdeps/s390/configure: Regenerated.
147e83
---
147e83
 config.h.in               |  4 ++++
147e83
 sysdeps/s390/configure    | 33 +++++++++++++++++++++++++++++++++
147e83
 sysdeps/s390/configure.in | 22 ++++++++++++++++++++++
147e83
 3 files changed, 59 insertions(+)
147e83
147e83
diff --git a/config.h.in b/config.h.in
147e83
index f7f2388..62e04c7 100644
147e83
--- a/config.h.in
147e83
+++ b/config.h.in
147e83
@@ -113,6 +113,10 @@
147e83
 /* Define if assembler supports vector instructions on S390.  */
147e83
 #undef  HAVE_S390_VX_ASM_SUPPORT
147e83
 
147e83
+/* Define if gcc supports vector registers as clobbers in inline assembly
147e83
+   on S390.  */
147e83
+#undef  HAVE_S390_VX_GCC_SUPPORT
147e83
+
147e83
 /* Define if gcc supports FMA4.  */
147e83
 #undef	HAVE_FMA4_SUPPORT
147e83
 
147e83
diff --git a/sysdeps/s390/configure b/sysdeps/s390/configure
147e83
index cc4c1e0..eb49a4c 100644
147e83
--- a/sysdeps/s390/configure
147e83
+++ b/sysdeps/s390/configure
147e83
@@ -42,3 +42,36 @@ else
147e83
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Use binutils with vector-support in order to use optimized implementations." >&5
147e83
 $as_echo "$as_me: WARNING: Use binutils with vector-support in order to use optimized implementations." >&2;}
147e83
 fi
147e83
+
147e83
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for S390 vector support in gcc" >&5
147e83
+$as_echo_n "checking for S390 vector support in gcc... " >&6; }
147e83
+if ${libc_cv_gcc_s390_vx+:} false; then :
147e83
+  $as_echo_n "(cached) " >&6
147e83
+else
147e83
+  cat > conftest.c <<\EOF
147e83
+void testvecclobber ()
147e83
+{
147e83
+  __asm__ ("" : : : "v16");
147e83
+}
147e83
+EOF
147e83
+if { ac_try='${CC-cc} --shared conftest.c -o conftest.o &> /dev/null'
147e83
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
147e83
+  (eval $ac_try) 2>&5
147e83
+  ac_status=$?
147e83
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
147e83
+  test $ac_status = 0; }; } ;
147e83
+then
147e83
+  libc_cv_gcc_s390_vx=yes
147e83
+else
147e83
+  libc_cv_gcc_s390_vx=no
147e83
+fi
147e83
+rm -f conftest*
147e83
+fi
147e83
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_s390_vx" >&5
147e83
+$as_echo "$libc_cv_gcc_s390_vx" >&6; }
147e83
+
147e83
+if test "$libc_cv_gcc_s390_vx" = yes ;
147e83
+then
147e83
+  $as_echo "#define HAVE_S390_VX_GCC_SUPPORT 1" >>confdefs.h
147e83
+
147e83
+fi
147e83
diff --git a/sysdeps/s390/configure.in b/sysdeps/s390/configure.in
147e83
index 733e356..a3b1f25 100644
147e83
--- a/sysdeps/s390/configure.in
147e83
+++ b/sysdeps/s390/configure.in
147e83
@@ -31,3 +31,25 @@ then
147e83
 else
147e83
   AC_MSG_WARN([Use binutils with vector-support in order to use optimized implementations.])
147e83
 fi
147e83
+
147e83
+AC_CACHE_CHECK(for S390 vector support in gcc, libc_cv_gcc_s390_vx, [dnl
147e83
+cat > conftest.c <<\EOF
147e83
+void testvecclobber ()
147e83
+{
147e83
+  __asm__ ("" : : : "v16");
147e83
+}
147e83
+EOF
147e83
+dnl
147e83
+dnl test, if gcc supports S390 vector registers as clobber in inline assembly
147e83
+if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
147e83
+then
147e83
+  libc_cv_gcc_s390_vx=yes
147e83
+else
147e83
+  libc_cv_gcc_s390_vx=no
147e83
+fi
147e83
+rm -f conftest* ])
147e83
+
147e83
+if test "$libc_cv_gcc_s390_vx" = yes ;
147e83
+then
147e83
+  AC_DEFINE(HAVE_S390_VX_GCC_SUPPORT)
147e83
+fi
147e83
-- 
147e83
1.8.3.1
147e83