This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[COMMITTED] Fix POWER7 logb results for negative subnormals (bug 19375)
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-alpha at sourceware dot org
- Date: Thu, 17 Dec 2015 14:37:25 -0200
- Subject: [COMMITTED] Fix POWER7 logb results for negative subnormals (bug 19375)
- Authentication-results: sourceware.org; auth=none
The optimized POWER7 logb implementation does not use the absolute
value of the word extracted from the input to apply the leading 0-bits
builtin (to ignore the float sign). This patch fixes it by
clearing the signal bit in the resulting word.
It fixes the subnormal tests failures when running on POWER7 ou
newer chip.
Tested on powerpc64le (POWER8).
[BZ# 19375]
* sysdeps/powerpc/power7/fpu/s_logb.c (__logb): Fix return for
negative subnormals.
---
sysdeps/powerpc/power7/fpu/s_logb.c | 1 +
2 files changed, 6 insertions(+)
diff --git a/sysdeps/powerpc/power7/fpu/s_logb.c b/sysdeps/powerpc/power7/fpu/s_logb.c
index c5feb67..abd1c2a 100644
--- a/sysdeps/powerpc/power7/fpu/s_logb.c
+++ b/sysdeps/powerpc/power7/fpu/s_logb.c
@@ -58,6 +58,7 @@ __logb (double x)
int ma;
EXTRACT_WORDS (ix, lx, x);
+ ix &= 0x7fffffff;
if (ix == 0)
ma = __builtin_clz (lx) + 32;
else
--
1.9.1