5de29b
From fa809e97912e4bb6faafa74c15a86588c05e89bc Mon Sep 17 00:00:00 2001
5de29b
From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
5de29b
Date: Wed, 30 Jul 2014 12:04:31 -0500
5de29b
Subject: [PATCH] PowerPC: multiarch logb/logbl/logbf for PowerPC64
5de29b
5de29b
commit 43e246d2a6a75710fbe3d3f3db23db3aeb8a9f93
5de29b
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
5de29b
Date:   Fri Dec 13 15:36:33 2013 -0500
5de29b
5de29b
Added the following file apart from the original commit.
5de29b
sysdeps/powerpc/power7/fpu/s_logb.c
5de29b
sysdeps/powerpc/power7/fpu/s_logbf.c
5de29b
sysdeps/powerpc/power7/fpu/s_logbl.c
5de29b
sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c
5de29b
sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c
5de29b
sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c
5de29b
5de29b
---
5de29b
 sysdeps/ieee754/ldbl-128ibm/s_logbl.c              |  2 +
5de29b
 sysdeps/powerpc/power7/fpu/s_logb.c                | 78 ++++++++++++++++++++++
5de29b
 sysdeps/powerpc/power7/fpu/s_logbf.c               | 60 +++++++++++++++++
5de29b
 sysdeps/powerpc/power7/fpu/s_logbl.c               | 72 ++++++++++++++++++++
5de29b
 .../powerpc32/power4/fpu/multiarch/s_logb-power7.c | 31 +++++++++
5de29b
 .../power4/fpu/multiarch/s_logbf-power7.c          | 26 ++++++++
5de29b
 .../power4/fpu/multiarch/s_logbl-power7.c          | 21 ++++++
5de29b
 sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile   |  8 ++-
5de29b
 .../powerpc64/fpu/multiarch/s_logb-power7.c        | 19 ++++++
5de29b
 .../powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c | 28 ++++++++
5de29b
 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c   | 41 ++++++++++++
5de29b
 .../powerpc64/fpu/multiarch/s_logbf-power7.c       | 19 ++++++
5de29b
 .../powerpc64/fpu/multiarch/s_logbf-ppc64.c        | 26 ++++++++
5de29b
 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c  | 32 +++++++++
5de29b
 .../powerpc64/fpu/multiarch/s_logbl-power7.c       | 19 ++++++
5de29b
 .../powerpc64/fpu/multiarch/s_logbl-ppc64.c        | 21 ++++++
5de29b
 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl.c  | 32 +++++++++
5de29b
 17 files changed, 534 insertions(+), 1 deletion(-)
5de29b
 create mode 100644 sysdeps/powerpc/power7/fpu/s_logb.c
5de29b
 create mode 100644 sysdeps/powerpc/power7/fpu/s_logbf.c
5de29b
 create mode 100644 sysdeps/powerpc/power7/fpu/s_logbl.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-power7.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-power7.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-ppc64.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-power7.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-ppc64.c
5de29b
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl.c
5de29b
12745e
diff --git glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_logbl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
5de29b
index 6cbfcfa..28a50de 100644
12745e
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
12745e
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
5de29b
@@ -44,4 +44,6 @@ __logbl (long double x)
5de29b
   return (long double) (rhx - 1023);
5de29b
 }
5de29b
 
5de29b
+#ifndef __logbl
5de29b
 long_double_symbol (libm, __logbl, logbl);
5de29b
+#endif
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/power7/fpu/s_logb.c glibc-2.17-c758a686/sysdeps/powerpc/power7/fpu/s_logb.c
5de29b
new file mode 100644
5de29b
index 0000000..87176c3
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/power7/fpu/s_logb.c
5de29b
@@ -0,0 +1,78 @@
5de29b
+/* logb(). PowerPC/POWER7 version.
5de29b
+   Copyright (C) 2012 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_ldbl_opt.h>
5de29b
+
5de29b
+/* This implementation avoids FP to INT conversions by using VSX
5de29b
+   bitwise instructions over FP values.  */
5de29b
+
5de29b
+static const double two1div52 = 2.220446049250313e-16;	/* 1/2**52  */
5de29b
+static const double two10m1   = -1023.0;		/* 2**10 -1  */
5de29b
+
5de29b
+/* FP mask to extract the exponent.  */
5de29b
+static const union {
5de29b
+  unsigned long long mask;
5de29b
+  double d;
5de29b
+} mask = { 0x7ff0000000000000ULL };
5de29b
+
5de29b
+double
5de29b
+__logb (double x)
5de29b
+{
5de29b
+  double ret;
5de29b
+
5de29b
+  if (__builtin_expect (x == 0.0, 0))
5de29b
+    /* Raise FE_DIVBYZERO and return -HUGE_VAL[LF].  */
5de29b
+    return -1.0 / __builtin_fabs (x);
5de29b
+
5de29b
+  /* ret = x & 0x7ff0000000000000;  */
5de29b
+  asm (
5de29b
+    "xxland %x0,%x1,%x2\n"
5de29b
+    "fcfid  %0,%0"
5de29b
+    : "=f" (ret)
5de29b
+    : "f" (x), "f" (mask.d));
5de29b
+  /* ret = (ret >> 52) - 1023.0;  */
5de29b
+  ret = (ret * two1div52) + two10m1;
5de29b
+  if (__builtin_expect (ret > -two10m1, 0))
5de29b
+    /* Multiplication is used to set logb (+-INF) = INF.  */
5de29b
+    return (x * x);
5de29b
+  else if (__builtin_expect (ret == two10m1, 0))
5de29b
+    {
5de29b
+      /* POSIX specifies that denormal numbers are treated as
5de29b
+         though they were normalized.  */
5de29b
+      int32_t lx, ix;
5de29b
+      int ma;
5de29b
+
5de29b
+      EXTRACT_WORDS (ix, lx, x);
5de29b
+      if (ix == 0)
5de29b
+	ma = __builtin_clz (lx) + 32;
5de29b
+      else
5de29b
+	ma = __builtin_clz (ix);
5de29b
+      return (double) (-1023 - (ma - 12));
5de29b
+    }
5de29b
+  /* Test to avoid logb_downward (0.0) == -0.0.  */
5de29b
+  return ret == -0.0 ? 0.0 : ret;
5de29b
+}
5de29b
+weak_alias (__logb, logb)
5de29b
+#ifdef NO_LONG_DOUBLE
5de29b
+strong_alias (__logb, __logbl)
5de29b
+weak_alias (__logb, logbl)
5de29b
+#endif
5de29b
+
5de29b
+#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
5de29b
+compat_symbol (libm, logb, logbl, GLIBC_2_0);
5de29b
+#endif
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/power7/fpu/s_logbf.c glibc-2.17-c758a686/sysdeps/powerpc/power7/fpu/s_logbf.c
5de29b
new file mode 100644
5de29b
index 0000000..aa8499a
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/power7/fpu/s_logbf.c
5de29b
@@ -0,0 +1,60 @@
5de29b
+/* logbf(). PowerPC/POWER7 version.
5de29b
+   Copyright (C) 2012 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_private.h"
5de29b
+
5de29b
+/* This implementation avoids FP to INT conversions by using VSX
5de29b
+   bitwise instructions over FP values.  */
5de29b
+
5de29b
+static const double two1div52 = 2.220446049250313e-16;	/* 1/2**52  */
5de29b
+static const double two10m1   = -1023.0;		/* -2**10 + 1  */
5de29b
+static const double two7m1    = -127.0;			/* -2**7 + 1  */
5de29b
+
5de29b
+/* FP mask to extract the exponent.  */
5de29b
+static const union {
5de29b
+  unsigned long long mask;
5de29b
+  double d;
5de29b
+} mask = { 0x7ff0000000000000ULL };
5de29b
+
5de29b
+float
5de29b
+__logbf (float x)
5de29b
+{
5de29b
+  /* VSX operation are all done internally as double.  */
5de29b
+  double ret;
5de29b
+
5de29b
+  if (__builtin_expect (x == 0.0, 0))
5de29b
+    /* Raise FE_DIVBYZERO and return -HUGE_VAL[LF].  */
5de29b
+    return -1.0 / __builtin_fabsf (x);
5de29b
+
5de29b
+  /* ret = x & 0x7f800000;  */
5de29b
+  asm (
5de29b
+    "xxland %x0,%x1,%x2\n"
5de29b
+    "fcfid  %0,%0"
5de29b
+    : "=f"(ret)
5de29b
+    : "f" (x), "f" (mask.d));
5de29b
+  /* ret = (ret >> 52) - 1023.0, since ret is double.  */
5de29b
+  ret = (ret * two1div52) + two10m1;
5de29b
+  if (__builtin_expect (ret > -two7m1, 0))
5de29b
+    /* Multiplication is used to set logb (+-INF) = INF.  */
5de29b
+    return (x * x);
5de29b
+  /* Since operations are done with double we don't need
5de29b
+     additional tests for subnormal numbers.
5de29b
+     The test is to avoid logb_downward (0.0) == -0.0.  */
5de29b
+  return ret == -0.0 ? 0.0 : ret;
5de29b
+}
5de29b
+weak_alias (__logbf, logbf)
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/power7/fpu/s_logbl.c glibc-2.17-c758a686/sysdeps/powerpc/power7/fpu/s_logbl.c
5de29b
new file mode 100644
5de29b
index 0000000..e1ec089
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/power7/fpu/s_logbl.c
5de29b
@@ -0,0 +1,72 @@
5de29b
+/* logbl(). PowerPC/POWER7 version.
5de29b
+   Copyright (C) 2012 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_private.h>
5de29b
+#include <math_ldbl_opt.h>
5de29b
+
5de29b
+/* This implementation avoids FP to INT conversions by using VSX
5de29b
+   bitwise instructions over FP values.  */
5de29b
+
5de29b
+static const double two1div52 = 2.220446049250313e-16;	/* 1/2**52  */
5de29b
+static const double two10m1   = -1023.0;		/* 2**10 -1  */
5de29b
+
5de29b
+/* FP mask to extract the exponent.  */
5de29b
+static const union {
5de29b
+  unsigned long long mask;
5de29b
+  double d;
5de29b
+} mask = { 0x7ff0000000000000ULL };
5de29b
+
5de29b
+long double
5de29b
+__logbl (long double x)
5de29b
+{
5de29b
+  double xh, xl;
5de29b
+  double ret;
5de29b
+
5de29b
+  if (__builtin_expect (x == 0.0L, 0))
5de29b
+    /* Raise FE_DIVBYZERO and return -HUGE_VAL[LF].  */
5de29b
+    return -1.0L / __builtin_fabsl (x);
5de29b
+
5de29b
+  ldbl_unpack (x, &xh, &xl);
5de29b
+  /* ret = x & 0x7ff0000000000000;  */
5de29b
+  asm (
5de29b
+    "xxland %x0,%x1,%x2\n"
5de29b
+    "fcfid  %0,%0"
5de29b
+    : "=f" (ret)
5de29b
+    : "f" (xh), "f" (mask.d));
5de29b
+  /* ret = (ret >> 52) - 1023.0;  */
5de29b
+  ret = (ret * two1div52) + two10m1;
5de29b
+  if (__builtin_expect (ret > -two10m1, 0))
5de29b
+    /* Multiplication is used to set logb (+-INF) = INF.  */
5de29b
+    return (xh * xh);
5de29b
+  else if (__builtin_expect (ret == two10m1, 0))
5de29b
+    {
5de29b
+      /* POSIX specifies that denormal number is treated as
5de29b
+         though it were normalized.  */
5de29b
+      int64_t lx, hx;
5de29b
+
5de29b
+      GET_LDOUBLE_WORDS64 (hx, lx, x);
5de29b
+      return (long double) (-1023 - (__builtin_clzll (hx) - 12));
5de29b
+    }
5de29b
+  /* Test to avoid logb_downward (0.0) == -0.0.  */
5de29b
+  return ret == -0.0 ? 0.0 : ret;
5de29b
+}
5de29b
+
5de29b
+#ifndef __logbl
5de29b
+long_double_symbol (libm, __logbl, logbl);
5de29b
+#endif
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c
5de29b
new file mode 100644
5de29b
index 0000000..3280566
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c
5de29b
@@ -0,0 +1,31 @@
5de29b
+/* logb(). PowerPC32/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 <math.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
+#undef compat_symbol
5de29b
+#define compat_symbol(lib, name, alias, ver)
5de29b
+
5de29b
+#define __logb __logb_power7
5de29b
+
5de29b
+#include <sysdeps/powerpc/power7/fpu/s_logb.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c
5de29b
new file mode 100644
5de29b
index 0000000..6531af0
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c
5de29b
@@ -0,0 +1,26 @@
5de29b
+/* logbf(). PowerPC32/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 <math.h>
5de29b
+
5de29b
+#undef weak_alias
5de29b
+#define weak_alias(a, b)
5de29b
+
5de29b
+#define __logbf __logbf_power7
5de29b
+
5de29b
+#include <sysdeps/powerpc/power7/fpu/s_logbf.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c
5de29b
new file mode 100644
5de29b
index 0000000..7c5ad47
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c
5de29b
@@ -0,0 +1,21 @@
5de29b
+/* logbl(). PowerPC32/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
+#define __logbl __logbl_power7
5de29b
+
5de29b
+#include <sysdeps/powerpc/power7/fpu/s_logbl.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
5de29b
index 64dd85f..87aabca 100644
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
5de29b
@@ -16,5 +16,11 @@ libm-sysdep_routines += s_isnan-power7 s_isnan-power6x s_isnan-power6 \
5de29b
                        s_copysign-power6 s_copysign-ppc64 s_llrint-power6x \
5de29b
                        s_llrint-ppc64 s_finite-power7 s_finite-ppc64 \
5de29b
                        s_finitef-ppc64 s_isinff-ppc64 s_isinf-power7 \
5de29b
-                       s_isinf-ppc64
5de29b
+                       s_isinf-ppc64 s_logb-power7 s_logbf-power7 \
5de29b
+                       s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \
5de29b
+                       s_logbl-ppc64
5de29b
+
5de29b
+CFLAGS-s_logbf-power7.c = -mcpu=power7
5de29b
+CFLAGS-s_logbl-power7.c = -mcpu=power7
5de29b
+CFLAGS-s_logb-power7.c = -mcpu=power7
5de29b
 endif
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-power7.c
5de29b
new file mode 100644
5de29b
index 0000000..049f2c1
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-power7.c
5de29b
@@ -0,0 +1,19 @@
5de29b
+/* logb().  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 <sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c
5de29b
new file mode 100644
5de29b
index 0000000..41d1d9b
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c
5de29b
@@ -0,0 +1,28 @@
5de29b
+/* logb(). PowerPC32/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 <math.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 __logb __logb_ppc64
5de29b
+
5de29b
+#include <sysdeps/ieee754/dbl-64/s_logb.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c
5de29b
new file mode 100644
5de29b
index 0000000..e14efa7
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c
5de29b
@@ -0,0 +1,41 @@
5de29b
+/* Multiple versions of logb.
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 (__logb) __logb_ppc64 attribute_hidden;
5de29b
+extern __typeof (__logb) __logb_power7 attribute_hidden;
5de29b
+
5de29b
+libc_ifunc (__logb,
5de29b
+	    (hwcap & PPC_FEATURE_ARCH_2_06)
5de29b
+	    ? __logb_power7
5de29b
+            : __logb_ppc64);
5de29b
+
5de29b
+weak_alias (__logb, logb)
5de29b
+
5de29b
+#ifdef NO_LONG_DOUBLE
5de29b
+strong_alias (__logb, __logbl)
5de29b
+weak_alias (__logb, logbl)
5de29b
+#endif
5de29b
+
5de29b
+#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
5de29b
+compat_symbol (libm, logb, logbl, GLIBC_2_0);
5de29b
+#endif
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-power7.c
5de29b
new file mode 100644
5de29b
index 0000000..5e4e4fc
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-power7.c
5de29b
@@ -0,0 +1,19 @@
5de29b
+/* logb().  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 <sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-ppc64.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-ppc64.c
5de29b
new file mode 100644
5de29b
index 0000000..08674a6
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-ppc64.c
5de29b
@@ -0,0 +1,26 @@
5de29b
+/* logbf().  PowerPC64 default implementation.
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
+
5de29b
+#undef weak_alias
5de29b
+#define weak_alias(a, b)
5de29b
+
5de29b
+#define __logbf __logbf_ppc64
5de29b
+
5de29b
+#include <sysdeps/ieee754/flt-32/s_logbf.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c
5de29b
new file mode 100644
5de29b
index 0000000..01f9ecb
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c
5de29b
@@ -0,0 +1,32 @@
5de29b
+/* Multiple versions of logbf.
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 (__logbf) __logbf_ppc64 attribute_hidden;
5de29b
+extern __typeof (__logbf) __logbf_power7 attribute_hidden;
5de29b
+
5de29b
+libc_ifunc (__logbf,
5de29b
+	    (hwcap & PPC_FEATURE_ARCH_2_06)
5de29b
+	    ? __logbf_power7
5de29b
+            : __logbf_ppc64);
5de29b
+
5de29b
+weak_alias (__logbf, logbf)
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-power7.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-power7.c
5de29b
new file mode 100644
5de29b
index 0000000..258d502
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-power7.c
5de29b
@@ -0,0 +1,19 @@
5de29b
+/* logb().  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 <sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-ppc64.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-ppc64.c
5de29b
new file mode 100644
5de29b
index 0000000..47d4153
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-ppc64.c
5de29b
@@ -0,0 +1,21 @@
5de29b
+/* logbl(). PowerPC64/POWER7 version.
5de29b
+   Copyright (C) 2012-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
+#define __logbl __logbl_ppc64
5de29b
+
5de29b
+#include <sysdeps/ieee754/ldbl-128ibm/s_logbl.c>
12745e
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl.c
5de29b
new file mode 100644
5de29b
index 0000000..cb0b0c5
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl.c
5de29b
@@ -0,0 +1,32 @@
5de29b
+/* Multiple versions of logbl.
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 (__logbl) __logbl_ppc64 attribute_hidden;
5de29b
+extern __typeof (__logbl) __logbl_power7 attribute_hidden;
5de29b
+
5de29b
+libc_ifunc (__logbl,
5de29b
+	    (hwcap & PPC_FEATURE_ARCH_2_06)
5de29b
+	    ? __logbl_power7
5de29b
+            : __logbl_ppc64);
5de29b
+
5de29b
+long_double_symbol (libm, __logbl, logbl);
5de29b
-- 
5de29b
1.8.3.1
5de29b