diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-10-22 13:17:30 -0400 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2011-10-22 13:17:30 -0400 |
commit | 77425c63e72bc0c01d81bc7e9ba4bb41d11679e6 (patch) | |
tree | c4fea5ed8070fc251140eba66b009bca1ff0e3b5 /math | |
parent | bc62c2fb152d6ffec63975d88fd8f1bc3d3b7c01 (diff) | |
download | glibc-77425c63e72bc0c01d81bc7e9ba4bb41d11679e6.tar.gz glibc-77425c63e72bc0c01d81bc7e9ba4bb41d11679e6.tar.xz glibc-77425c63e72bc0c01d81bc7e9ba4bb41d11679e6.zip |
Add branch predictions to complex math code
Diffstat (limited to 'math')
-rw-r--r-- | math/s_catan.c | 7 | ||||
-rw-r--r-- | math/s_catanf.c | 7 | ||||
-rw-r--r-- | math/s_catanh.c | 15 | ||||
-rw-r--r-- | math/s_catanhf.c | 15 | ||||
-rw-r--r-- | math/s_catanhl.c | 15 | ||||
-rw-r--r-- | math/s_catanl.c | 7 | ||||
-rw-r--r-- | math/s_cexp.c | 17 | ||||
-rw-r--r-- | math/s_cexpf.c | 17 | ||||
-rw-r--r-- | math/s_cexpl.c | 17 | ||||
-rw-r--r-- | math/s_clog.c | 7 | ||||
-rw-r--r-- | math/s_clog10.c | 7 | ||||
-rw-r--r-- | math/s_clog10f.c | 7 | ||||
-rw-r--r-- | math/s_clog10l.c | 7 | ||||
-rw-r--r-- | math/s_clogf.c | 6 | ||||
-rw-r--r-- | math/s_clogl.c | 7 | ||||
-rw-r--r-- | math/s_csqrt.c | 9 | ||||
-rw-r--r-- | math/s_csqrtf.c | 9 | ||||
-rw-r--r-- | math/s_csqrtl.c | 9 | ||||
-rw-r--r-- | math/s_ctanf.c | 5 | ||||
-rw-r--r-- | math/s_ctanh.c | 5 | ||||
-rw-r--r-- | math/s_ctanhf.c | 5 | ||||
-rw-r--r-- | math/s_ctanhl.c | 5 | ||||
-rw-r--r-- | math/s_ctanl.c | 4 |
23 files changed, 77 insertions, 132 deletions
diff --git a/math/s_catan.c b/math/s_catan.c index 59c0a3af6b..1a458a3833 100644 --- a/math/s_catan.c +++ b/math/s_catan.c @@ -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; } diff --git a/math/s_catanf.c b/math/s_catanf.c index 0aefb6ef39..defcf18c67 100644 --- a/math/s_catanf.c +++ b/math/s_catanf.c @@ -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; } diff --git a/math/s_catanh.c b/math/s_catanh.c index 0b31b27708..22ade15fa8 100644 --- a/math/s_catanh.c +++ b/math/s_catanh.c @@ -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)); diff --git a/math/s_catanhf.c b/math/s_catanhf.c index 7424bda9b9..f3d07f2354 100644 --- a/math/s_catanhf.c +++ b/math/s_catanhf.c @@ -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)); diff --git a/math/s_catanhl.c b/math/s_catanhl.c index 9e67b8789c..af48f1a553 100644 --- a/math/s_catanhl.c +++ b/math/s_catanhl.c @@ -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)); diff --git a/math/s_catanl.c b/math/s_catanl.c index b4ae321710..47df85cc7b 100644 --- a/math/s_catanl.c +++ b/math/s_catanl.c @@ -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; } diff --git a/math/s_cexp.c b/math/s_cexp.c index de122e07f8..0d1ec29850 100644 --- a/math/s_cexp.c +++ b/math/s_cexp.c @@ -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; diff --git a/math/s_cexpf.c b/math/s_cexpf.c index 70e4a02588..652fe3d5b2 100644 --- a/math/s_cexpf.c +++ b/math/s_cexpf.c @@ -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; diff --git a/math/s_cexpl.c b/math/s_cexpl.c index 1c585f8d0a..6bb56c02f5 100644 --- a/math/s_cexpl.c +++ b/math/s_cexpl.c @@ -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; diff --git a/math/s_clog.c b/math/s_clog.c index 5e7b8fbdab..ba27140b4b 100644 --- a/math/s_clog.c +++ b/math/s_clog.c @@ -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, diff --git a/math/s_clog10.c b/math/s_clog10.c index a98de1942e..4b741fab55 100644 --- a/math/s_clog10.c +++ b/math/s_clog10.c @@ -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, diff --git a/math/s_clog10f.c b/math/s_clog10f.c index ce689e7426..fe38f9e8df 100644 --- a/math/s_clog10f.c +++ b/math/s_clog10f.c @@ -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, diff --git a/math/s_clog10l.c b/math/s_clog10l.c index 5ea72fdf32..990913e7b8 100644 --- a/math/s_clog10l.c +++ b/math/s_clog10l.c @@ -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, diff --git a/math/s_clogf.c b/math/s_clogf.c index b9e918968b..fdda83e548 100644 --- a/math/s_clogf.c +++ b/math/s_clogf.c @@ -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, diff --git a/math/s_clogl.c b/math/s_clogl.c index 51ad03b34a..396ba91802 100644 --- a/math/s_clogl.c +++ b/math/s_clogl.c @@ -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, diff --git a/math/s_csqrt.c b/math/s_csqrt.c index 0ceb461b09..1691a01ecc 100644 --- a/math/s_csqrt.c +++ b/math/s_csqrt.c @@ -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)); diff --git a/math/s_csqrtf.c b/math/s_csqrtf.c index 1cf3b79c31..1613192a5e 100644 --- a/math/s_csqrtf.c +++ b/math/s_csqrtf.c @@ -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)); diff --git a/math/s_csqrtl.c b/math/s_csqrtl.c index 32d6f364a0..9b93ef66b2 100644 --- a/math/s_csqrtl.c +++ b/math/s_csqrtl.c @@ -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)); diff --git a/math/s_ctanf.c b/math/s_ctanf.c index 7236dc3e9d..7063e38d8e 100644 --- a/math/s_ctanf.c +++ b/math/s_ctanf.c @@ -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 diff --git a/math/s_ctanh.c b/math/s_ctanh.c index f4a1d7e450..9d31c43cd9 100644 --- a/math/s_ctanh.c +++ b/math/s_ctanh.c @@ -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 diff --git a/math/s_ctanhf.c b/math/s_ctanhf.c index cb65edb7fc..6cb3a2cc99 100644 --- a/math/s_ctanhf.c +++ b/math/s_ctanhf.c @@ -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 diff --git a/math/s_ctanhl.c b/math/s_ctanhl.c index bee9e7601b..0c4641714b 100644 --- a/math/s_ctanhl.c +++ b/math/s_ctanhl.c @@ -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 diff --git a/math/s_ctanl.c b/math/s_ctanl.c index fcc0da90d6..6f49c57c90 100644 --- a/math/s_ctanl.c +++ b/math/s_ctanl.c @@ -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 |