bca718
    Backport of the following patches:
bca718
    
bca718
    commit 4393fc119c34e97519b9b7a4fc94066b283be452
bca718
    Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
bca718
    Date:   Thu Feb 27 09:45:41 2014 -0600
bca718
    
bca718
        PowerPC: Optimized isinf/isinff for POWER8
bca718
    
bca718
        This patch add a optimized isinf/isinff implementation for POWER8
bca718
        using the new Move From VSR Doubleword instruction to gains some
bca718
        cycles from FP to GRP register move.
bca718
    
bca718
        ChangeLog:
bca718
    	2014-02-27  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
bca718
    
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Add isinf power8
bca718
    	implementation.
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S: New file:
bca718
    	POWER8 isinf ifunc implementation.
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c (__isinf): Add
bca718
    	POWER8 implementation.
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c (__isinff):
bca718
    	Likewise.
bca718
    	* sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: New file:
bca718
    	POWER8 isinf implementation.
bca718
    	* sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S: New file.
bca718
    
bca718
    commit cac626d60a863e48ab75417064984769e58c5719
bca718
    Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
bca718
    Date:   Thu Feb 27 09:46:46 2014 -0600
bca718
    
bca718
        PowerPC: Optimized finite/finitef for POWER8
bca718
    
bca718
        This patch add a optimized finite/finitef implementation for POWER8
bca718
        using the new Move From VSR Doubleword instruction to gains some
bca718
        cycles from FP to GRP register move.
bca718
    
bca718
        ChangeLog:
bca718
    	2014-02-27  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
bca718
    
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Add finite power8
bca718
    	implementation.
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S: New file:
bca718
    	POWER8 finite ifunc implementation.
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c (__finite): Add
bca718
    	POWER8 implementation.
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c (__finitef):
bca718
    	Likewise.
bca718
    	* sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: New file:
bca718
    	POWER8 finite implementation.
bca718
    	* sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S: New file.
bca718
    
bca718
    commit 1ad8950a3ea4056ed343d681b5146f4b4aa27e10
bca718
    Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
bca718
    Date:   Tue Feb 18 09:29:29 2014 -0500
bca718
    
bca718
        PowerPC: llrint/llrintf POWER8 optimization
bca718
    
bca718
        This patch add a optimized llrint/llrintf implementation for POWER8
bca718
        using the new Move From VSR Doubleword instruction to gains some
bca718
        cycles from FP to GRP register move.
bca718
    
bca718
        ChangeLog:
bca718
    	2014-02-27  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
bca718
    
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Add llrint power8
bca718
    	implementation.
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S: New file:
bca718
    	POWER8 llrint ifunc implementation.
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c (__lllrint): Add
bca718
    	POWER8 implementation.
bca718
    	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: New file:
bca718
    	POWER8 llrint implementation.
bca718
    
bca718
    commit fe13a20c37578f08ce393ccaeb45caeb48815ca5
bca718
    Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
bca718
    Date:   Mon Feb 17 10:44:08 2014 -0600
bca718
    
bca718
        PowerPC: llround/llroundf POWER8 optimization
bca718
    
bca718
        This patch add a optimized llround/llroundf implementation for POWER8
bca718
        using the new Move From VSR Doubleword instruction to gains some
bca718
        cycles from FP to GRP register move.
bca718
    
bca718
        ChangeLog:
bca718
    	2014-02-27  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
bca718
    
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Add llround power8
bca718
    	implementation.
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S: New file:
bca718
    	POWER8 llround ifunc implementation.
bca718
    	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c (__lllround): Add
bca718
    	POWER8 implementation.
bca718
    	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: New file:
bca718
    	POWER8 llround implementation.
bca718
    
bca718
    commit 757d9dd5c3efa56fac75965abc014faaae7b7895
bca718
    Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
bca718
    Date:   Mon Mar 31 08:00:38 2014 -0500
bca718
    
bca718
        PowerPC: Fix little endian enconding for mfvsrd
bca718
    
bca718
        This patch fixes the MFVSRD_R3_V1 macro that encodes 'mfvsrd  r3,vs1'
bca718
        (to support old binutils) for little endian.
bca718
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
bca718
index 4cd1c5d..3e2127b 100644
bca718
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
bca718
@@ -4,7 +4,8 @@ sysdep_routines += s_isnan-power7 s_isnan-power6x s_isnan-power6 \
bca718
                   s_copysign-ppc64 s_finite-power7 s_finite-ppc64 \
bca718
                   s_finitef-ppc64 s_isinff-ppc64 s_isinf-power7 \
bca718
                   s_isinf-ppc64 s_modf-power5+ s_modf-ppc64 \
bca718
-                  s_modff-power5+ s_modff-ppc64 s_isnan-power8
bca718
+                  s_modff-power5+ s_modff-ppc64 s_isnan-power8 \
bca718
+                  s_isinf-power8 s_finite-power8
bca718
 
bca718
 libm-sysdep_routines += s_isnan-power7 s_isnan-power6x s_isnan-power6 \
bca718
                        s_isnan-power5 s_isnan-ppc64 s_llround-power6x \
bca718
@@ -22,7 +23,8 @@ libm-sysdep_routines += s_isnan-power7 s_isnan-power6x s_isnan-power6 \
bca718
                        s_logbl-ppc64 s_modf-power5+ s_modf-ppc64 \
bca718
                        s_modff-power5+ s_modff-ppc64 e_hypot-ppc64 \
bca718
                        e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \
bca718
-                       s_isnan-power8
bca718
+                       s_isnan-power8 s_isinf-power8 s_finite-power8 \
bca718
+                       s_llrint-power8 s_llround-power8
bca718
 
bca718
 CFLAGS-s_logbf-power7.c = -mcpu=power7
bca718
 CFLAGS-s_logbl-power7.c = -mcpu=power7
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S
bca718
new file mode 100644
bca718
index 0000000..3b9071f
bca718
--- /dev/null
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S
bca718
@@ -0,0 +1,33 @@
bca718
+/* isnan().  PowerPC64/POWER7 version.
bca718
+   Copyright (C) 2014 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#include <sysdep.h>
bca718
+#include <math_ldbl_opt.h>
bca718
+
bca718
+#undef hidden_def
bca718
+#define hidden_def(name)
bca718
+#undef weak_alias
bca718
+#define weak_alias(name, alias)
bca718
+#undef strong_alias
bca718
+#define strong_alias(name, alias)
bca718
+#undef compat_symbol
bca718
+#define compat_symbol(lib, name, symbol, ver)
bca718
+
bca718
+#define __finite __finite_power8
bca718
+
bca718
+#include <sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S>
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
bca718
index f79a93e..b9e908d 100644
bca718
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
bca718
@@ -23,10 +23,13 @@
bca718
 
bca718
 extern __typeof (__finite) __finite_ppc64 attribute_hidden;
bca718
 extern __typeof (__finite) __finite_power7 attribute_hidden;
bca718
+extern __typeof (__finite) __finite_power8 attribute_hidden;
bca718
 
bca718
 libc_ifunc (__finite,
bca718
-	    (hwcap & PPC_FEATURE_ARCH_2_06)
bca718
-	    ? __finite_power7
bca718
+	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
bca718
+	    ? __finite_power8 :
bca718
+	      (hwcap & PPC_FEATURE_ARCH_2_06)
bca718
+	      ? __finite_power7
bca718
             : __finite_ppc64);
bca718
 
bca718
 weak_alias (__finite, finite)
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c
bca718
index a7243b5..30b34bc 100644
bca718
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c
bca718
@@ -23,10 +23,13 @@
bca718
 extern __typeof (__finitef) __finitef_ppc64 attribute_hidden;
bca718
 /* The double-precision version also works for single-precision.  */
bca718
 extern __typeof (__finitef) __finite_power7 attribute_hidden;
bca718
+extern __typeof (__finitef) __finite_power8 attribute_hidden;
bca718
 
bca718
 libc_ifunc (__finitef,
bca718
-	    (hwcap & PPC_FEATURE_ARCH_2_06)
bca718
-	    ? __finite_power7
bca718
+	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
bca718
+	    ? __finite_power8 :
bca718
+	      (hwcap & PPC_FEATURE_ARCH_2_06)
bca718
+	      ? __finite_power7
bca718
             : __finitef_ppc64);
bca718
 
bca718
 weak_alias (__finitef, finitef)
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S
bca718
new file mode 100644
bca718
index 0000000..979816e
bca718
--- /dev/null
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S
bca718
@@ -0,0 +1,33 @@
bca718
+/* isinf().  PowerPC64/POWER8 version.
bca718
+   Copyright (C) 2014 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#include <sysdep.h>
bca718
+#include <math_ldbl_opt.h>
bca718
+
bca718
+#undef hidden_def
bca718
+#define hidden_def(name)
bca718
+#undef weak_alias
bca718
+#define weak_alias(name, alias)
bca718
+#undef strong_alias
bca718
+#define strong_alias(name, alias)
bca718
+#undef compat_symbol
bca718
+#define compat_symbol(lib, name, alias, ver)
bca718
+
bca718
+#define __isinf __isinf_power8
bca718
+
bca718
+#include <sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S>
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
bca718
index 1ee230b..e349a06 100644
bca718
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
bca718
@@ -23,10 +23,13 @@
bca718
 
bca718
 extern __typeof (__isinf) __isinf_ppc64 attribute_hidden;
bca718
 extern __typeof (__isinf) __isinf_power7 attribute_hidden;
bca718
+extern __typeof (__isinf) __isinf_power8 attribute_hidden;
bca718
 
bca718
 libc_ifunc (__isinf,
bca718
-	    (hwcap & PPC_FEATURE_ARCH_2_06)
bca718
-	    ? __isinf_power7
bca718
+	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
bca718
+	    ? __isinf_power8 :
bca718
+	      (hwcap & PPC_FEATURE_ARCH_2_06)
bca718
+	      ? __isinf_power7
bca718
             : __isinf_ppc64);
bca718
 
bca718
 weak_alias (__isinf, isinf)
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c
bca718
index 1336feb..71da7a3 100644
bca718
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c
bca718
@@ -24,10 +24,13 @@
bca718
 extern __typeof (__isinff) __isinff_ppc64 attribute_hidden;
bca718
 /* The double-precision version also works for single-precision.  */
bca718
 extern __typeof (__isinff) __isinf_power7 attribute_hidden;
bca718
+extern __typeof (__isinff) __isinf_power8 attribute_hidden;
bca718
 
bca718
 libc_ifunc (__isinff,
bca718
-	    (hwcap & PPC_FEATURE_ARCH_2_06)
bca718
-	    ? __isinf_power7
bca718
+	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
bca718
+	    ? __isinf_power8 :
bca718
+	      (hwcap & PPC_FEATURE_ARCH_2_06)
bca718
+	      ? __isinf_power7
bca718
             : __isinff_ppc64);
bca718
 
bca718
 weak_alias (__isinff, isinff)
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S
bca718
new file mode 100644
bca718
index 0000000..3962b7d
bca718
--- /dev/null
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S
bca718
@@ -0,0 +1,31 @@
bca718
+/* Round double to long int.  PowerPC64/POWER6X default version.
bca718
+   Copyright (C) 2014 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#include <sysdep.h>
bca718
+#include <math_ldbl_opt.h>
bca718
+
bca718
+#undef weak_alias
bca718
+#define weak_alias(a,b)
bca718
+#undef strong_alias
bca718
+#define strong_alias(a,b)
bca718
+#undef compat_symbol
bca718
+#define compat_symbol(a,b,c,d)
bca718
+
bca718
+#define __llrint __llrint_power8
bca718
+
bca718
+#include <sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S>
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c
bca718
index 5818b53..cf1b2e4 100644
bca718
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c
bca718
@@ -30,10 +30,13 @@
bca718
 
bca718
 extern __typeof (__llrint) __llrint_ppc64 attribute_hidden;
bca718
 extern __typeof (__llrint) __llrint_power6x attribute_hidden;
bca718
+extern __typeof (__llrint) __llrint_power8 attribute_hidden;
bca718
 
bca718
 libc_ifunc (__llrint,
bca718
-	    (hwcap & PPC_FEATURE_POWER6_EXT)
bca718
-	    ? __llrint_power6x
bca718
+	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
bca718
+	    ? __llrint_power8 :
bca718
+	      (hwcap & PPC_FEATURE_POWER6_EXT)
bca718
+	      ? __llrint_power6x
bca718
             : __llrint_ppc64);
bca718
 
bca718
 weak_alias (__llrint, llrint)
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S
bca718
new file mode 100644
bca718
index 0000000..41c61a1
bca718
--- /dev/null
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S
bca718
@@ -0,0 +1,31 @@
bca718
+/* llround().  PowerPC64 default version.
bca718
+   Copyright (C) 2014 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#include <sysdep.h>
bca718
+#include <math_ldbl_opt.h>
bca718
+
bca718
+#undef weak_alias
bca718
+#define weak_alias(name, alias)
bca718
+#undef strong_alias
bca718
+#define strong_alias(name, alias)
bca718
+#undef compat_symbol
bca718
+#define compat_symbol(lib, name, alias, ver)
bca718
+
bca718
+#define __llround __llround_power8
bca718
+
bca718
+#include <sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S>
bca718
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c
bca718
index a4d1bf3..7dba17e 100644
bca718
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c
bca718
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c
bca718
@@ -27,12 +27,15 @@
bca718
 extern __typeof (__llround) __llround_ppc64 attribute_hidden;
bca718
 extern __typeof (__llround) __llround_power5plus attribute_hidden;
bca718
 extern __typeof (__llround) __llround_power6x attribute_hidden;
bca718
+extern __typeof (__llround) __llround_power8 attribute_hidden;
bca718
 
bca718
 libc_ifunc (__llround,
bca718
-	    (hwcap & PPC_FEATURE_POWER6_EXT)
bca718
-	    ? __llround_power6x :
bca718
-	      (hwcap & PPC_FEATURE_POWER5_PLUS)
bca718
-	      ? __llround_power5plus
bca718
+	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
bca718
+	    ? __llround_power8 :
bca718
+	      (hwcap & PPC_FEATURE_POWER6_EXT)
bca718
+	      ? __llround_power6x :
bca718
+		(hwcap & PPC_FEATURE_POWER5_PLUS)
bca718
+		? __llround_power5plus
bca718
             : __llround_ppc64);
bca718
 
bca718
 weak_alias (__llround, llround)
bca718
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S
bca718
new file mode 100644
bca718
index 0000000..3e98126
bca718
--- /dev/null
bca718
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S
bca718
@@ -0,0 +1,56 @@
bca718
+/* isfinite().  PowerPC64/POWER8 version.
bca718
+   Copyright (C) 2014 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#include <sysdep.h>
bca718
+#include <math_ldbl_opt.h>
bca718
+
bca718
+#define MFVSRD_R3_V1  .long 0x7c230066     /* mfvsrd  r3,vs1  */
bca718
+
bca718
+/* int [r3] __finite ([fp1] x)  */
bca718
+
bca718
+EALIGN (__finite, 4, 0)
bca718
+	CALL_MCOUNT 0
bca718
+	MFVSRD_R3_V1
bca718
+	lis     r9,0x8010
bca718
+	clrldi  r3,r3,1       /* r3 = r3 & 0x8000000000000000  */
bca718
+	rldicr  r9,r9,32,31   /* r9 = (r9 << 32) & 0xffffffff  */
bca718
+	add     r3,r3,r9
bca718
+	rldicl  r3,r3,1,63
bca718
+	blr
bca718
+END (__finite)
bca718
+
bca718
+hidden_def (__finite)
bca718
+weak_alias (__finite, finite)
bca718
+
bca718
+/* It turns out that the 'double' version will also always work for
bca718
+   single-precision.  */
bca718
+strong_alias (__finite, __finitef)
bca718
+hidden_def (__finitef)
bca718
+weak_alias (__finitef, finitef)
bca718
+
bca718
+#ifdef IS_IN_libm
bca718
+# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
bca718
+compat_symbol (libm, __finite, __finitel, GLIBC_2_0)
bca718
+compat_symbol (libm, finite, finitel, GLIBC_2_0)
bca718
+# endif
bca718
+#else
bca718
+# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
bca718
+compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
bca718
+compat_symbol (libc, finite, finitel, GLIBC_2_0);
bca718
+# endif
bca718
+#endif
bca718
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S
bca718
new file mode 100644
bca718
index 0000000..54bd941
bca718
--- /dev/null
bca718
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S
bca718
@@ -0,0 +1 @@
bca718
+/* This function uses the same code as s_finite.S.  */
bca718
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S
bca718
new file mode 100644
bca718
index 0000000..125de39
bca718
--- /dev/null
bca718
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S
bca718
@@ -0,0 +1,61 @@
bca718
+/* isinf().  PowerPC64/POWER8 version.
bca718
+   Copyright (C) 2014 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#include <sysdep.h>
bca718
+#include <math_ldbl_opt.h>
bca718
+
bca718
+#define MFVSRD_R3_V1  .long 0x7c230066     /* mfvsrd  r3,vs1  */
bca718
+
bca718
+/* int [r3] __isinf([fp1] x)  */
bca718
+
bca718
+EALIGN (__isinf, 4, 0)
bca718
+	CALL_MCOUNT 0
bca718
+	MFVSRD_R3_V1
bca718
+	lis     r9,0x7ff0     /* r9 = 0x7ff0  */
bca718
+	rldicl  r10,r3,0,1    /* r10 = r3 & (0x8000000000000000)  */
bca718
+	sldi    r9,r9,32      /* r9 = r9 << 52  */
bca718
+	cmpd    cr7,r10,r9    /* fp1 & 0x7ff0000000000000 ?  */
bca718
+	beq     cr7,L(inf)
bca718
+	li      r3,0          /* Not inf  */
bca718
+	blr
bca718
+L(inf):
bca718
+	sradi   r3,r3,63      /* r3 = r3 >> 63  */
bca718
+	ori     r3,r3,1       /* r3 = r3 | 0x1  */
bca718
+	blr
bca718
+END (__isinf)
bca718
+
bca718
+hidden_def (__isinf)
bca718
+weak_alias (__isinf, isinf)
bca718
+
bca718
+/* It turns out that the 'double' version will also always work for
bca718
+   single-precision.  */
bca718
+strong_alias (__isinf, __isinff)
bca718
+hidden_def (__isinff)
bca718
+weak_alias (__isinff, isinff)
bca718
+
bca718
+#ifdef NO_LONG_DOUBLE
bca718
+strong_alias (__isinf, __isinfl)
bca718
+weak_alias (__isinf, isinfl)
bca718
+#endif
bca718
+
bca718
+#ifndef IS_IN_libm
bca718
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
bca718
+compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
bca718
+compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
bca718
+# endif
bca718
+#endif
bca718
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S
bca718
new file mode 100644
bca718
index 0000000..be759e0
bca718
--- /dev/null
bca718
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S
bca718
@@ -0,0 +1 @@
bca718
+/* This function uses the same code as s_isinf.S.  */
bca718
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S
bca718
index c1ca9a5..cb96d03 100644
bca718
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S
bca718
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S
bca718
@@ -19,8 +19,8 @@
bca718
 #include <sysdep.h>
bca718
 #include <math_ldbl_opt.h>
bca718
 
bca718
-#define MFVSRD_R3_V1  .byte 0x7c,0x23,0x00,0x66     /* mfvsrd  r3,vs1  */
bca718
-
bca718
+#define MFVSRD_R3_V1  .long 0x7c230066     /* mfvsrd  r3,vs1  */
bca718
+        
bca718
 /* int [r3] __isnan([f1] x)  */
bca718
 
bca718
 EALIGN (__isnan, 4, 0)
bca718
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S
bca718
new file mode 100644
bca718
index 0000000..ce48d4e
bca718
--- /dev/null
bca718
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S
bca718
@@ -0,0 +1,45 @@
bca718
+/* Round double to long int.  POWER8 PowerPC64 version.
bca718
+   Copyright (C) 2014 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#include <sysdep.h>
bca718
+#include <math_ldbl_opt.h>
bca718
+
bca718
+#define MFVSRD_R3_V1  .long 0x7c230066     /* mfvsrd  r3,vs1  */
bca718
+
bca718
+/* long long int[r3] __llrint (double x[fp1])  */
bca718
+ENTRY (__llrint)
bca718
+	CALL_MCOUNT 0
bca718
+	fctid	fp1,fp1
bca718
+	MFVSRD_R3_V1
bca718
+	blr
bca718
+END (__llrint)
bca718
+
bca718
+strong_alias (__llrint, __lrint)
bca718
+weak_alias (__llrint, llrint)
bca718
+weak_alias (__lrint, lrint)
bca718
+
bca718
+#ifdef NO_LONG_DOUBLE
bca718
+strong_alias (__llrint, __llrintl)
bca718
+weak_alias (__llrint, llrintl)
bca718
+strong_alias (__lrint, __lrintl)
bca718
+weak_alias (__lrint, lrintl)
bca718
+#endif
bca718
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
bca718
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1)
bca718
+compat_symbol (libm, __lrint, lrintl, GLIBC_2_1)
bca718
+#endif
bca718
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S
bca718
new file mode 100644
bca718
index 0000000..2aea234
bca718
--- /dev/null
bca718
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S
bca718
@@ -0,0 +1,47 @@
bca718
+/* llround function.  POWER8 PowerPC64 version.
bca718
+   Copyright (C) 2014 Free Software Foundation, Inc.
bca718
+   This file is part of the GNU C Library.
bca718
+
bca718
+   The GNU C Library is free software; you can redistribute it and/or
bca718
+   modify it under the terms of the GNU Lesser General Public
bca718
+   License as published by the Free Software Foundation; either
bca718
+   version 2.1 of the License, or (at your option) any later version.
bca718
+
bca718
+   The GNU C Library is distributed in the hope that it will be useful,
bca718
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
bca718
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
bca718
+   Lesser General Public License for more details.
bca718
+
bca718
+   You should have received a copy of the GNU Lesser General Public
bca718
+   License along with the GNU C Library; if not, see
bca718
+   <http://www.gnu.org/licenses/>.  */
bca718
+
bca718
+#include <sysdep.h>
bca718
+#include <math_ldbl_opt.h>
bca718
+
bca718
+#define MFVSRD_R3_V1  .long 0x7c230066     /* mfvsrd  r3,vs1  */
bca718
+
bca718
+/* long long [r3] llround (float x [fp1])  */
bca718
+
bca718
+ENTRY (__llround)
bca718
+	CALL_MCOUNT 0
bca718
+	frin	fp1,fp1	/* Round to nearest +-0.5.  */
bca718
+	fctidz	fp1,fp1	/* Convert To Integer DW round toward 0.  */
bca718
+	MFVSRD_R3_V1
bca718
+	blr
bca718
+END (__llround)
bca718
+
bca718
+strong_alias (__llround, __lround)
bca718
+weak_alias (__llround, llround)
bca718
+weak_alias (__lround, lround)
bca718
+
bca718
+#ifdef NO_LONG_DOUBLE
bca718
+weak_alias (__llround, llroundl)
bca718
+strong_alias (__llround, __llroundl)
bca718
+weak_alias (__lround, lroundl)
bca718
+strong_alias (__lround, __lroundl)
bca718
+#endif
bca718
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
bca718
+compat_symbol (libm, __llround, llroundl, GLIBC_2_1)
bca718
+compat_symbol (libm, __lround, lroundl, GLIBC_2_1)
bca718
+#endif