summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-05-26 20:24:08 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-05-26 20:24:08 +0000
commit47023889431f41fa4e408ba468096b7040caaa11 (patch)
tree11d6fc1c1eb971e3177650edbe3c7f3d1d6361c9 /libc/sysdeps
parenta2c69819561df393e300481562d300f12ee5bc69 (diff)
Merge changes between r18730 and r18761 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@18762 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_logb.c10
-rw-r--r--libc/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c4
-rw-r--r--libc/sysdeps/ieee754/flt-32/s_logbf.c3
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/s_logbl.c10
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_logbl.c7
-rw-r--r--libc/sysdeps/ieee754/ldbl-96/s_logbl.c10
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c13
-rw-r--r--libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c8
8 files changed, 33 insertions, 32 deletions
diff --git a/libc/sysdeps/ieee754/dbl-64/s_logb.c b/libc/sysdeps/ieee754/dbl-64/s_logb.c
index baa35e14d..17aa94b75 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_logb.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_logb.c
@@ -34,10 +34,12 @@ __logb (double x)
{
/* POSIX specifies that denormal number is treated as
though it were normalized. */
- int m1 = (ix == 0) ? 0 : __builtin_clz (ix);
- int m2 = (lx == 0) ? 0 : __builtin_clz (lx);
- int ma = (m1 == 0) ? m2 + 32 : m1;
- return -1022.0 + (double)(11 - ma);
+ int ma;
+ if (ix == 0)
+ ma = __builtin_clz (lx) + 32;
+ else
+ ma = __builtin_clz (ix);
+ rix -= ma - 12;
}
return (double) (rix - 1023);
}
diff --git a/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
index 185dd05be..40b888813 100644
--- a/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
+++ b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
@@ -36,8 +36,8 @@ __logb (double x)
return x * x;
if (__builtin_expect (ex == 0, 0))
{
- int m = (ix == 0) ? 0 : __builtin_clzll (ix);
- return -1022.0 + (double)(11 -m);
+ int m = __builtin_clzll (ix);
+ ex -= m - 12;
}
return (double) (ex - 1023);
}
diff --git a/libc/sysdeps/ieee754/flt-32/s_logbf.c b/libc/sysdeps/ieee754/flt-32/s_logbf.c
index 025c70de7..e2b3aaa62 100644
--- a/libc/sysdeps/ieee754/flt-32/s_logbf.c
+++ b/libc/sysdeps/ieee754/flt-32/s_logbf.c
@@ -31,8 +31,7 @@ __logbf (float x)
{
/* POSIX specifies that denormal number is treated as
though it were normalized. */
- int m = (ix == 0) ? 0 : __builtin_clz (ix);
- return -126.0 + (float)(8 - m);
+ rix -= __builtin_clz (ix) - 9;
}
return (float) (rix - 127);
}
diff --git a/libc/sysdeps/ieee754/ldbl-128/s_logbl.c b/libc/sysdeps/ieee754/ldbl-128/s_logbl.c
index cf6003e05..3ba67b7bd 100644
--- a/libc/sysdeps/ieee754/ldbl-128/s_logbl.c
+++ b/libc/sysdeps/ieee754/ldbl-128/s_logbl.c
@@ -41,10 +41,12 @@ __logbl (long double x)
{
/* POSIX specifies that denormal number is treated as
though it were normalized. */
- int m1 = (hx == 0) ? 0 : __builtin_clzll (hx);
- int m2 = (lx == 0) ? 0 : __builtin_clzll (lx);
- int ma = (m1 == 0) ? m2 + 64 : m1;
- return -16382.0 + (long double)(15 - ma);
+ int ma;
+ if (hx == 0)
+ ma = __builtin_clzll (lx) + 64;
+ else
+ ma = __builtin_clzll (hx);
+ ex -= ma - 16;
}
return (long double) (ex - 16383);
}
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
index 678b6cad5..92ce2c189 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
@@ -30,7 +30,7 @@ __logbl (long double x)
GET_LDOUBLE_WORDS64 (hx, lx, x);
hx &= 0x7fffffffffffffffLL; /* high |x| */
- if ((hx | (lx & 0x7fffffffffffffffLL)) == 0)
+ if (hx == 0)
return -1.0 / fabs (x);
if (hx >= 0x7ff0000000000000LL)
return x * x;
@@ -38,10 +38,7 @@ __logbl (long double x)
{
/* POSIX specifies that denormal number is treated as
though it were normalized. */
- int m1 = (hx == 0) ? 0 : __builtin_clzll (hx);
- int m2 = (lx == 0) ? 0 : __builtin_clzll (lx);
- int ma = (m1 == 0) ? m2 + 64 : m1;
- return -1022.0 + (long double)(11 - ma);
+ rhx -= __builtin_clzll (hx) - 12;
}
return (long double) (rhx - 1023);
}
diff --git a/libc/sysdeps/ieee754/ldbl-96/s_logbl.c b/libc/sysdeps/ieee754/ldbl-96/s_logbl.c
index d8ad4bcfc..4289be193 100644
--- a/libc/sysdeps/ieee754/ldbl-96/s_logbl.c
+++ b/libc/sysdeps/ieee754/ldbl-96/s_logbl.c
@@ -38,10 +38,12 @@ __logbl (long double x)
{
/* POSIX specifies that denormal number is treated as
though it were normalized. */
- int m1 = (ix == 0) ? 0 : __builtin_clz (ix);
- int m2 = (lx == 0) ? 0 : __builtin_clz (lx);
- int ma = (m1 == 0) ? m2 + 32 : m1;
- return -16382.0 - (long double)(ma);
+ int ma;
+ if (ix == 0)
+ ma = __builtin_clz (lx) + 32;
+ else
+ ma = __builtin_clz (ix);
+ es -= ma - 1;
}
return (long double) (es - 16383);
}
diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c
index fba482290..87176c34c 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c
+++ b/libc/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/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c
index 03942ca53..20c7d4e6e 100644
--- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c
+++ b/libc/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;