Add branch predictions to complex math code
authorUlrich Drepper <drepper@gmail.com>
Sat, 22 Oct 2011 17:17:30 +0000 (13:17 -0400)
committerUlrich Drepper <drepper@gmail.com>
Sat, 22 Oct 2011 17:17:30 +0000 (13:17 -0400)
24 files changed:
ChangeLog
math/s_catan.c
math/s_catanf.c
math/s_catanh.c
math/s_catanhf.c
math/s_catanhl.c
math/s_catanl.c
math/s_cexp.c
math/s_cexpf.c
math/s_cexpl.c
math/s_clog.c
math/s_clog10.c
math/s_clog10f.c
math/s_clog10l.c
math/s_clogf.c
math/s_clogl.c
math/s_csqrt.c
math/s_csqrtf.c
math/s_csqrtl.c
math/s_ctanf.c
math/s_ctanh.c
math/s_ctanhf.c
math/s_ctanhl.c
math/s_ctanl.c

index adc9025..a969195 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
 2011-10-22  Ulrich Drepper  <drepper@gmail.com>
 
+       * math/s_catan.c: Add branch predictions.
+       * math/s_catanf.c: Likewise.
+       * math/s_catanh.c: Likewise.
+       * math/s_catanhf.c: Likewise.
+       * math/s_catanhl.c: Likewise.
+       * math/s_catanl.c: Likewise.
+       * math/s_cexp.c: Likewise.
+       * math/s_cexpf.c: Likewise.
+       * math/s_cexpl.c: Likewise.
+       * math/s_clog.c: Likewise.
+       * math/s_clog10.c: Likewise.
+       * math/s_clog10f.c: Likewise.
+       * math/s_clog10l.c: Likewise.
+       * math/s_clogf.c: Likewise.
+       * math/s_clogl.c: Likewise.
+       * math/s_csqrt.c: Likewise.
+       * math/s_csqrtf.c: Likewise.
+       * math/s_csqrtl.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/math_private.h: Define __nan, __nanf, __nanl.
        * math/s_cacosh.c: Include <math_private.h>.
        * math/s_cacoshl.c: Likewise.
index 59c0a3a..1a458a3 100644 (file)
@@ -1,5 +1,5 @@
 /* Return arc tangent 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,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __catan (__complex__ double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+  if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
     {
       if (rcls == FP_INFINITE)
        {
@@ -57,7 +56,7 @@ __catan (__complex__ double x)
          __imag__ res = __nan ("");
        }
     }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
+  else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       res = x;
     }
index 0aefb6e..defcf18 100644 (file)
@@ -1,5 +1,5 @@
 /* Return arc tangent 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,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __catanf (__complex__ float x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+  if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
     {
       if (rcls == FP_INFINITE)
        {
@@ -57,7 +56,7 @@ __catanf (__complex__ float x)
          __imag__ res = __nanf ("");
        }
     }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
+  else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       res = x;
     }
index 0b31b27..22ade15 100644 (file)
@@ -1,5 +1,5 @@
 /* Return arc hyperbole tangent for 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,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __catanh (__complex__ double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+  if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
     {
       if (icls == FP_INFINITE)
        {
@@ -52,20 +51,18 @@ __catanh (__complex__ double x)
          __imag__ res = __nan ("");
        }
     }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
+  else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       res = x;
     }
   else
     {
-      double i2, num, den;
-
-      i2 = __imag__ x * __imag__ x;
+      double i2 = __imag__ x * __imag__ x;
 
-      num = 1.0 + __real__ x;
+      double num = 1.0 + __real__ x;
       num = i2 + num * num;
 
-      den = 1.0 - __real__ x;
+      double den = 1.0 - __real__ x;
       den = i2 + den * den;
 
       __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den));
index 7424bda..f3d07f2 100644 (file)
@@ -1,5 +1,5 @@
 /* Return arc hyperbole tangent for 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,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __catanhf (__complex__ float x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+  if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
     {
       if (icls == FP_INFINITE)
        {
@@ -52,20 +51,18 @@ __catanhf (__complex__ float x)
          __imag__ res = __nanf ("");
        }
     }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
+  else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       res = x;
     }
   else
     {
-      float i2, num, den;
-
-      i2 = __imag__ x * __imag__ x;
+      float i2 = __imag__ x * __imag__ x;
 
-      num = 1.0 + __real__ x;
+      float num = 1.0 + __real__ x;
       num = i2 + num * num;
 
-      den = 1.0 - __real__ x;
+      float den = 1.0 - __real__ x;
       den = i2 + den * den;
 
       __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den));
index 9e67b87..af48f1a 100644 (file)
@@ -1,5 +1,5 @@
 /* Return arc hyperbole tangent for long double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __catanhl (__complex__ long double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+  if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
     {
       if (icls == FP_INFINITE)
        {
@@ -52,20 +51,18 @@ __catanhl (__complex__ long double x)
          __imag__ res = __nanl ("");
        }
     }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
+  else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       res = x;
     }
   else
     {
-      long double i2, num, den;
-
-      i2 = __imag__ x * __imag__ x;
+      long double i2 = __imag__ x * __imag__ x;
 
-      num = 1.0 + __real__ x;
+      long double num = 1.0 + __real__ x;
       num = i2 + num * num;
 
-      den = 1.0 - __real__ x;
+      long double den = 1.0 - __real__ x;
       den = i2 + den * den;
 
       __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den));
index b4ae321..47df85c 100644 (file)
@@ -1,5 +1,5 @@
 /* Return arc tangent of complex long double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __catanl (__complex__ long double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+  if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
     {
       if (rcls == FP_INFINITE)
        {
@@ -57,7 +56,7 @@ __catanl (__complex__ long double x)
          __imag__ res = __nanl ("");
        }
     }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
+  else if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       res = x;
     }
index de122e0..0d1ec29 100644 (file)
@@ -1,5 +1,5 @@
 /* Return value of complex exponential function for double complex 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,7 +21,6 @@
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -32,10 +31,10 @@ __cexp (__complex__ double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls >= FP_ZERO)
+  if (__builtin_expect (rcls >= FP_ZERO, 1))
     {
       /* Real part is finite.  */
-      if (icls >= FP_ZERO)
+      if (__builtin_expect (icls >= FP_ZERO, 1))
        {
          /* Imaginary part is finite.  */
          double exp_val = __ieee754_exp (__real__ x);
@@ -61,15 +60,13 @@ __cexp (__complex__ double x)
          __real__ retval = __nan ("");
          __imag__ retval = __nan ("");
 
-#ifdef FE_INVALID
          feraiseexcept (FE_INVALID);
-#endif
        }
     }
-  else if (rcls == FP_INFINITE)
+  else if (__builtin_expect (rcls == FP_INFINITE, 1))
     {
       /* Real part is infinite.  */
-      if (icls >= FP_ZERO)
+      if (__builtin_expect (icls >= FP_ZERO, 1))
        {
          /* Imaginary part is finite.  */
          double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
@@ -95,10 +92,8 @@ __cexp (__complex__ double x)
          __real__ retval = HUGE_VAL;
          __imag__ retval = __nan ("");
 
-#ifdef FE_INVALID
          if (icls == FP_INFINITE)
            feraiseexcept (FE_INVALID);
-#endif
        }
       else
        {
@@ -112,10 +107,8 @@ __cexp (__complex__ double x)
       __real__ retval = __nan ("");
       __imag__ retval = __nan ("");
 
-#ifdef FE_INVALID
       if (rcls != FP_NAN || icls != FP_NAN)
        feraiseexcept (FE_INVALID);
-#endif
     }
 
   return retval;
index 70e4a02..652fe3d 100644 (file)
@@ -1,5 +1,5 @@
 /* Return value of complex exponential function for float complex 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,7 +21,6 @@
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -32,10 +31,10 @@ __cexpf (__complex__ float x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls >= FP_ZERO)
+  if (__builtin_expect (rcls >= FP_ZERO, 1))
     {
       /* Real part is finite.  */
-      if (icls >= FP_ZERO)
+      if (__builtin_expect (icls >= FP_ZERO, 1))
        {
          /* Imaginary part is finite.  */
          float exp_val = __ieee754_expf (__real__ x);
@@ -61,15 +60,13 @@ __cexpf (__complex__ float x)
          __real__ retval = __nanf ("");
          __imag__ retval = __nanf ("");
 
-#ifdef FE_INVALID
          feraiseexcept (FE_INVALID);
-#endif
        }
     }
-  else if (rcls == FP_INFINITE)
+  else if (__builtin_expect (rcls == FP_INFINITE, 1))
     {
       /* Real part is infinite.  */
-      if (icls >= FP_ZERO)
+      if (__builtin_expect (icls >= FP_ZERO, 1))
        {
          /* Imaginary part is finite.  */
          float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
@@ -95,10 +92,8 @@ __cexpf (__complex__ float x)
          __real__ retval = HUGE_VALF;
          __imag__ retval = __nanf ("");
 
-#ifdef FE_INVALID
          if (icls == FP_INFINITE)
            feraiseexcept (FE_INVALID);
-#endif
        }
       else
        {
@@ -112,10 +107,8 @@ __cexpf (__complex__ float x)
       __real__ retval = __nanf ("");
       __imag__ retval = __nanf ("");
 
-#ifdef FE_INVALID
       if (rcls != FP_NAN || icls != FP_NAN)
        feraiseexcept (FE_INVALID);
-#endif
     }
 
   return retval;
index 1c585f8..6bb56c0 100644 (file)
@@ -1,5 +1,5 @@
 /* Return value of complex exponential function for long double complex 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,7 +21,6 @@
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -32,10 +31,10 @@ __cexpl (__complex__ long double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls >= FP_ZERO)
+  if (__builtin_expect (rcls >= FP_ZERO, 1))
     {
       /* Real part is finite.  */
-      if (icls >= FP_ZERO)
+      if (__builtin_expect (icls >= FP_ZERO, 1))
        {
          /* Imaginary part is finite.  */
          long double exp_val = __ieee754_expl (__real__ x);
@@ -61,15 +60,13 @@ __cexpl (__complex__ long double x)
          __real__ retval = __nanl ("");
          __imag__ retval = __nanl ("");
 
-#ifdef FE_INVALID
          feraiseexcept (FE_INVALID);
-#endif
        }
     }
-  else if (rcls == FP_INFINITE)
+  else if (__builtin_expect (rcls == FP_INFINITE, 1))
     {
       /* Real part is infinite.  */
-      if (icls >= FP_ZERO)
+      if (__builtin_expect (icls >= FP_ZERO, 1))
        {
          /* Imaginary part is finite.  */
          long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
@@ -95,10 +92,8 @@ __cexpl (__complex__ long double x)
          __real__ retval = HUGE_VALL;
          __imag__ retval = __nanl ("");
 
-#ifdef FE_INVALID
          if (icls == FP_INFINITE)
            feraiseexcept (FE_INVALID);
-#endif
        }
       else
        {
@@ -112,10 +107,8 @@ __cexpl (__complex__ long double x)
       __real__ retval = __nanl ("");
       __imag__ retval = __nanl ("");
 
-#ifdef FE_INVALID
       if (rcls != FP_NAN || icls != FP_NAN)
        feraiseexcept (FE_INVALID);
-#endif
     }
 
   return retval;
index 5e7b8fb..ba27140 100644 (file)
@@ -1,5 +1,5 @@
 /* Compute complex natural logarithm.
-   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,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __clog (__complex__ double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls == FP_ZERO && icls == FP_ZERO)
+  if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       /* Real and imaginary part are 0.0.  */
       __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
@@ -39,7 +38,7 @@ __clog (__complex__ double x)
       /* Yes, the following line raises an exception.  */
       __real__ result = -1.0 / fabs (__real__ x);
     }
-  else if (rcls != FP_NAN && icls != FP_NAN)
+  else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
       __real__ result = __ieee754_log (__ieee754_hypot (__real__ x,
index a98de19..4b741fa 100644 (file)
@@ -1,5 +1,5 @@
 /* Compute complex base 10 logarithm.
-   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,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __clog10 (__complex__ double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls == FP_ZERO && icls == FP_ZERO)
+  if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       /* Real and imaginary part are 0.0.  */
       __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
@@ -39,7 +38,7 @@ __clog10 (__complex__ double x)
       /* Yes, the following line raises an exception.  */
       __real__ result = -1.0 / fabs (__real__ x);
     }
-  else if (rcls != FP_NAN && icls != FP_NAN)
+  else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
       __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x,
index ce689e7..fe38f9e 100644 (file)
@@ -1,5 +1,5 @@
 /* Compute complex base 10 logarithm.
-   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,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __clog10f (__complex__ float x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls == FP_ZERO && icls == FP_ZERO)
+  if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       /* Real and imaginary part are 0.0.  */
       __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
@@ -39,7 +38,7 @@ __clog10f (__complex__ float x)
       /* Yes, the following line raises an exception.  */
       __real__ result = -1.0 / fabsf (__real__ x);
     }
-  else if (rcls != FP_NAN && icls != FP_NAN)
+  else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
       __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x,
index 5ea72fd..990913e 100644 (file)
@@ -1,5 +1,5 @@
 /* Compute complex base 10 logarithm.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __clog10l (__complex__ long double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls == FP_ZERO && icls == FP_ZERO)
+  if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       /* Real and imaginary part are 0.0.  */
       __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
@@ -39,7 +38,7 @@ __clog10l (__complex__ long double x)
       /* Yes, the following line raises an exception.  */
       __real__ result = -1.0 / fabsl (__real__ x);
     }
-  else if (rcls != FP_NAN && icls != FP_NAN)
+  else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
       __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x,
index b9e9189..fdda83e 100644 (file)
@@ -1,5 +1,5 @@
 /* Compute complex natural logarithm.
-   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.
 
@@ -31,7 +31,7 @@ __clogf (__complex__ float x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls == FP_ZERO && icls == FP_ZERO)
+  if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       /* Real and imaginary part are 0.0.  */
       __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
@@ -39,7 +39,7 @@ __clogf (__complex__ float x)
       /* Yes, the following line raises an exception.  */
       __real__ result = -1.0 / fabsf (__real__ x);
     }
-  else if (rcls != FP_NAN && icls != FP_NAN)
+  else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
       __real__ result = __ieee754_logf (__ieee754_hypotf (__real__ x,
index 51ad03b..396ba91 100644 (file)
@@ -1,5 +1,5 @@
 /* Compute complex natural logarithm.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -31,7 +30,7 @@ __clogl (__complex__ long double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls == FP_ZERO && icls == FP_ZERO)
+  if (__builtin_expect (rcls == FP_ZERO && icls == FP_ZERO, 0))
     {
       /* Real and imaginary part are 0.0.  */
       __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
@@ -39,7 +38,7 @@ __clogl (__complex__ long double x)
       /* Yes, the following line raises an exception.  */
       __real__ result = -1.0 / fabsl (__real__ x);
     }
-  else if (rcls != FP_NAN && icls != FP_NAN)
+  else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
       __real__ result = __ieee754_logl (__ieee754_hypotl (__real__ x,
index 0ceb461..1691a01 100644 (file)
@@ -1,5 +1,5 @@
 /* Complex square root of double value.
-   Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -21,7 +21,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -32,7 +31,7 @@ __csqrt (__complex__ double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+  if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
     {
       if (icls == FP_INFINITE)
        {
@@ -61,7 +60,7 @@ __csqrt (__complex__ double x)
     }
   else
     {
-      if (icls == FP_ZERO)
+      if (__builtin_expect (icls == FP_ZERO, 0))
        {
          if (__real__ x < 0.0)
            {
@@ -75,7 +74,7 @@ __csqrt (__complex__ double x)
              __imag__ res = __copysign (0.0, __imag__ x);
            }
        }
-      else if (rcls == FP_ZERO)
+      else if (__builtin_expect (rcls == FP_ZERO, 0))
        {
          double r = __ieee754_sqrt (0.5 * fabs (__imag__ x));
 
index 1cf3b79..1613192 100644 (file)
@@ -1,5 +1,5 @@
 /* Complex square root of float value.
-   Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -21,7 +21,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -32,7 +31,7 @@ __csqrtf (__complex__ float x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+  if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
     {
       if (icls == FP_INFINITE)
        {
@@ -61,7 +60,7 @@ __csqrtf (__complex__ float x)
     }
   else
     {
-      if (icls == FP_ZERO)
+      if (__builtin_expect (icls == FP_ZERO, 0))
        {
          if (__real__ x < 0.0)
            {
@@ -75,7 +74,7 @@ __csqrtf (__complex__ float x)
              __imag__ res = __copysignf (0.0, __imag__ x);
            }
        }
-      else if (rcls == FP_ZERO)
+      else if (__builtin_expect (rcls == FP_ZERO, 0))
        {
          float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x));
 
index 32d6f36..9b93ef6 100644 (file)
@@ -1,5 +1,5 @@
 /* Complex square root of long double value.
-   Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -21,7 +21,6 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -32,7 +31,7 @@ __csqrtl (__complex__ long double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+  if (__builtin_expect (rcls <= FP_INFINITE || icls <= FP_INFINITE, 0))
     {
       if (icls == FP_INFINITE)
        {
@@ -61,7 +60,7 @@ __csqrtl (__complex__ long double x)
     }
   else
     {
-      if (icls == FP_ZERO)
+      if (__builtin_expect (icls == FP_ZERO, 0))
        {
          if (__real__ x < 0.0)
            {
@@ -75,7 +74,7 @@ __csqrtl (__complex__ long double x)
              __imag__ res = __copysignl (0.0, __imag__ x);
            }
        }
-      else if (rcls == FP_ZERO)
+      else if (__builtin_expect (rcls == FP_ZERO, 0))
        {
          long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x));
 
index 7236dc3..7063e38 100644 (file)
@@ -21,7 +21,6 @@
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -30,7 +29,7 @@ __ctanf (__complex__ float x)
 {
   __complex__ float res;
 
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+  if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
     {
       if (__isinf_nsf (__imag__ x))
        {
@@ -46,10 +45,8 @@ __ctanf (__complex__ float x)
          __real__ res = __nanf ("");
          __imag__ res = __nanf ("");
 
-#ifdef FE_INVALID
          if (__isinf_nsf (__real__ x))
            feraiseexcept (FE_INVALID);
-#endif
        }
     }
   else
index f4a1d7e..9d31c43 100644 (file)
@@ -21,7 +21,6 @@
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -30,7 +29,7 @@ __ctanh (__complex__ double x)
 {
   __complex__ double res;
 
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+  if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
     {
       if (__isinf_ns (__real__ x))
        {
@@ -46,10 +45,8 @@ __ctanh (__complex__ double x)
          __real__ res = __nan ("");
          __imag__ res = __nan ("");
 
-#ifdef FE_INVALID
          if (__isinf_ns (__imag__ x))
            feraiseexcept (FE_INVALID);
-#endif
        }
     }
   else
index cb65edb..6cb3a2c 100644 (file)
@@ -21,7 +21,6 @@
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -30,7 +29,7 @@ __ctanhf (__complex__ float x)
 {
   __complex__ float res;
 
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+  if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
     {
       if (__isinf_nsf (__real__ x))
        {
@@ -46,10 +45,8 @@ __ctanhf (__complex__ float x)
          __real__ res = __nanf ("");
          __imag__ res = __nanf ("");
 
-#ifdef FE_INVALID
          if (__isinf_nsf (__imag__ x))
            feraiseexcept (FE_INVALID);
-#endif
        }
     }
   else
index bee9e76..0c46417 100644 (file)
@@ -21,7 +21,6 @@
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
-
 #include <math_private.h>
 
 
@@ -30,7 +29,7 @@ __ctanhl (__complex__ long double x)
 {
   __complex__ long double res;
 
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+  if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
     {
       if (__isinf_nsl (__real__ x))
        {
@@ -46,10 +45,8 @@ __ctanhl (__complex__ long double x)
          __real__ res = __nanl ("");
          __imag__ res = __nanl ("");
 
-#ifdef FE_INVALID
          if (__isinf_nsl (__imag__ x))
            feraiseexcept (FE_INVALID);
-#endif
        }
     }
   else
index fcc0da9..6f49c57 100644 (file)
@@ -30,7 +30,7 @@ __ctanl (__complex__ long double x)
 {
   __complex__ long double res;
 
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+  if (__builtin_expect (!isfinite (__real__ x) || !isfinite (__imag__ x), 0))
     {
       if (__isinf_nsl (__imag__ x))
        {
@@ -46,10 +46,8 @@ __ctanl (__complex__ long double x)
          __real__ res = __nanl ("");
          __imag__ res = __nanl ("");
 
-#ifdef FE_INVALID
          if (__isinf_nsl (__real__ x))
            feraiseexcept (FE_INVALID);
-#endif
        }
     }
   else