This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 25/36] PowerPC: isinf/isinff multilib for PowerPC32


2013-08-19  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>

	* sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S: Move to ...
	* sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-power7.S: ... here.
	(__isinf): Rename symbol to __isinf_power7 and remove strong_alias,
	weak_alias and compat_symbol definitions.
	* sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S: Remove unneeded
	file.
	* sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-ppc32.c: New file:
	default isinf implementation for PPC32.
	* sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff-ppc32.c : New file:
	default isinff implementation for PPC32.
	* sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf.c: New file:
	multiarch isinf for PPC32.
	* sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff.c: New file:
	multiarch isinff for PPC32.
	* sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile: Add isinf and
	isinff objects.

--

diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
index de2cbda..ba07447 100644
--- a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile
@@ -1,6 +1,7 @@
 ifeq ($(subdir),math)
 sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \
-		   s_isnanf-power6 s_isnanf-power5 s_isnanf-ppc32
+		   s_isnanf-power6 s_isnanf-power5 s_isnanf-ppc32 \
+		   s_isinf-power7 s_isinf-ppc32 s_isinff-ppc32
 
 libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \
 			s_llrint-power6 s_llrint-power4 s_llrint-ppc32 \
@@ -9,7 +10,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-ppc32 \
 			w_sqrt-ppc32 w_sqrtf-power5 w_sqrtf-power4 \
 			w_sqrtf-ppc32 s_isnan-power7 s_isnan-power6 \
 			s_isnan-power5 s_isnan-ppc32 s_isnanf-power6 \
-			s_isnanf-power5 s_isnanf-ppc32
+			s_isnanf-power5 s_isnanf-ppc32 s_isinf-power7 \
+			s_isinf-ppc32 s_isinff-ppc32
 
 CFLAGS-s_llround.c = -fno-builtin-llroundf
 endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-power7.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-power7.S
new file mode 100644
index 0000000..0771ce2
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-power7.S
@@ -0,0 +1,66 @@
+/* isinf().  PowerPC32/POWER7 version.
+   Copyright (C) 2010-2013 Free Software Foundation, Inc.
+   Contributed by Luis Machado <luisgpm@br.ibm.com>.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+/* int __isinf(x)  */
+	.section    .rodata.cst8,"aM",@progbits,8
+	.align 3
+.LC0:   /* 1.0 */
+	.quad	    0x3ff0000000000000
+
+	.section    ".text"
+	.type	    __isinf, @function
+	.machine    power7
+ENTRY (__isinf_power7)
+#ifdef SHARED
+	mflr	r11
+	cfi_register(lr,r11)
+
+	SETUP_GOT_ACCESS(r9,got_label)
+	addis	r9,r9,.LC0-got_label@ha
+	lfd	fp0,.LC0-got_label@l(r9)
+
+	mtlr	r11
+	cfi_same_value (lr)
+#else
+	lis	r9,.LC0@ha
+	lfd	fp0,.LC0@l(r9)
+#endif
+	ftdiv	cr7,fp1,fp0
+	li	r3,0
+	bflr    29	      /* If not INF, return.  */
+
+	/* Either we have -INF/+INF or a denormal.  */
+
+	stwu    r1,-16(r1)    /* Allocate stack space.  */
+	stfd    fp1,8(r1)     /* Transfer FP to GPR's.  */
+	ori	2,2,0	      /* Force a new dispatch group.  */
+	lhz	r4,8(r1)      /* Fetch the upper portion of the high word of
+			      the FP value (where the exponent and sign bits
+			      are).  */
+	addi	r1,r1,16      /* Reset the stack pointer.  */
+	cmpwi	cr7,r4,0x7ff0 /* r4 == 0x7ff0?  */
+	li	r3,1
+	beqlr   cr7	      /* EQ means INF, otherwise -INF.  */
+	li      r3,-1
+	blr
+END (__isinf_power7)
+weak_alias (__isinf_power7, __isinff_power7)
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-ppc32.c
new file mode 100644
index 0000000..ab68384
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf-ppc32.c
@@ -0,0 +1,34 @@
+/* isinf().  PowerPC32 default version.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   Contributed by Luis Machado <luisgpm@br.ibm.com>.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+
+#undef weak_alias
+#define weak_alias(a, b)
+#undef strong_alias
+#define strong_alias(a, b)
+
+#define __isinf __isinf_ppc32
+#ifdef SHARED
+# undef hidden_def
+# define hidden_def(a) \
+   __hidden_ver1 (__isinf_ppc32, __GI___isinf, __isinf_ppc32);
+#endif
+
+#include <sysdeps/ieee754/dbl-64/s_isinf.c>
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf.c
new file mode 100644
index 0000000..afbae86
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinf.c
@@ -0,0 +1,44 @@
+/* Multiple versions of isinf.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <shlib-compat.h>
+#include "init-arch.h"
+
+extern __typeof (__isinf) __isinf_ppc32 attribute_hidden;
+extern __typeof (__isinf) __isinf_power7 attribute_hidden;
+
+libc_ifunc (__isinf,
+	    (hwcap & PPC_FEATURE_ARCH_2_06)
+	    ? __isinf_power7
+            : __isinf_ppc32);
+
+weak_alias (__isinf, isinf)
+
+#ifdef NO_LONG_DOUBLE
+strong_alias (__isinf, __isinfl)
+weak_alias (__isinf, isinfl)
+#endif
+
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
+compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff-ppc32.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff-ppc32.c
new file mode 100644
index 0000000..09786c4
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff-ppc32.c
@@ -0,0 +1,31 @@
+/* isinff().  PowerPC32 default version.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+
+#undef weak_alias
+#define weak_alias(a, b)
+
+#define __isinff __isinff_ppc32
+#ifdef SHARED
+# undef hidden_def
+# define hidden_def(a) \
+   __hidden_ver1 (__isinff_ppc32, __GI___isinff, __isinff_ppc32);
+#endif
+
+#include <sysdeps/ieee754/flt-32/s_isinff.c>
diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff.c
new file mode 100644
index 0000000..6090d3a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_isinff.c
@@ -0,0 +1,32 @@
+/* Multiple versions of isinf.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <shlib-compat.h>
+#include "init-arch.h"
+
+extern __typeof (__isinff) __isinff_ppc32 attribute_hidden;
+extern __typeof (__isinff) __isinff_power7 attribute_hidden;
+
+libc_ifunc (__isinff,
+	    (hwcap & PPC_FEATURE_ARCH_2_06)
+	    ? __isinff_power7
+            : __isinff_ppc32);
+
+weak_alias (__isinff, isinff)
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
deleted file mode 100644
index 3f8af60..0000000
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
+++ /dev/null
@@ -1,86 +0,0 @@
-/* isinf().  PowerPC32/POWER7 version.
-   Copyright (C) 2010-2013 Free Software Foundation, Inc.
-   Contributed by Luis Machado <luisgpm@br.ibm.com>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isinf(x)  */
-	.section    .rodata.cst8,"aM",@progbits,8
-	.align 3
-.LC0:   /* 1.0 */
-	.quad	    0x3ff0000000000000
-
-	.section    ".text"
-	.type	    __isinf, @function
-	.machine    power7
-ENTRY (__isinf)
-#ifdef SHARED
-	mflr	r11
-	cfi_register(lr,r11)
-
-	SETUP_GOT_ACCESS(r9,got_label)
-	addis	r9,r9,.LC0-got_label@ha
-	lfd	fp0,.LC0-got_label@l(r9)
-
-	mtlr	r11
-	cfi_same_value (lr)
-#else
-	lis	r9,.LC0@ha
-	lfd	fp0,.LC0@l(r9)
-#endif
-	ftdiv	cr7,fp1,fp0
-	li	r3,0
-	bflr    29	      /* If not INF, return.  */
-
-	/* Either we have -INF/+INF or a denormal.  */
-
-	stwu    r1,-16(r1)    /* Allocate stack space.  */
-	stfd    fp1,8(r1)     /* Transfer FP to GPR's.  */
-	ori	2,2,0	      /* Force a new dispatch group.  */
-	lhz	r4,8(r1)      /* Fetch the upper portion of the high word of
-			      the FP value (where the exponent and sign bits
-			      are).  */
-	addi	r1,r1,16      /* Reset the stack pointer.  */
-	cmpwi	cr7,r4,0x7ff0 /* r4 == 0x7ff0?  */
-	li	r3,1
-	beqlr   cr7	      /* EQ means INF, otherwise -INF.  */
-	li      r3,-1
-	blr
-	END (__isinf)
-
-hidden_def (__isinf)
-weak_alias (__isinf, isinf)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isinf, __isinff)
-hidden_def (__isinff)
-weak_alias (__isinff, isinff)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isinf, __isinfl)
-weak_alias (__isinf, isinfl)
-#endif
-
-#ifndef IS_IN_libm
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
-compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S
deleted file mode 100644
index be759e0..0000000
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_isinf.S.  */
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]