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