This is the mail archive of the glibc-cvs@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]

GNU C Library master sources branch, master, updated. glibc-2.14-339-g7edb55c


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  7edb55ce06ab1fa716a062cd1cb6682585bb449d (commit)
      from  187da0aedcd9d0a2fb34477bef41549681ba1273 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7edb55ce06ab1fa716a062cd1cb6682585bb449d

commit 7edb55ce06ab1fa716a062cd1cb6682585bb449d
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sat Oct 8 10:18:26 2011 -0400

    Optimize use of isnan, isinf, finite

diff --git a/ChangeLog b/ChangeLog
index db3a61b..57a72ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,41 @@
 2011-10-08  Ulrich Drepper  <drepper@gmail.com>
 
+	* include/math.h: Declare __isinf_ns, __isinf_nsf, __isinf_nsl.
+	* sysdeps/ieee754/dbl-64/s_isinf_ns.c: New file.
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c: New file.
+	* sysdeps/ieee754/flt-32/s_isinf_nsf.c: New file.
+	* sysdeps/ieee754/ldbl-128/s_isinf_nsl.c: New file.
+	* sysdeps/ieee754/ldbl-96/s_isinf_nsl.c: New file.
+	* math/Makefile (libm-calls): Add s_isinf_ns.
+	* math/divtc3.c: Use __isinf_nsl instead of isinf.
+	* math/multc3.c: Likewise.
+	* math/s_casin.c: Likewise.
+	* math/s_casinf.c: Likewise.
+	* math/s_casinl.c: Likewise.
+	* math/s_ccos.c: Likewise.
+	* math/s_ccosf.c: Likewise.
+	* math/s_ccosl.c: Likewise.
+	* math/s_ctan.c: Likewise.
+	* math/s_ctanf.c: Likewise.
+	* math/s_ctanh.c: Likewise.
+	* math/s_ctanhf.c: Likewise.
+	* math/s_ctanhl.c: Likewise.
+	* math/s_ctanl.c: Likewise.
+	* math/w_fmod.c: Likewise.
+	* math/w_fmodf.c: Likewise.
+	* math/w_fmodl.c: Likewise.
+	* math/w_remainder.c: Likewise.
+	* math/w_remainderf.c: Likewise.
+	* math/w_remainderl.c: Likewise.
+	* sysdeps/ieee754/dbl-64/s_finite.c: Undefine __finite.
+	* sysdeps/ieee754/dbl-64/s_isnan.c: Undefine __isnan.
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c: Undefine __finite.
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: Undefine __nan.
+	* sysdeps/ieee754/flt-32/s_finitef.c: Undefine __finitef.
+	* sysdeps/ieee754/flt-32/s_isnanf.c: Undefine __nan.
+	* sysdeps/x86_64/fpu/math_private.h: Add optimized versions of __isnsn,
+	__isnanf, __isinf_ns, __isinf_nsf, __finite, and __finitef.
+
 	* stdio-common/printf_fp.c: Use the fact that isinf returns the sign
 	of the number.
 	* stdio-common/printf_fphex.c: Likewise.
diff --git a/include/math.h b/include/math.h
index eb29ef1..3934880 100644
--- a/include/math.h
+++ b/include/math.h
@@ -31,4 +31,8 @@ libm_hidden_proto (__expl)
 libm_hidden_proto (__expm1l)
 # endif
 
+extern int __isinf_ns (double);
+extern int __isinf_nsf (float);
+extern int __isinf_nsl (long double);
+
 #endif
diff --git a/math/Makefile b/math/Makefile
index 45954e2..25cb5f6 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996-2001,2002,2003,2004,2005,2006
+# Copyright (C) 1996-2001,2002,2003,2004,2005,2006,2011
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -60,7 +60,7 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod	\
 	     s_catan s_casin s_ccos s_csin s_ctan s_ctanh s_cacos	\
 	     s_casinh s_cacosh s_catanh s_csqrt s_cpow s_cproj s_clog10 \
 	     s_fma s_lrint s_llrint s_lround s_llround e_exp10 w_log2	\
-	     $(calls:s_%=m_%)
+	     s_isinf_ns $(calls:s_%=m_%)
 
 include ../Makeconfig
 
diff --git a/math/divtc3.c b/math/divtc3.c
index d974ae6..72bca66 100644
--- a/math/divtc3.c
+++ b/math/divtc3.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <rth@redhat.com>, 2005.
 
@@ -55,17 +55,19 @@ __divtc3 (long double a, long double b, long double c, long double d)
 	  x = __copysignl (INFINITY, c) * a;
 	  y = __copysignl (INFINITY, c) * b;
 	}
-      else if ((isinf (a) || isinf (b)) && isfinite (c) && isfinite (d))
+      else if ((__isinf_nsl (a) || __isinf_nsl (b))
+	       && isfinite (c) && isfinite (d))
 	{
-	  a = __copysignl (isinf (a) ? 1 : 0, a);
-	  b = __copysignl (isinf (b) ? 1 : 0, b);
+	  a = __copysignl (__isinf_nsl (a) ? 1 : 0, a);
+	  b = __copysignl (__isinf_nsl (b) ? 1 : 0, b);
 	  x = INFINITY * (a * c + b * d);
 	  y = INFINITY * (b * c - a * d);
 	}
-      else if ((isinf (c) || isinf (d)) && isfinite (a) && isfinite (b))
+      else if ((__isinf_nsl (c) || __isinf_nsl (d))
+	       && isfinite (a) && isfinite (b))
 	{
-	  c = __copysignl (isinf (c) ? 1 : 0, c);
-	  d = __copysignl (isinf (d) ? 1 : 0, d);
+	  c = __copysignl (__isinf_nsl (c) ? 1 : 0, c);
+	  d = __copysignl (__isinf_nsl (d) ? 1 : 0, d);
 	  x = 0.0 * (a * c + b * d);
 	  y = 0.0 * (b * c - a * d);
 	}
diff --git a/math/multc3.c b/math/multc3.c
index 6369f48..351dccf 100644
--- a/math/multc3.c
+++ b/math/multc3.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <rth@redhat.com>, 2005.
 
@@ -39,28 +39,29 @@ __multc3 (long double a, long double b, long double c, long double d)
     {
       /* Recover infinities that computed as NaN + iNaN.  */
       bool recalc = 0;
-      if (isinf (a) || isinf (b))
+      if (__isinf_nsl (a) || __isinf_nsl (b))
 	{
 	  /* z is infinite.  "Box" the infinity and change NaNs in
 	     the other factor to 0.  */
-	  a = __copysignl (isinf (a) ? 1 : 0, a);
-	  b = __copysignl (isinf (b) ? 1 : 0, b);
+	  a = __copysignl (__isinf_nsl (a) ? 1 : 0, a);
+	  b = __copysignl (__isinf_nsl (b) ? 1 : 0, b);
 	  if (isnan (c)) c = __copysignl (0, c);
 	  if (isnan (d)) d = __copysignl (0, d);
 	  recalc = 1;
 	}
-     if (isinf (c) || isinf (d))
+     if (__isinf_nsl (c) || __isinf_nsl (d))
 	{
 	  /* w is infinite.  "Box" the infinity and change NaNs in
 	     the other factor to 0.  */
-	  c = __copysignl (isinf (c) ? 1 : 0, c);
-	  d = __copysignl (isinf (d) ? 1 : 0, d);
+	  c = __copysignl (__isinf_nsl (c) ? 1 : 0, c);
+	  d = __copysignl (__isinf_nsl (d) ? 1 : 0, d);
 	  if (isnan (a)) a = __copysignl (0, a);
 	  if (isnan (b)) b = __copysignl (0, b);
 	  recalc = 1;
 	}
      if (!recalc
-	  && (isinf (ac) || isinf (bd) || isinf (ad) || isinf (bc)))
+	  && (__isinf_nsl (ac) || __isinf_nsl (bd)
+	      || __isinf_nsl (ad) || __isinf_nsl (bc)))
 	{
 	  /* Recover infinities from overflow by changing NaNs to 0.  */
 	  if (isnan (a)) a = __copysignl (0, a);
diff --git a/math/s_casin.c b/math/s_casin.c
index 2d5b06c..02a215a 100644
--- a/math/s_casin.c
+++ b/math/s_casin.c
@@ -1,5 +1,5 @@
 /* Return arc sine of complex double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,6 +20,7 @@
 
 #include <complex.h>
 #include <math.h>
+#include <math_private.h>
 
 
 __complex__ double
@@ -33,7 +34,7 @@ __casin (__complex__ double x)
 	{
 	  res = x;
 	}
-      else if (__isinf (__real__ x) || __isinf (__imag__ x))
+      else if (__isinf_ns (__real__ x) || __isinf_ns (__imag__ x))
 	{
 	  __real__ res = __nan ("");
 	  __imag__ res = __copysign (HUGE_VAL, __imag__ x);
diff --git a/math/s_casinf.c b/math/s_casinf.c
index 5278dbb..56c618f 100644
--- a/math/s_casinf.c
+++ b/math/s_casinf.c
@@ -1,5 +1,5 @@
 /* Return arc sine of complex float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,6 +20,7 @@
 
 #include <complex.h>
 #include <math.h>
+#include <math_private.h>
 
 
 __complex__ float
@@ -33,7 +34,7 @@ __casinf (__complex__ float x)
 	{
 	  res = x;
 	}
-      else if (__isinff (__real__ x) || __isinff (__imag__ x))
+      else if (__isinf_nsf (__real__ x) || __isinf_nsf (__imag__ x))
 	{
 	  __real__ res = __nanf ("");
 	  __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
diff --git a/math/s_casinl.c b/math/s_casinl.c
index f303c05..431e9a2 100644
--- a/math/s_casinl.c
+++ b/math/s_casinl.c
@@ -1,5 +1,5 @@
 /* Return arc sine of complex long double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,6 +20,7 @@
 
 #include <complex.h>
 #include <math.h>
+#include <math_private.h>
 
 
 __complex__ long double
@@ -33,7 +34,7 @@ __casinl (__complex__ long double x)
 	{
 	  res = x;
 	}
-      else if (__isinfl (__real__ x) || __isinfl (__imag__ x))
+      else if (__isinf_nsl (__real__ x) || __isinf_nsl (__imag__ x))
 	{
 	  __real__ res = __nanl ("");
 	  __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
diff --git a/math/s_ccos.c b/math/s_ccos.c
index 1b244d7..63851aa 100644
--- a/math/s_ccos.c
+++ b/math/s_ccos.c
@@ -1,5 +1,5 @@
 /* Return cosine of complex double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -21,6 +21,7 @@
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
+#include <math_private.h>
 
 
 __complex__ double
@@ -36,17 +37,17 @@ __ccos (__complex__ double x)
 	  __imag__ res = 0.0;
 
 #ifdef FE_INVALID
-	  if (__isinf (__real__ x))
+	  if (__isinf_ns (__real__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
-      else if (__isinf (__imag__ x))
+      else if (__isinf_ns (__imag__ x))
 	{
 	  __real__ res = HUGE_VAL;
 	  __imag__ res = __nan ("");
 
 #ifdef FE_INVALID
-	  if (__isinf (__real__ x))
+	  if (__isinf_ns (__real__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
diff --git a/math/s_ccosf.c b/math/s_ccosf.c
index 4b154de..f0e9c2a 100644
--- a/math/s_ccosf.c
+++ b/math/s_ccosf.c
@@ -1,5 +1,5 @@
 /* Return cosine of complex float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -21,6 +21,7 @@
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
+#include <math_private.h>
 
 
 __complex__ float
@@ -36,17 +37,17 @@ __ccosf (__complex__ float x)
 	  __imag__ res = 0.0;
 
 #ifdef FE_INVALID
-	  if (__isinff (__real__ x))
+	  if (__isinf_nsf (__real__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
-      else if (__isinff (__imag__ x))
+      else if (__isinf_nsf (__imag__ x))
 	{
 	  __real__ res = HUGE_VALF;
 	  __imag__ res = __nanf ("");
 
 #ifdef FE_INVALID
-	  if (__isinff (__real__ x))
+	  if (__isinf_nsf (__real__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
diff --git a/math/s_ccosl.c b/math/s_ccosl.c
index 4ebe2c3..9902a02 100644
--- a/math/s_ccosl.c
+++ b/math/s_ccosl.c
@@ -1,5 +1,5 @@
 /* Return cosine of complex long double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -21,6 +21,7 @@
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
+#include <math_private.h>
 
 
 __complex__ long double
@@ -36,17 +37,17 @@ __ccosl (__complex__ long double x)
 	  __imag__ res = 0.0;
 
 #ifdef FE_INVALID
-	  if (__isinfl (__real__ x))
+	  if (__isinf_nsl (__real__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
-      else if (__isinfl (__imag__ x))
+      else if (__isinf_nsl (__imag__ x))
 	{
 	  __real__ res = HUGE_VALL;
 	  __imag__ res = __nanl ("");
 
 #ifdef FE_INVALID
-	  if (__isinfl (__real__ x))
+	  if (__isinf_nsl (__real__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
diff --git a/math/s_ctan.c b/math/s_ctan.c
index 4cadad1..0dd211e 100644
--- a/math/s_ctan.c
+++ b/math/s_ctan.c
@@ -1,5 +1,5 @@
 /* Complex tangent function for double.
-   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -32,7 +32,7 @@ __ctan (__complex__ double x)
 
   if (!isfinite (__real__ x) || !isfinite (__imag__ x))
     {
-      if (__isinf (__imag__ x))
+      if (__isinf_ns (__imag__ x))
 	{
 	  __real__ res = __copysign (0.0, __real__ x);
 	  __imag__ res = __copysign (1.0, __imag__ x);
@@ -47,7 +47,7 @@ __ctan (__complex__ double x)
 	  __imag__ res = __nan ("");
 
 #ifdef FE_INVALID
-	  if (__isinf (__real__ x))
+	  if (__isinf_ns (__real__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
diff --git a/math/s_ctanf.c b/math/s_ctanf.c
index 7fa1620..7236dc3 100644
--- a/math/s_ctanf.c
+++ b/math/s_ctanf.c
@@ -1,5 +1,5 @@
 /* Complex tangent function for float.
-   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -32,7 +32,7 @@ __ctanf (__complex__ float x)
 
   if (!isfinite (__real__ x) || !isfinite (__imag__ x))
     {
-      if (__isinff (__imag__ x))
+      if (__isinf_nsf (__imag__ x))
 	{
 	  __real__ res = __copysignf (0.0, __real__ x);
 	  __imag__ res = __copysignf (1.0, __imag__ x);
@@ -47,7 +47,7 @@ __ctanf (__complex__ float x)
 	  __imag__ res = __nanf ("");
 
 #ifdef FE_INVALID
-	  if (__isinff (__real__ x))
+	  if (__isinf_nsf (__real__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
diff --git a/math/s_ctanh.c b/math/s_ctanh.c
index 60a52db..f4a1d7e 100644
--- a/math/s_ctanh.c
+++ b/math/s_ctanh.c
@@ -1,5 +1,5 @@
 /* Complex hyperbole tangent for double.
-   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -32,7 +32,7 @@ __ctanh (__complex__ double x)
 
   if (!isfinite (__real__ x) || !isfinite (__imag__ x))
     {
-      if (__isinf (__real__ x))
+      if (__isinf_ns (__real__ x))
 	{
 	  __real__ res = __copysign (1.0, __real__ x);
 	  __imag__ res = __copysign (0.0, __imag__ x);
@@ -47,7 +47,7 @@ __ctanh (__complex__ double x)
 	  __imag__ res = __nan ("");
 
 #ifdef FE_INVALID
-	  if (__isinf (__imag__ x))
+	  if (__isinf_ns (__imag__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
diff --git a/math/s_ctanhf.c b/math/s_ctanhf.c
index 1d62afc..cb65edb 100644
--- a/math/s_ctanhf.c
+++ b/math/s_ctanhf.c
@@ -1,5 +1,5 @@
 /* Complex hyperbole tangent for float.
-   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -32,7 +32,7 @@ __ctanhf (__complex__ float x)
 
   if (!isfinite (__real__ x) || !isfinite (__imag__ x))
     {
-      if (__isinff (__real__ x))
+      if (__isinf_nsf (__real__ x))
 	{
 	  __real__ res = __copysignf (1.0, __real__ x);
 	  __imag__ res = __copysignf (0.0, __imag__ x);
@@ -47,7 +47,7 @@ __ctanhf (__complex__ float x)
 	  __imag__ res = __nanf ("");
 
 #ifdef FE_INVALID
-	  if (__isinff (__imag__ x))
+	  if (__isinf_nsf (__imag__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
diff --git a/math/s_ctanhl.c b/math/s_ctanhl.c
index 99df2b0..bee9e76 100644
--- a/math/s_ctanhl.c
+++ b/math/s_ctanhl.c
@@ -1,5 +1,5 @@
 /* Complex hyperbole tangent for long double.
-   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -32,7 +32,7 @@ __ctanhl (__complex__ long double x)
 
   if (!isfinite (__real__ x) || !isfinite (__imag__ x))
     {
-      if (__isinfl (__real__ x))
+      if (__isinf_nsl (__real__ x))
 	{
 	  __real__ res = __copysignl (1.0, __real__ x);
 	  __imag__ res = __copysignl (0.0, __imag__ x);
@@ -47,7 +47,7 @@ __ctanhl (__complex__ long double x)
 	  __imag__ res = __nanl ("");
 
 #ifdef FE_INVALID
-	  if (__isinfl (__imag__ x))
+	  if (__isinf_nsl (__imag__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
diff --git a/math/s_ctanl.c b/math/s_ctanl.c
index 4a95c1d..fcc0da9 100644
--- a/math/s_ctanl.c
+++ b/math/s_ctanl.c
@@ -1,5 +1,5 @@
 /* Complex tangent function for long double.
-   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -32,7 +32,7 @@ __ctanl (__complex__ long double x)
 
   if (!isfinite (__real__ x) || !isfinite (__imag__ x))
     {
-      if (__isinfl (__imag__ x))
+      if (__isinf_nsl (__imag__ x))
 	{
 	  __real__ res = __copysignl (0.0, __real__ x);
 	  __imag__ res = __copysignl (1.0, __imag__ x);
@@ -47,7 +47,7 @@ __ctanl (__complex__ long double x)
 	  __imag__ res = __nanl ("");
 
 #ifdef FE_INVALID
-	  if (__isinfl (__real__ x))
+	  if (__isinf_nsl (__real__ x))
 	    feraiseexcept (FE_INVALID);
 #endif
 	}
diff --git a/math/w_fmod.c b/math/w_fmod.c
index 69102de..b93ff89 100644
--- a/math/w_fmod.c
+++ b/math/w_fmod.c
@@ -35,9 +35,9 @@ static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $";
 	double z;
 	z = __ieee754_fmod(x,y);
 	if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z;
-	if(__isinf(x)||y==0.0) {
+	if(__isinf_ns(x)||y==0.0) {
 		/* fmod(+-Inf,y) or fmod(x,0) */
-	        return __kernel_standard(x,y,27);
+		return __kernel_standard(x,y,27);
 	} else
 	    return z;
 #endif
diff --git a/math/w_fmodf.c b/math/w_fmodf.c
index 55ec873..12e2fb3 100644
--- a/math/w_fmodf.c
+++ b/math/w_fmodf.c
@@ -38,9 +38,9 @@ static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
 	float z;
 	z = __ieee754_fmodf(x,y);
 	if(_LIB_VERSION == _IEEE_ ||__isnanf(y)||__isnanf(x)) return z;
-	if(__isinff(x)||y==(float)0.0) {
+	if(__isinf_nsf(x)||y==(float)0.0) {
 		/* fmodf(+-Inf,y) or fmodf(x,0) */
-	        return (float)__kernel_standard((double)x,(double)y,127);
+		return (float)__kernel_standard((double)x,(double)y,127);
 	} else
 	    return z;
 #endif
diff --git a/math/w_fmodl.c b/math/w_fmodl.c
index c95e232..ffc77ad 100644
--- a/math/w_fmodl.c
+++ b/math/w_fmodl.c
@@ -39,9 +39,9 @@ static char rcsid[] = "$NetBSD: $";
 	long double z;
 	z = __ieee754_fmodl(x,y);
 	if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z;
-	if(__isinfl(x)||y==0.0) {
+	if(__isinf_nsl(x)||y==0.0) {
 		/* fmodl(+-Inf,y) or fmodl(x,0) */
-	        return __kernel_standard(x,y,227);
+		return __kernel_standard(x,y,227);
 	} else
 	    return z;
 #endif
diff --git a/math/w_remainder.c b/math/w_remainder.c
index 087bf23..cf35ee2 100644
--- a/math/w_remainder.c
+++ b/math/w_remainder.c
@@ -34,7 +34,7 @@ static char rcsid[] = "$NetBSD: w_remainder.c,v 1.6 1995/05/10 20:49:44 jtc Exp
 	double z;
 	z = __ieee754_remainder(x,y);
 	if(_LIB_VERSION == _IEEE_ || __isnan(y) || __isnan(x)) return z;
-	if(y==0.0 || __isinf(x))
+	if(y==0.0 || __isinf_ns(x))
 	    return __kernel_standard(x,y,28); /* remainder(x,0) */
 	else
 	    return z;
diff --git a/math/w_remainderf.c b/math/w_remainderf.c
index 95e6d30..39d01b3 100644
--- a/math/w_remainderf.c
+++ b/math/w_remainderf.c
@@ -37,7 +37,7 @@ static char rcsid[] = "$NetBSD: w_remainderf.c,v 1.3 1995/05/10 20:49:46 jtc Exp
 	float z;
 	z = __ieee754_remainderf(x,y);
 	if(_LIB_VERSION == _IEEE_ || __isnanf(y) || __isnanf(x)) return z;
-	if(y==(float)0.0 || __isinff(x))
+	if(y==(float)0.0 || __isinf_nsf(x))
 	    /* remainder(x,0) */
 	    return (float)__kernel_standard((double)x,(double)y,128);
 	else
diff --git a/math/w_remainderl.c b/math/w_remainderl.c
index 36050f0..dec70e5 100644
--- a/math/w_remainderl.c
+++ b/math/w_remainderl.c
@@ -39,7 +39,7 @@ static char rcsid[] = "$NetBSD: $";
 	long double z;
 	z = __ieee754_remainderl(x,y);
 	if(_LIB_VERSION == _IEEE_ || __isnanl(y) || __isnanl(x)) return z;
-	if(y==0.0 || __isinfl(x))
+	if(y==0.0 || __isinf_nsl(x))
 	    return __kernel_standard(x,y,228); /* remainder(x,0) */
 	else
 	    return z;
diff --git a/sysdeps/ieee754/dbl-64/s_finite.c b/sysdeps/ieee754/dbl-64/s_finite.c
index 90de0f9..2ca3bf2 100644
--- a/sysdeps/ieee754/dbl-64/s_finite.c
+++ b/sysdeps/ieee754/dbl-64/s_finite.c
@@ -22,6 +22,7 @@ static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $";
 #include "math.h"
 #include "math_private.h"
 
+#undef __finite
 #ifdef __STDC__
 	int __finite(double x)
 #else
diff --git a/sysdeps/ieee754/dbl-64/s_isinf_ns.c b/sysdeps/ieee754/dbl-64/s_isinf_ns.c
new file mode 100644
index 0000000..065522e
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/s_isinf_ns.c
@@ -0,0 +1,20 @@
+/*
+ * Written by Ulrich Drepper <drepper@gmail.com>.
+ */
+
+/*
+ * __isinf_ns(x) returns != 0 if x is ±inf, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#undef __isinf_ns
+int
+__isinf_ns (double x)
+{
+	int32_t hx,lx;
+	EXTRACT_WORDS(hx,lx,x);
+	return !(lx | ((hx & 0x7fffffff) ^ 0x7ff00000));
+}
diff --git a/sysdeps/ieee754/dbl-64/s_isnan.c b/sysdeps/ieee754/dbl-64/s_isnan.c
index 3a089e9..74e8291 100644
--- a/sysdeps/ieee754/dbl-64/s_isnan.c
+++ b/sysdeps/ieee754/dbl-64/s_isnan.c
@@ -22,6 +22,7 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
 #include "math.h"
 #include "math_private.h"
 
+#undef __isnan
 #ifdef __STDC__
 	int __isnan(double x)
 #else
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
index 585f63e..93a39a6 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
@@ -17,6 +17,7 @@
 #include "math.h"
 #include "math_private.h"
 
+#undef __finite
 int
 __finite(double x)
 {
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c
new file mode 100644
index 0000000..09dcc94
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c
@@ -0,0 +1,20 @@
+/*
+ * Written by Ulrich Drepper <drepper@gmail.com>.
+ */
+
+/*
+ * __isinf_ns(x) returns != 0 if x is ±inf, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#undef __isinf_ns
+int
+__isinf_ns (double x)
+{
+	int64_t ix;
+	EXTRACT_WORDS64(ix,x);
+	return (ix & UINT64_C(0x7fffffffffffffff)) == UINT64_C(0x7ff0000000000000);
+}
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
index 3b08c54..65dc893 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
@@ -18,6 +18,7 @@
 #include "math.h"
 #include "math_private.h"
 
+#undef __isnan
 #ifdef __STDC__
 	int __isnan(double x)
 #else
diff --git a/sysdeps/ieee754/flt-32/s_finitef.c b/sysdeps/ieee754/flt-32/s_finitef.c
index 65767f8..2df513b 100644
--- a/sysdeps/ieee754/flt-32/s_finitef.c
+++ b/sysdeps/ieee754/flt-32/s_finitef.c
@@ -25,6 +25,7 @@ static char rcsid[] = "$NetBSD: s_finitef.c,v 1.4 1995/05/10 20:47:18 jtc Exp $"
 #include "math.h"
 #include "math_private.h"
 
+#undef __finitef
 #ifdef __STDC__
 	int __finitef(float x)
 #else
diff --git a/sysdeps/ieee754/flt-32/s_isinf_nsf.c b/sysdeps/ieee754/flt-32/s_isinf_nsf.c
new file mode 100644
index 0000000..bc37785
--- /dev/null
+++ b/sysdeps/ieee754/flt-32/s_isinf_nsf.c
@@ -0,0 +1,20 @@
+/*
+ * Written by Ulrich Drepper <drepper@gmail.com>.
+ */
+
+/*
+ * __isinf_nsf(x) returns != 0 if x is ±inf, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#undef __isinf_nsf
+int
+__isinf_nsf (float x)
+{
+	int32_t ix,t;
+	GET_FLOAT_WORD(ix,x);
+	return (ix & 0x7fffffff) == 0x7f800000;
+}
diff --git a/sysdeps/ieee754/flt-32/s_isnanf.c b/sysdeps/ieee754/flt-32/s_isnanf.c
index 4ac16c2..1b1b247 100644
--- a/sysdeps/ieee754/flt-32/s_isnanf.c
+++ b/sysdeps/ieee754/flt-32/s_isnanf.c
@@ -4,7 +4,7 @@
 
 /*
  * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ * Copyright (C) 1993, 2011 by Sun Microsystems, Inc. All rights reserved.
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
@@ -25,6 +25,7 @@ static char rcsid[] = "$NetBSD: s_isnanf.c,v 1.4 1995/05/10 20:47:38 jtc Exp $";
 #include "math.h"
 #include "math_private.h"
 
+#undef __isnanf
 #ifdef __STDC__
 	int __isnanf(float x)
 #else
diff --git a/sysdeps/ieee754/ldbl-128/s_isinf_nsl.c b/sysdeps/ieee754/ldbl-128/s_isinf_nsl.c
new file mode 100644
index 0000000..1ebc1ac
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128/s_isinf_nsl.c
@@ -0,0 +1,19 @@
+/*
+ * Written by Ulrich Drepper <drepper@gmail.com>
+ */
+
+/*
+ * __isinf_nsl(x) returns != 0 if x is ±inf, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+int
+__isinf_nsl (long double x)
+{
+	int64_t hx,lx;
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	return !(lx | ((hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL));
+}
diff --git a/sysdeps/ieee754/ldbl-96/s_isinf_nsl.c b/sysdeps/ieee754/ldbl-96/s_isinf_nsl.c
new file mode 100644
index 0000000..aa59030
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-96/s_isinf_nsl.c
@@ -0,0 +1,18 @@
+/*
+ * Written by Ulrich Drepper <drepper@gmail.com>.
+ */
+
+/*
+ * __isinf_nsl(x) returns != 0 if x is ±inf, else 0;
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+int
+__isinf_nsl (long double x)
+{
+	int32_t se,hx,lx;
+	GET_LDOUBLE_WORDS(se,hx,lx,x);
+	return !(((se & 0x7fff) ^ 0x7fff) | lx | (hx & 0x7fffffff));
+}
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 4be7536..37357d3 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -56,3 +56,24 @@ do {								\
 } while (0)
 
 #endif
+
+#define __isnan(d) \
+  ({ long int __di; EXTRACT_WORDS64 (__di, d);				      \
+     (__di & 0x7fffffffffffffffl) > 0x7ff0000000000000l; })
+#define __isnanf(d) \
+  ({ int __di; GET_FLOAT_WORD (__di, d);				      \
+     (__di & 0x7fffffff) > 0x7f800000; })
+
+#define __isinf_ns(d) \
+  ({ long int __di; EXTRACT_WORDS64 (__di, d);				      \
+     (__di & 0x7fffffffffffffffl) == 0x7ff0000000000000l; })
+#define __isinf_nsf(d) \
+  ({ int __di; GET_FLOAT_WORD (__di, d);				      \
+     (__di & 0x7fffffff) == 0x7f800000; })
+
+#define __finite(d) \
+  ({ long int __di; EXTRACT_WORDS64 (__di, d);				      \
+     (__di & 0x7fffffffffffffffl) < 0x7ff0000000000000l; })
+#define __finitef(d) \
+  ({ int __di; GET_FLOAT_WORD (__di, d);				      \
+     (__di & 0x7fffffff) < 0x7f800000; })

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                       |   36 +++++++++++++++++++++++
 include/math.h                                  |    4 ++
 math/Makefile                                   |    4 +-
 math/divtc3.c                                   |   16 ++++++----
 math/multc3.c                                   |   17 ++++++-----
 math/s_casin.c                                  |    5 ++-
 math/s_casinf.c                                 |    5 ++-
 math/s_casinl.c                                 |    5 ++-
 math/s_ccos.c                                   |    9 +++--
 math/s_ccosf.c                                  |    9 +++--
 math/s_ccosl.c                                  |    9 +++--
 math/s_ctan.c                                   |    6 ++--
 math/s_ctanf.c                                  |    6 ++--
 math/s_ctanh.c                                  |    6 ++--
 math/s_ctanhf.c                                 |    6 ++--
 math/s_ctanhl.c                                 |    6 ++--
 math/s_ctanl.c                                  |    6 ++--
 math/w_fmod.c                                   |    4 +-
 math/w_fmodf.c                                  |    4 +-
 math/w_fmodl.c                                  |    4 +-
 math/w_remainder.c                              |    2 +-
 math/w_remainderf.c                             |    2 +-
 math/w_remainderl.c                             |    2 +-
 sysdeps/ieee754/dbl-64/s_finite.c               |    1 +
 sysdeps/ieee754/dbl-64/s_isinf_ns.c             |   20 ++++++++++++
 sysdeps/ieee754/dbl-64/s_isnan.c                |    1 +
 sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c   |    1 +
 sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c |   20 ++++++++++++
 sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c    |    1 +
 sysdeps/ieee754/flt-32/s_finitef.c              |    1 +
 sysdeps/ieee754/flt-32/s_isinf_nsf.c            |   20 ++++++++++++
 sysdeps/ieee754/flt-32/s_isnanf.c               |    3 +-
 sysdeps/ieee754/ldbl-128/s_isinf_nsl.c          |   19 ++++++++++++
 sysdeps/ieee754/ldbl-96/s_isinf_nsl.c           |   18 +++++++++++
 sysdeps/x86_64/fpu/math_private.h               |   21 +++++++++++++
 35 files changed, 236 insertions(+), 63 deletions(-)
 create mode 100644 sysdeps/ieee754/dbl-64/s_isinf_ns.c
 create mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c
 create mode 100644 sysdeps/ieee754/flt-32/s_isinf_nsf.c
 create mode 100644 sysdeps/ieee754/ldbl-128/s_isinf_nsl.c
 create mode 100644 sysdeps/ieee754/ldbl-96/s_isinf_nsl.c


hooks/post-receive
-- 
GNU C Library master sources


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