This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PowerPC: Fix for POWER7 sinf/cosf


Fix some underflow generations for the sinf/cosf optimization for POWER7.

Tested on ppc32 and ppc64.

---

2012-05-29  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>

	* sysdeps/powerpc/fpu/k_cosf.c: Fix underflow generation.
	* sysdeps/powerpc/fpu/k_sinf.c: Likewise.


diff --git a/sysdeps/powerpc/fpu/k_cosf.c b/sysdeps/powerpc/fpu/k_cosf.c
index e2571d6..329938b 100644
--- a/sysdeps/powerpc/fpu/k_cosf.c
+++ b/sysdeps/powerpc/fpu/k_cosf.c
@@ -40,8 +40,8 @@ __kernel_cosf (float x, float y)
   ix = __builtin_fabsf (x);
   if (ix < twom27)
     {				/* |x| < 2**-27 */
-      if (x == 0.0)
-	return one;
+      feraiseexcept (FE_INEXACT);
+      return one;
     }
   z = x * x;
   r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6)))));
diff --git a/sysdeps/powerpc/fpu/k_sinf.c b/sysdeps/powerpc/fpu/k_sinf.c
index ab4561e..632d257 100644
--- a/sysdeps/powerpc/fpu/k_sinf.c
+++ b/sysdeps/powerpc/fpu/k_sinf.c
@@ -39,8 +39,8 @@ __kernel_sinf (float x, float y, int iy)
   ix = __builtin_fabsf (x);
   if (ix < twom27)
     {				/* |x| < 2**-27 */
-      if (x == 0.0)
-	return x;
+      feraiseexcept (FE_INEXACT);
+      return x;
     }
   z = x * x;
   v = z * x;
-- 
1.6.0.2


-- 
Adhemerval Zanella Netto
  Software Engineer
  Linux Technology Center Brazil
  Toolchain / GLIBC on Power Architecture
  azanella@linux.vnet.ibm.com / azanella@br.ibm.com
  +55 61 8642-9890


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]