]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
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 adc9025a84d5ed14b6ca9f8d0f705e6b419be7fa..a969195ba74dbd6004b3f6aec6a6218d81b7b1ab 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 59c0a3af6b3d760e8f10f08fc3627776b71a77eb..1a458a3833003713d7590d185820ea4c11611bc8 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 0aefb6ef39c196cd55228fd9dd0fcd9b2f75cfca..defcf18c67168a2bfe9dbf1dffd719404724c750 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 0b31b277083b7dd3bd8fb312eb123b94a8836fb6..22ade15fa8b929ac6ef276b7e31e24f5413518e3 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 7424bda9b986fc6ffc3c02bc462a560cf730756f..f3d07f2354f01d98059ebda60ce3e4cae8fd8e86 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 9e67b8789ccda0fe201f8f3315a604b2e96f4254..af48f1a553b0156ca2d7023100cb368cbae265de 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 b4ae321710de16d4a53f613477ce8be977b9d675..47df85cc7b37bd10a4e8c15bf5b6b20ffd07ec8b 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 de122e07f8217a65cedf0aed410b653e3237b23a..0d1ec298508014b277b0d004dd4e28055b80b7d6 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 70e4a02588b29dc312cb12b1755bffc776a34ca1..652fe3d5b2966c897dfe2a68ec22f13c1787f69e 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 1c585f8d0a61f4e8c5cfc87aac4ea53b7cd05476..6bb56c02f5c1d802c1556bbdf42eb902a74de9f1 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 5e7b8fbdab13cac3c667565653dd35f2675da925..ba27140b4b95c071697fbbc9f6bc111786a5682c 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 a98de1942ea6ae200853b3358c003835e6f3c13c..4b741fab551f8b9ad132b4f395bc887b60fa4dec 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 ce689e74266e18573e3d739adbb12282f211fba7..fe38f9e8df8138cf8cc40df6441b219ea6809468 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 5ea72fdf32b98044c15c4e50a4c33830d815dbf2..990913e7b8ca36888d2d3a7adaf8c60dce8d629c 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 b9e918968b576f5eae170f93090c4178e480bebe..fdda83e548758c5d16b2eb028726f8998b1f1af6 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 51ad03b34ab08313a51bc6f63d4f469485142639..396ba9180230cd3da1bd4e4b8f56a99dad9254e5 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 0ceb461b09dbbe4d1267c1deee42cf30aebe9792..1691a01eccb9fad32af357765c61a95834ad8f2b 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 1cf3b79c31d8e31b5d4fc53a5ee3161d354204b4..1613192a5ea600ddf31ccef69e21242f6d991e30 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 32d6f364a0eb13d9cde424323cc1ac31f4a0f6ff..9b93ef66b238ea34c5af0ae504eae59620244d90 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 7236dc3e9dae77f68d5ea2db1582e1f2854b654c..7063e38d8e5d3c53c16974000cb70b6698ce03b6 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 f4a1d7e450dc70268b2527b37a4bac55abc9e907..9d31c43cd99464a4ec09591213a92b68df388a74 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 cb65edb7fc1caf42731c5cc7bce6c53245a3b3bc..6cb3a2cc99a0485fac5f5201e4d35163d80f0f89 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 bee9e7601b54c690bdca86d87262282ab1a17d30..0c4641714b6a787f8a4cd38056e16dd89b84b36f 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 fcc0da90d6f9f459adac522fda8802b9f81b33a0..6f49c57c907f0280bc464fc1955a659034aa798f 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