5de29b
From 54c7fb4227e044758021e638082f69d2a48d2658 Mon Sep 17 00:00:00 2001
5de29b
From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
5de29b
Date: Wed, 30 Jul 2014 10:40:10 -0500
5de29b
Subject: [PATCH] PowerPC: multiarch isnan/isnanf for PowerPC64
5de29b
5de29b
commit b2284ad7cf6d9c2fea4223d933fcc152c0fee7c1
5de29b
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
5de29b
Date:   Fri Dec 13 15:01:10 2013 -0500
5de29b
5de29b
Added sysdeps/powerpc/powerpc32/fpu/s_isnan.S apart from
5de29b
the original commit.
5de29b
---
5de29b
 sysdeps/powerpc/powerpc32/fpu/s_isnan.S            |  2 +
5de29b
 sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile   |  7 +++
5de29b
 .../powerpc64/fpu/multiarch/s_isnan-power5.S       | 33 ++++++++++++++
5de29b
 .../powerpc64/fpu/multiarch/s_isnan-power6.S       | 33 ++++++++++++++
5de29b
 .../powerpc64/fpu/multiarch/s_isnan-power6x.S      | 33 ++++++++++++++
5de29b
 .../powerpc64/fpu/multiarch/s_isnan-power7.S       | 33 ++++++++++++++
5de29b
 .../powerpc64/fpu/multiarch/s_isnan-ppc64.S        | 32 +++++++++++++
5de29b
 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c  | 53 ++++++++++++++++++++++
5de29b
 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c | 40 ++++++++++++++++
5de29b
 9 files changed, 266 insertions(+)
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c
5de29b
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_isnan.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_isnan.S
5de29b
index f1ea473..0157805 100644
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_isnan.S
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_isnan.S
5de29b
@@ -37,9 +37,11 @@ weak_alias (__isnan, isnan)
5de29b
 
5de29b
 /* It turns out that the 'double' version will also always work for
5de29b
    single-precision.  */
5de29b
+#ifndef __isnan
5de29b
 strong_alias (__isnan, __isnanf)
5de29b
 hidden_def (__isnanf)
5de29b
 weak_alias (__isnanf, isnanf)
5de29b
+#endif
5de29b
 
5de29b
 #ifdef NO_LONG_DOUBLE
5de29b
 strong_alias (__isnan, __isnanl)
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
5de29b
new file mode 100644
5de29b
index 0000000..b57ddc9
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
5de29b
@@ -0,0 +1,7 @@
5de29b
+ifeq ($(subdir),math)
5de29b
+sysdep_routines += s_isnan-power7 s_isnan-power6x s_isnan-power6 \
5de29b
+                  s_isnan-power5 s_isnan-ppc64
5de29b
+
5de29b
+libm-sysdep_routines += s_isnan-power7 s_isnan-power6x s_isnan-power6 \
5de29b
+                       s_isnan-power5 s_isnan-ppc64
5de29b
+endif
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S
5de29b
new file mode 100644
5de29b
index 0000000..145e24b
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S
5de29b
@@ -0,0 +1,33 @@
5de29b
+/* isnan().  PowerPC64/POWER5 version.
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <sysdep.h>
5de29b
+#include <math_ldbl_opt.h>
5de29b
+
5de29b
+#undef hidden_def
5de29b
+#define hidden_def(name)
5de29b
+#undef weak_alias
5de29b
+#define weak_alias(name, alias)
5de29b
+#undef strong_alias
5de29b
+#define strong_alias(name, alias)
5de29b
+#undef compat_symbol
5de29b
+#define compat_symbol(lib, name, symbol, ver)
5de29b
+
5de29b
+#define __isnan __isnan_power5
5de29b
+
5de29b
+#include <sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S
5de29b
new file mode 100644
5de29b
index 0000000..4576eb3
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S
5de29b
@@ -0,0 +1,33 @@
5de29b
+/* isnan().  PowerPC64/POWER6 version.
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <sysdep.h>
5de29b
+#include <math_ldbl_opt.h>
5de29b
+
5de29b
+#undef hidden_def
5de29b
+#define hidden_def(name)
5de29b
+#undef weak_alias
5de29b
+#define weak_alias(name, alias)
5de29b
+#undef strong_alias
5de29b
+#define strong_alias(name, alias)
5de29b
+#undef compat_symbol
5de29b
+#define compat_symbol(lib, name, symbol, ver)
5de29b
+
5de29b
+#define __isnan __isnan_power6
5de29b
+
5de29b
+#include <sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S
5de29b
new file mode 100644
5de29b
index 0000000..c2a45e3
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S
5de29b
@@ -0,0 +1,33 @@
5de29b
+/* isnan().  PowerPC64/POWER6X version.
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <sysdep.h>
5de29b
+#include <math_ldbl_opt.h>
5de29b
+
5de29b
+#undef hidden_def
5de29b
+#define hidden_def(name)
5de29b
+#undef weak_alias
5de29b
+#define weak_alias(name, alias)
5de29b
+#undef strong_alias
5de29b
+#define strong_alias(name, alias)
5de29b
+#undef compat_symbol
5de29b
+#define compat_symbol(lib, name, symbol, ver)
5de29b
+
5de29b
+#define __isnan __isnan_power6x
5de29b
+
5de29b
+#include <sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S
5de29b
new file mode 100644
5de29b
index 0000000..05b9fbc
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S
5de29b
@@ -0,0 +1,33 @@
5de29b
+/* isnan().  PowerPC64/POWER7 version.
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <sysdep.h>
5de29b
+#include <math_ldbl_opt.h>
5de29b
+
5de29b
+#undef hidden_def
5de29b
+#define hidden_def(name)
5de29b
+#undef weak_alias
5de29b
+#define weak_alias(name, alias)
5de29b
+#undef strong_alias
5de29b
+#define strong_alias(name, alias)
5de29b
+#undef compat_symbol
5de29b
+#define compat_symbol(lib, name, symbol, ver)
5de29b
+
5de29b
+#define __isnan __isnan_power7
5de29b
+
5de29b
+#include <sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S
5de29b
new file mode 100644
5de29b
index 0000000..cf01d64
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S
5de29b
@@ -0,0 +1,32 @@
5de29b
+/* isnan().  PowerPC32 default version.
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <sysdep.h>
5de29b
+#include <math_ldbl_opt.h>
5de29b
+
5de29b
+#undef weak_alias
5de29b
+#define weak_alias(a,b)
5de29b
+#undef strong_alias
5de29b
+#define strong_alias(a,b)
5de29b
+
5de29b
+#define __isnan __isnan_ppc64
5de29b
+#undef hidden_def
5de29b
+#define hidden_def(name) \
5de29b
+  .globl __GI___isnan ; .set __GI___isnan,__isnan_ppc64
5de29b
+
5de29b
+#include <sysdeps/powerpc/powerpc64/fpu/s_isnan.S>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
5de29b
new file mode 100644
5de29b
index 0000000..0de833e
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
5de29b
@@ -0,0 +1,53 @@
5de29b
+/* Multiple versions of isnan.
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <math.h>
5de29b
+#include <math_ldbl_opt.h>
5de29b
+#include <shlib-compat.h>
5de29b
+#include "init-arch.h"
5de29b
+
5de29b
+extern __typeof (__isnan) __isnan_ppc64 attribute_hidden;
5de29b
+extern __typeof (__isnan) __isnan_power5 attribute_hidden;
5de29b
+extern __typeof (__isnan) __isnan_power6 attribute_hidden;
5de29b
+extern __typeof (__isnan) __isnan_power6x attribute_hidden;
5de29b
+extern __typeof (__isnan) __isnan_power7 attribute_hidden;
5de29b
+
5de29b
+libc_ifunc (__isnan,
5de29b
+	    (hwcap & PPC_FEATURE_ARCH_2_06)
5de29b
+	    ? __isnan_power7 :
5de29b
+	      (hwcap & PPC_FEATURE_POWER6_EXT)
5de29b
+		? __isnan_power6x :
5de29b
+		(hwcap & PPC_FEATURE_ARCH_2_05)
5de29b
+		  ? __isnan_power6 :
5de29b
+		  (hwcap & PPC_FEATURE_POWER5)
5de29b
+		    ? __isnan_power5
5de29b
+            : __isnan_ppc64);
5de29b
+
5de29b
+weak_alias (__isnan, isnan)
5de29b
+
5de29b
+#ifdef NO_LONG_DOUBLE
5de29b
+strong_alias (__isnan, __isnanl)
5de29b
+weak_alias (__isnan, isnanl)
5de29b
+#endif
5de29b
+
5de29b
+#ifndef IS_IN_libm
5de29b
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
5de29b
+compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
5de29b
+compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
5de29b
+# endif
5de29b
+#endif
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c
5de29b
new file mode 100644
5de29b
index 0000000..b237455
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c
5de29b
@@ -0,0 +1,40 @@
5de29b
+/* Multiple versions of isnan.
5de29b
+   Copyright (C) 2013-2014 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+#include <math.h>
5de29b
+#include "init-arch.h"
5de29b
+
5de29b
+/* The double-precision implementation also works for the single one.  */
5de29b
+extern __typeof (__isnanf) __isnan_ppc64 attribute_hidden;
5de29b
+extern __typeof (__isnanf) __isnan_power5 attribute_hidden;
5de29b
+extern __typeof (__isnanf) __isnan_power6 attribute_hidden;
5de29b
+extern __typeof (__isnanf) __isnan_power6x attribute_hidden;
5de29b
+extern __typeof (__isnanf) __isnan_power7 attribute_hidden;
5de29b
+
5de29b
+libc_ifunc (__isnanf,
5de29b
+	    (hwcap & PPC_FEATURE_ARCH_2_06)
5de29b
+	    ? __isnan_power7 :
5de29b
+	      (hwcap & PPC_FEATURE_POWER6_EXT)
5de29b
+		? __isnan_power6x :
5de29b
+		(hwcap & PPC_FEATURE_ARCH_2_05)
5de29b
+		  ? __isnan_power6 :
5de29b
+		  (hwcap & PPC_FEATURE_POWER5)
5de29b
+		    ? __isnan_power5
5de29b
+            : __isnan_ppc64);
5de29b
+
5de29b
+weak_alias (__isnanf, isnanf)
5de29b
-- 
5de29b
1.8.3.1
5de29b