diff options
author | Ondřej Bílka <neleai@seznam.cz> | 2014-02-10 14:45:42 +0100 |
---|---|---|
committer | Ondřej Bílka <neleai@seznam.cz> | 2014-02-10 15:07:12 +0100 |
commit | a1ffb40e32741f992c743e7b16c061fefa3747ac (patch) | |
tree | 246a29a87b26cfd5d07b17070f85eb3785018de9 /sysdeps/ieee754/dbl-64 | |
parent | 1448f3244714a9dabb5240ec18b094f100887d5c (diff) | |
download | glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.xz glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.zip |
Use glibc_likely instead __builtin_expect.
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
25 files changed, 74 insertions, 74 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_atanh.c b/sysdeps/ieee754/dbl-64/e_atanh.c index 21bb9908d1..0f96743390 100644 --- a/sysdeps/ieee754/dbl-64/e_atanh.c +++ b/sysdeps/ieee754/dbl-64/e_atanh.c @@ -48,7 +48,7 @@ __ieee754_atanh (double x) double t; if (isless (xa, 0.5)) { - if (__builtin_expect (xa < 0x1.0p-28, 0)) + if (__glibc_unlikely (xa < 0x1.0p-28)) { math_force_eval (huge + x); return x; @@ -57,7 +57,7 @@ __ieee754_atanh (double x) t = xa + xa; t = 0.5 * __log1p (t + t * xa / (1.0 - xa)); } - else if (__builtin_expect (isless (xa, 1.0), 1)) + else if (__glibc_likely (isless (xa, 1.0))) t = 0.5 * __log1p ((xa + xa) / (1.0 - xa)); else { diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c index 10e23e2218..588fbfdee8 100644 --- a/sysdeps/ieee754/dbl-64/e_exp2.c +++ b/sysdeps/ieee754/dbl-64/e_exp2.c @@ -43,10 +43,10 @@ __ieee754_exp2 (double x) static const double lomark = (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1); /* Check for usual case. */ - if (__builtin_expect (isless (x, himark), 1)) + if (__glibc_likely (isless (x, himark))) { /* Exceptional cases: */ - if (__builtin_expect (!isgreaterequal (x, lomark), 0)) + if (__glibc_unlikely (!isgreaterequal (x, lomark))) { if (__isinf (x)) /* e^-inf == 0, with no error. */ diff --git a/sysdeps/ieee754/dbl-64/e_fmod.c b/sysdeps/ieee754/dbl-64/e_fmod.c index c83c2aedb2..e82b302200 100644 --- a/sysdeps/ieee754/dbl-64/e_fmod.c +++ b/sysdeps/ieee754/dbl-64/e_fmod.c @@ -45,7 +45,7 @@ __ieee754_fmod (double x, double y) } /* determine ix = ilogb(x) */ - if (__builtin_expect (hx < 0x00100000, 0)) /* subnormal x */ + if (__glibc_unlikely (hx < 0x00100000)) /* subnormal x */ { if (hx == 0) { @@ -62,7 +62,7 @@ __ieee754_fmod (double x, double y) ix = (hx >> 20) - 1023; /* determine iy = ilogb(y) */ - if (__builtin_expect (hy < 0x00100000, 0)) /* subnormal y */ + if (__glibc_unlikely (hy < 0x00100000)) /* subnormal y */ { if (hy == 0) { @@ -79,7 +79,7 @@ __ieee754_fmod (double x, double y) iy = (hy >> 20) - 1023; /* set up {hx,lx}, {hy,ly} and align y to x */ - if (__builtin_expect (ix >= -1022, 1)) + if (__glibc_likely (ix >= -1022)) hx = 0x00100000 | (0x000fffff & hx); else /* subnormal x, shift x to normal */ { @@ -95,7 +95,7 @@ __ieee754_fmod (double x, double y) lx = 0; } } - if (__builtin_expect (iy >= -1022, 1)) + if (__glibc_likely (iy >= -1022)) hy = 0x00100000 | (0x000fffff & hy); else /* subnormal y, shift y to normal */ { @@ -144,7 +144,7 @@ __ieee754_fmod (double x, double y) hx = hx + hx + (lx >> 31); lx = lx + lx; iy -= 1; } - if (__builtin_expect (iy >= -1022, 1)) /* normalize output */ + if (__glibc_likely (iy >= -1022)) /* normalize output */ { hx = ((hx - 0x00100000) | ((iy + 1023) << 20)); INSERT_WORDS (x, hx | sx, lx); diff --git a/sysdeps/ieee754/dbl-64/e_gamma_r.c b/sysdeps/ieee754/dbl-64/e_gamma_r.c index 1c427556bc..a35a9e5608 100644 --- a/sysdeps/ieee754/dbl-64/e_gamma_r.c +++ b/sysdeps/ieee754/dbl-64/e_gamma_r.c @@ -122,7 +122,7 @@ __ieee754_gamma_r (double x, int *signgamp) EXTRACT_WORDS (hx, lx, x); - if (__builtin_expect (((hx & 0x7fffffff) | lx) == 0, 0)) + if (__glibc_unlikely (((hx & 0x7fffffff) | lx) == 0)) { /* Return value for x == 0 is Inf with divide by zero exception. */ *signgamp = 0; @@ -135,13 +135,13 @@ __ieee754_gamma_r (double x, int *signgamp) *signgamp = 0; return (x - x) / (x - x); } - if (__builtin_expect ((unsigned int) hx == 0xfff00000 && lx == 0, 0)) + if (__glibc_unlikely ((unsigned int) hx == 0xfff00000 && lx == 0)) { /* x == -Inf. According to ISO this is NaN. */ *signgamp = 0; return x - x; } - if (__builtin_expect ((hx & 0x7ff00000) == 0x7ff00000, 0)) + if (__glibc_unlikely ((hx & 0x7ff00000) == 0x7ff00000)) { /* Positive infinity (return positive infinity) or NaN (return NaN). */ diff --git a/sysdeps/ieee754/dbl-64/e_hypot.c b/sysdeps/ieee754/dbl-64/e_hypot.c index 88242bc4f6..5cbfcbeb48 100644 --- a/sysdeps/ieee754/dbl-64/e_hypot.c +++ b/sysdeps/ieee754/dbl-64/e_hypot.c @@ -70,7 +70,7 @@ __ieee754_hypot (double x, double y) return a + b; } /* x/y > 2**60 */ k = 0; - if (__builtin_expect (ha > 0x5f300000, 0)) /* a>2**500 */ + if (__glibc_unlikely (ha > 0x5f300000)) /* a>2**500 */ { if (ha >= 0x7ff00000) /* Inf or NaN */ { diff --git a/sysdeps/ieee754/dbl-64/e_j1.c b/sysdeps/ieee754/dbl-64/e_j1.c index ab754c6ee0..bc7ca0609f 100644 --- a/sysdeps/ieee754/dbl-64/e_j1.c +++ b/sysdeps/ieee754/dbl-64/e_j1.c @@ -89,7 +89,7 @@ __ieee754_j1 (double x) GET_HIGH_WORD (hx, x); ix = hx & 0x7fffffff; - if (__builtin_expect (ix >= 0x7ff00000, 0)) + if (__glibc_unlikely (ix >= 0x7ff00000)) return one / x; y = fabs (x); if (ix >= 0x40000000) /* |x| >= 2.0 */ @@ -121,7 +121,7 @@ __ieee754_j1 (double x) else return z; } - if (__builtin_expect (ix < 0x3e400000, 0)) /* |x|<2**-27 */ + if (__glibc_unlikely (ix < 0x3e400000)) /* |x|<2**-27 */ { if (huge + x > one) return 0.5 * x; /* inexact if x!=0 necessary */ @@ -163,12 +163,12 @@ __ieee754_y1 (double x) EXTRACT_WORDS (hx, lx, x); ix = 0x7fffffff & hx; /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ - if (__builtin_expect (ix >= 0x7ff00000, 0)) + if (__glibc_unlikely (ix >= 0x7ff00000)) return one / (x + x * x); - if (__builtin_expect ((ix | lx) == 0, 0)) + if (__glibc_unlikely ((ix | lx) == 0)) return -HUGE_VAL + x; /* -inf and overflow exception. */; - if (__builtin_expect (hx < 0, 0)) + if (__glibc_unlikely (hx < 0)) return zero / (zero * x); if (ix >= 0x40000000) /* |x| >= 2.0 */ { @@ -203,7 +203,7 @@ __ieee754_y1 (double x) } return z; } - if (__builtin_expect (ix <= 0x3c900000, 0)) /* x < 2**-54 */ + if (__glibc_unlikely (ix <= 0x3c900000)) /* x < 2**-54 */ { return (-tpi / x); } diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c index f48e43a0d9..236878ba1d 100644 --- a/sysdeps/ieee754/dbl-64/e_jn.c +++ b/sysdeps/ieee754/dbl-64/e_jn.c @@ -60,7 +60,7 @@ __ieee754_jn (int n, double x) EXTRACT_WORDS (hx, lx, x); ix = 0x7fffffff & hx; /* if J(n,NaN) is NaN */ - if (__builtin_expect ((ix | ((u_int32_t) (lx | -lx)) >> 31) > 0x7ff00000, 0)) + if (__glibc_unlikely ((ix | ((u_int32_t) (lx | -lx)) >> 31) > 0x7ff00000)) return x + x; if (n < 0) { @@ -74,7 +74,7 @@ __ieee754_jn (int n, double x) return (__ieee754_j1 (x)); sgn = (n & 1) & (hx >> 31); /* even n -- 0, odd n -- sign(x) */ x = fabs (x); - if (__builtin_expect ((ix | lx) == 0 || ix >= 0x7ff00000, 0)) + if (__glibc_unlikely ((ix | lx) == 0 || ix >= 0x7ff00000)) /* if x is 0 or inf */ b = zero; else if ((double) n <= x) @@ -253,12 +253,12 @@ __ieee754_yn (int n, double x) EXTRACT_WORDS (hx, lx, x); ix = 0x7fffffff & hx; /* if Y(n,NaN) is NaN */ - if (__builtin_expect ((ix | ((u_int32_t) (lx | -lx)) >> 31) > 0x7ff00000, 0)) + if (__glibc_unlikely ((ix | ((u_int32_t) (lx | -lx)) >> 31) > 0x7ff00000)) return x + x; - if (__builtin_expect ((ix | lx) == 0, 0)) + if (__glibc_unlikely ((ix | lx) == 0)) return -HUGE_VAL + x; /* -inf and overflow exception. */; - if (__builtin_expect (hx < 0, 0)) + if (__glibc_unlikely (hx < 0)) return zero / (zero * x); sign = 1; if (n < 0) @@ -270,7 +270,7 @@ __ieee754_yn (int n, double x) return (__ieee754_y0 (x)); if (n == 1) return (sign * __ieee754_y1 (x)); - if (__builtin_expect (ix == 0x7ff00000, 0)) + if (__glibc_unlikely (ix == 0x7ff00000)) return zero; if (ix >= 0x52D00000) /* x > 2**302 */ { /* (x >> n**2) diff --git a/sysdeps/ieee754/dbl-64/e_log.c b/sysdeps/ieee754/dbl-64/e_log.c index 0b2889cb3b..05d318b786 100644 --- a/sysdeps/ieee754/dbl-64/e_log.c +++ b/sysdeps/ieee754/dbl-64/e_log.c @@ -77,23 +77,23 @@ __ieee754_log (double x) ux = num.i[HIGH_HALF]; dx = num.i[LOW_HALF]; n = 0; - if (__builtin_expect (ux < 0x00100000, 0)) + if (__glibc_unlikely (ux < 0x00100000)) { - if (__builtin_expect (((ux & 0x7fffffff) | dx) == 0, 0)) + if (__glibc_unlikely (((ux & 0x7fffffff) | dx) == 0)) return MHALF / 0.0; /* return -INF */ - if (__builtin_expect (ux < 0, 0)) + if (__glibc_unlikely (ux < 0)) return (x - x) / 0.0; /* return NaN */ n -= 54; x *= two54.d; /* scale x */ num.d = x; } - if (__builtin_expect (ux >= 0x7ff00000, 0)) + if (__glibc_unlikely (ux >= 0x7ff00000)) return x + x; /* INF or NaN */ /* Regular values of x */ w = x - 1; - if (__builtin_expect (ABS (w) > U03, 1)) + if (__glibc_likely (ABS (w) > U03)) goto case_03; /*--- Stage I, the case abs(x-1) < 0.03 */ diff --git a/sysdeps/ieee754/dbl-64/e_log10.c b/sysdeps/ieee754/dbl-64/e_log10.c index c3d465a4a9..8548ee3942 100644 --- a/sysdeps/ieee754/dbl-64/e_log10.c +++ b/sysdeps/ieee754/dbl-64/e_log10.c @@ -63,15 +63,15 @@ __ieee754_log10 (double x) k = 0; if (hx < 0x00100000) { /* x < 2**-1022 */ - if (__builtin_expect (((hx & 0x7fffffff) | lx) == 0, 0)) + if (__glibc_unlikely (((hx & 0x7fffffff) | lx) == 0)) return -two54 / (x - x); /* log(+-0)=-inf */ - if (__builtin_expect (hx < 0, 0)) + if (__glibc_unlikely (hx < 0)) return (x - x) / (x - x); /* log(-#) = NaN */ k -= 54; x *= two54; /* subnormal number, scale up x */ GET_HIGH_WORD (hx, x); } - if (__builtin_expect (hx >= 0x7ff00000, 0)) + if (__glibc_unlikely (hx >= 0x7ff00000)) return x + x; k += (hx >> 20) - 1023; i = ((u_int32_t) k & 0x80000000) >> 31; diff --git a/sysdeps/ieee754/dbl-64/e_log2.c b/sysdeps/ieee754/dbl-64/e_log2.c index 890a4a2bd0..997d7cefc8 100644 --- a/sysdeps/ieee754/dbl-64/e_log2.c +++ b/sysdeps/ieee754/dbl-64/e_log2.c @@ -81,15 +81,15 @@ __ieee754_log2 (double x) k = 0; if (hx < 0x00100000) { /* x < 2**-1022 */ - if (__builtin_expect (((hx & 0x7fffffff) | lx) == 0, 0)) + if (__glibc_unlikely (((hx & 0x7fffffff) | lx) == 0)) return -two54 / (x - x); /* log(+-0)=-inf */ - if (__builtin_expect (hx < 0, 0)) + if (__glibc_unlikely (hx < 0)) return (x - x) / (x - x); /* log(-#) = NaN */ k -= 54; x *= two54; /* subnormal number, scale up x */ GET_HIGH_WORD (hx, x); } - if (__builtin_expect (hx >= 0x7ff00000, 0)) + if (__glibc_unlikely (hx >= 0x7ff00000)) return x + x; k += (hx >> 20) - 1023; hx &= 0x000fffff; diff --git a/sysdeps/ieee754/dbl-64/e_sinh.c b/sysdeps/ieee754/dbl-64/e_sinh.c index 851b510aaa..4ff28bf85d 100644 --- a/sysdeps/ieee754/dbl-64/e_sinh.c +++ b/sysdeps/ieee754/dbl-64/e_sinh.c @@ -49,7 +49,7 @@ __ieee754_sinh (double x) ix = jx & 0x7fffffff; /* x is INF or NaN */ - if (__builtin_expect (ix >= 0x7ff00000, 0)) + if (__glibc_unlikely (ix >= 0x7ff00000)) return x + x; h = 0.5; @@ -58,7 +58,7 @@ __ieee754_sinh (double x) /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */ if (ix < 0x40360000) /* |x|<22 */ { - if (__builtin_expect (ix < 0x3e300000, 0)) /* |x|<2**-28 */ + if (__glibc_unlikely (ix < 0x3e300000)) /* |x|<2**-28 */ if (shuge + x > one) return x; /* sinh(tiny) = tiny with inexact */ diff --git a/sysdeps/ieee754/dbl-64/s_asinh.c b/sysdeps/ieee754/dbl-64/s_asinh.c index 5500746848..a33758d3c9 100644 --- a/sysdeps/ieee754/dbl-64/s_asinh.c +++ b/sysdeps/ieee754/dbl-64/s_asinh.c @@ -36,12 +36,12 @@ __asinh (double x) int32_t hx, ix; GET_HIGH_WORD (hx, x); ix = hx & 0x7fffffff; - if (__builtin_expect (ix < 0x3e300000, 0)) /* |x|<2**-28 */ + if (__glibc_unlikely (ix < 0x3e300000)) /* |x|<2**-28 */ { if (huge + x > one) return x; /* return x inexact except 0 */ } - if (__builtin_expect (ix > 0x41b00000, 0)) /* |x| > 2**28 */ + if (__glibc_unlikely (ix > 0x41b00000)) /* |x| > 2**28 */ { if (ix >= 0x7ff00000) return x + x; /* x is inf or NaN */ diff --git a/sysdeps/ieee754/dbl-64/s_fma.c b/sysdeps/ieee754/dbl-64/s_fma.c index cfaa22d184..389acd4cde 100644 --- a/sysdeps/ieee754/dbl-64/s_fma.c +++ b/sysdeps/ieee754/dbl-64/s_fma.c @@ -174,7 +174,7 @@ __fma (double x, double y, double z) } /* Ensure correct sign of exact 0 + 0. */ - if (__builtin_expect ((x == 0 || y == 0) && z == 0, 0)) + if (__glibc_unlikely ((x == 0 || y == 0) && z == 0)) return x * y + z; fenv_t env; @@ -216,7 +216,7 @@ __fma (double x, double y, double z) /* Perform m2 + a2 addition with round to odd. */ u.d = a2 + m2; - if (__builtin_expect (adjust < 0, 0)) + if (__glibc_unlikely (adjust < 0)) { if ((u.ieee.mantissa1 & 1) == 0) u.ieee.mantissa1 |= libc_fetestexcept (FE_INEXACT) != 0; @@ -228,14 +228,14 @@ __fma (double x, double y, double z) /* Reset rounding mode and test for inexact simultaneously. */ int j = libc_feupdateenv_test (&env, FE_INEXACT) != 0; - if (__builtin_expect (adjust == 0, 1)) + if (__glibc_likely (adjust == 0)) { if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7ff) u.ieee.mantissa1 |= j; /* Result is a1 + u.d. */ return a1 + u.d; } - else if (__builtin_expect (adjust > 0, 1)) + else if (__glibc_likely (adjust > 0)) { if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7ff) u.ieee.mantissa1 |= j; diff --git a/sysdeps/ieee754/dbl-64/s_log1p.c b/sysdeps/ieee754/dbl-64/s_log1p.c index ea1dc6ca76..fd4dce5f23 100644 --- a/sysdeps/ieee754/dbl-64/s_log1p.c +++ b/sysdeps/ieee754/dbl-64/s_log1p.c @@ -107,14 +107,14 @@ __log1p (double x) k = 1; if (hx < 0x3FDA827A) /* x < 0.41422 */ { - if (__builtin_expect (ax >= 0x3ff00000, 0)) /* x <= -1.0 */ + if (__glibc_unlikely (ax >= 0x3ff00000)) /* x <= -1.0 */ { if (x == -1.0) return -two54 / (x - x); /* log1p(-1)=+inf */ else return (x - x) / (x - x); /* log1p(x<-1)=NaN */ } - if (__builtin_expect (ax < 0x3e200000, 0)) /* |x| < 2**-29 */ + if (__glibc_unlikely (ax < 0x3e200000)) /* |x| < 2**-29 */ { math_force_eval (two54 + x); /* raise inexact */ if (ax < 0x3c900000) /* |x| < 2**-54 */ @@ -127,7 +127,7 @@ __log1p (double x) k = 0; f = x; hu = 1; } /* -0.2929<x<0.41422 */ } - else if (__builtin_expect (hx >= 0x7ff00000, 0)) + else if (__glibc_unlikely (hx >= 0x7ff00000)) return x + x; if (k != 0) { diff --git a/sysdeps/ieee754/dbl-64/s_logb.c b/sysdeps/ieee754/dbl-64/s_logb.c index c065826dd2..7a6c49abf5 100644 --- a/sysdeps/ieee754/dbl-64/s_logb.c +++ b/sysdeps/ieee754/dbl-64/s_logb.c @@ -30,7 +30,7 @@ __logb (double x) return -1.0 / fabs (x); if (ix >= 0x7ff00000) return x * x; - if (__builtin_expect ((rix = ix >> 20) == 0, 0)) + if (__glibc_unlikely ((rix = ix >> 20) == 0)) { /* POSIX specifies that denormal number is treated as though it were normalized. */ diff --git a/sysdeps/ieee754/dbl-64/s_modf.c b/sysdeps/ieee754/dbl-64/s_modf.c index 1dce6381ae..0a1e13008f 100644 --- a/sysdeps/ieee754/dbl-64/s_modf.c +++ b/sysdeps/ieee754/dbl-64/s_modf.c @@ -54,7 +54,7 @@ __modf (double x, double *iptr) } } } - else if (__builtin_expect (j0 > 51, 0)) /* no fraction part */ + else if (__glibc_unlikely (j0 > 51)) /* no fraction part */ { *iptr = x * one; /* We must handle NaNs separately. */ diff --git a/sysdeps/ieee754/dbl-64/s_scalbln.c b/sysdeps/ieee754/dbl-64/s_scalbln.c index 6402927d23..874b98e4cf 100644 --- a/sysdeps/ieee754/dbl-64/s_scalbln.c +++ b/sysdeps/ieee754/dbl-64/s_scalbln.c @@ -31,7 +31,7 @@ __scalbln (double x, long int n) int32_t k, hx, lx; EXTRACT_WORDS (hx, lx, x); k = (hx & 0x7ff00000) >> 20; /* extract exponent */ - if (__builtin_expect (k == 0, 0)) /* 0 or subnormal x */ + if (__glibc_unlikely (k == 0)) /* 0 or subnormal x */ { if ((lx | (hx & 0x7fffffff)) == 0) return x; /* +-0 */ @@ -39,16 +39,16 @@ __scalbln (double x, long int n) GET_HIGH_WORD (hx, x); k = ((hx & 0x7ff00000) >> 20) - 54; } - if (__builtin_expect (k == 0x7ff, 0)) + if (__glibc_unlikely (k == 0x7ff)) return x + x; /* NaN or Inf */ - if (__builtin_expect (n < -50000, 0)) + if (__glibc_unlikely (n < -50000)) return tiny * __copysign (tiny, x); /*underflow*/ - if (__builtin_expect (n > 50000 || k + n > 0x7fe, 0)) + if (__glibc_unlikely (n > 50000 || k + n > 0x7fe)) return huge * __copysign (huge, x); /* overflow */ /* Now k and n are bounded we know that k = k+n does not overflow. */ k = k + n; - if (__builtin_expect (k > 0, 1)) /* normal result */ + if (__glibc_likely (k > 0)) /* normal result */ { SET_HIGH_WORD (x, (hx & 0x800fffff) | (k << 20)); return x; } diff --git a/sysdeps/ieee754/dbl-64/s_scalbn.c b/sysdeps/ieee754/dbl-64/s_scalbn.c index 6e7d5ad217..0f58034df5 100644 --- a/sysdeps/ieee754/dbl-64/s_scalbn.c +++ b/sysdeps/ieee754/dbl-64/s_scalbn.c @@ -31,7 +31,7 @@ __scalbn (double x, int n) int32_t k, hx, lx; EXTRACT_WORDS (hx, lx, x); k = (hx & 0x7ff00000) >> 20; /* extract exponent */ - if (__builtin_expect (k == 0, 0)) /* 0 or subnormal x */ + if (__glibc_unlikely (k == 0)) /* 0 or subnormal x */ { if ((lx | (hx & 0x7fffffff)) == 0) return x; /* +-0 */ @@ -39,16 +39,16 @@ __scalbn (double x, int n) GET_HIGH_WORD (hx, x); k = ((hx & 0x7ff00000) >> 20) - 54; } - if (__builtin_expect (k == 0x7ff, 0)) + if (__glibc_unlikely (k == 0x7ff)) return x + x; /* NaN or Inf */ - if (__builtin_expect (n < -50000, 0)) + if (__glibc_unlikely (n < -50000)) return tiny * __copysign (tiny, x); /*underflow*/ - if (__builtin_expect (n > 50000 || k + n > 0x7fe, 0)) + if (__glibc_unlikely (n > 50000 || k + n > 0x7fe)) return huge * __copysign (huge, x); /* overflow */ /* Now k and n are bounded we know that k = k+n does not overflow. */ k = k + n; - if (__builtin_expect (k > 0, 1)) /* normal result */ + if (__glibc_likely (k > 0)) /* normal result */ { SET_HIGH_WORD (x, (hx & 0x800fffff) | (k << 20)); return x; } diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c index 26268f2498..ccccdaf106 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c @@ -39,7 +39,7 @@ __ieee754_acosh (double x) if (hx > INT64_C (0x4000000000000000)) { - if (__builtin_expect (hx >= INT64_C (0x41b0000000000000), 0)) + if (__glibc_unlikely (hx >= INT64_C (0x41b0000000000000))) { /* x > 2**28 */ if (hx >= INT64_C (0x7ff0000000000000)) @@ -53,13 +53,13 @@ __ieee754_acosh (double x) double t = x * x; return __ieee754_log (2.0 * x - one / (x + __ieee754_sqrt (t - one))); } - else if (__builtin_expect (hx > INT64_C (0x3ff0000000000000), 1)) + else if (__glibc_likely (hx > INT64_C (0x3ff0000000000000))) { /* 1<x<2 */ double t = x - one; return __log1p (t + __ieee754_sqrt (2.0 * t + t * t)); } - else if (__builtin_expect (hx == INT64_C (0x3ff0000000000000), 1)) + else if (__glibc_likely (hx == INT64_C (0x3ff0000000000000))) return 0.0; /* acosh(1) = 0 */ else /* x < 1 */ return (x - x) / (x - x); diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c index dcb7b58a1b..4f5a81669e 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c @@ -64,16 +64,16 @@ __ieee754_log10 (double x) k = 0; if (hx < INT64_C(0x0010000000000000)) { /* x < 2**-1022 */ - if (__builtin_expect ((hx & UINT64_C(0x7fffffffffffffff)) == 0, 0)) + if (__glibc_unlikely ((hx & UINT64_C(0x7fffffffffffffff)) == 0)) return -two54 / (x - x); /* log(+-0)=-inf */ - if (__builtin_expect (hx < 0, 0)) + if (__glibc_unlikely (hx < 0)) return (x - x) / (x - x); /* log(-#) = NaN */ k -= 54; x *= two54; /* subnormal number, scale up x */ EXTRACT_WORDS64 (hx, x); } /* scale up resulted in a NaN number */ - if (__builtin_expect (hx >= UINT64_C(0x7ff0000000000000), 0)) + if (__glibc_unlikely (hx >= UINT64_C(0x7ff0000000000000))) return x + x; k += (hx >> 52) - 1023; i = ((uint64_t) k & UINT64_C(0x8000000000000000)) >> 63; diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c index 6dc7b7d217..5ccb78cf03 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c @@ -80,15 +80,15 @@ __ieee754_log2 (double x) k = 0; if (hx < INT64_C(0x0010000000000000)) { /* x < 2**-1022 */ - if (__builtin_expect ((hx & UINT64_C(0x7fffffffffffffff)) == 0, 0)) + if (__glibc_unlikely ((hx & UINT64_C(0x7fffffffffffffff)) == 0)) return -two54 / (x - x); /* log(+-0)=-inf */ - if (__builtin_expect (hx < 0, 0)) + if (__glibc_unlikely (hx < 0)) return (x - x) / (x - x); /* log(-#) = NaN */ k -= 54; x *= two54; /* subnormal number, scale up x */ EXTRACT_WORDS64 (hx, x); } - if (__builtin_expect (hx >= UINT64_C(0x7ff0000000000000), 0)) + if (__glibc_unlikely (hx >= UINT64_C(0x7ff0000000000000))) return x + x; k += (hx >> 52) - 1023; hx &= UINT64_C(0x000fffffffffffff); diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c index d03e33ee1f..f2d980d9e0 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c @@ -39,11 +39,11 @@ __frexp (double x, int *eptr) int32_t ex = 0x7ff & (ix >> 52); int e = 0; - if (__builtin_expect (ex != 0x7ff && x != 0.0, 1)) + if (__glibc_likely (ex != 0x7ff && x != 0.0)) { /* Not zero and finite. */ e = ex - 1022; - if (__builtin_expect (ex == 0, 0)) + if (__glibc_unlikely (ex == 0)) { /* Subnormal. */ x *= 0x1p54; diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c index e51c849592..1970ce922e 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c @@ -34,7 +34,7 @@ __logb (double x) ex = ix >> 52; if (ex == 0x7ff) return x * x; - if (__builtin_expect (ex == 0, 0)) + if (__glibc_unlikely (ex == 0)) { int m = __builtin_clzll (ix); ex -= m - 12; diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c index b22503f5c7..06b9242a86 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c @@ -40,7 +40,7 @@ __remquo (double x, double y, int *quo) hx &= UINT64_C(0x7fffffffffffffff); /* Purge off exception values. */ - if (__builtin_expect (hy == 0, 0)) + if (__glibc_unlikely (hy == 0)) return (x * y) / (x * y); /* y = 0 */ if (__builtin_expect (hx >= UINT64_C(0x7ff0000000000000) /* x not finite */ || hy > UINT64_C(0x7ff0000000000000), 0))/* y is NaN */ @@ -49,7 +49,7 @@ __remquo (double x, double y, int *quo) if (hy <= UINT64_C(0x7fbfffffffffffff)) x = __ieee754_fmod (x, 8 * y); /* now x < 8y */ - if (__builtin_expect (hx == hy, 0)) + if (__glibc_unlikely (hx == hy)) { *quo = qs ? -1 : 1; return zero * x; diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c index 684858c065..8b86b81b00 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c @@ -32,7 +32,7 @@ __round (double x) EXTRACT_WORDS64 (i0, x); j0 = ((i0 >> 52) & 0x7ff) - 0x3ff; - if (__builtin_expect (j0 < 52, 1)) + if (__glibc_likely (j0 < 52)) { if (j0 < 0) { |