aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/powerpc32/power7
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc/powerpc32/power7')
-rw-r--r--sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c13
-rw-r--r--sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c8
2 files changed, 10 insertions, 11 deletions
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c b/sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c
index fba4822900..87176c34c9 100644
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c
+++ b/sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c
@@ -55,13 +55,14 @@ __logb (double x)
/* POSIX specifies that denormal numbers are treated as
though they were normalized. */
int32_t lx, ix;
- int m1, m2, ma;
+ int ma;
- EXTRACT_WORDS (ix , lx, x);
- m1 = (ix == 0) ? 0 : __builtin_clz (ix);
- m2 = (lx == 0) ? 0 : __builtin_clz (lx);
- ma = (m1 == 0) ? m2 + 32 : m1;
- return -1022.0 + (double)(11 - ma);
+ EXTRACT_WORDS (ix, lx, x);
+ if (ix == 0)
+ ma = __builtin_clz (lx) + 32;
+ else
+ ma = __builtin_clz (ix);
+ return (double) (-1023 - (ma - 12));
}
/* Test to avoid logb_downward (0.0) == -0.0. */
return ret == -0.0 ? 0.0 : ret;
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c b/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c
index 03942ca53d..20c7d4e6e9 100644
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c
+++ b/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c
@@ -56,14 +56,12 @@ __logbl (long double x)
return (xh * xh);
else if (__builtin_expect (ret == two10m1, 0))
{
+ /* POSIX specifies that denormal number is treated as
+ though it were normalized. */
int64_t lx, hx;
- int m1, m2, ma;
GET_LDOUBLE_WORDS64 (hx, lx, x);
- m1 = (hx == 0) ? 0 : __builtin_clzll (hx);
- m2 = (lx == 0) ? 0 : __builtin_clzll (lx);
- ma = (m1 == 0) ? m2 + 64 : m1;
- return -1022.0 + (double)(11 - ma);
+ return (long double) (-1023 - (__builtin_clzll (hx) - 12));
}
/* Test to avoid logb_downward (0.0) == -0.0. */
return ret == -0.0 ? 0.0 : ret;