about summary refs log tree commit diff
path: root/sysdeps/ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/dbl-64/e_atanh.c4
-rw-r--r--sysdeps/ieee754/dbl-64/e_exp2.c4
-rw-r--r--sysdeps/ieee754/dbl-64/e_fmod.c10
-rw-r--r--sysdeps/ieee754/dbl-64/e_gamma_r.c6
-rw-r--r--sysdeps/ieee754/dbl-64/e_hypot.c2
-rw-r--r--sysdeps/ieee754/dbl-64/e_j1.c12
-rw-r--r--sysdeps/ieee754/dbl-64/e_jn.c12
-rw-r--r--sysdeps/ieee754/dbl-64/e_log.c10
-rw-r--r--sysdeps/ieee754/dbl-64/e_log10.c6
-rw-r--r--sysdeps/ieee754/dbl-64/e_log2.c6
-rw-r--r--sysdeps/ieee754/dbl-64/e_sinh.c4
-rw-r--r--sysdeps/ieee754/dbl-64/s_asinh.c4
-rw-r--r--sysdeps/ieee754/dbl-64/s_fma.c8
-rw-r--r--sysdeps/ieee754/dbl-64/s_log1p.c6
-rw-r--r--sysdeps/ieee754/dbl-64/s_logb.c2
-rw-r--r--sysdeps/ieee754/dbl-64/s_modf.c2
-rw-r--r--sysdeps/ieee754/dbl-64/s_scalbln.c10
-rw-r--r--sysdeps/ieee754/dbl-64/s_scalbn.c10
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c6
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c6
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c6
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c4
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c4
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_round.c2
-rw-r--r--sysdeps/ieee754/flt-32/e_atanhf.c4
-rw-r--r--sysdeps/ieee754/flt-32/e_gammaf_r.c6
-rw-r--r--sysdeps/ieee754/flt-32/s_logbf.c2
-rw-r--r--sysdeps/ieee754/ldbl-128/s_fmal.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_fmodl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/math_ldbl.h6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llrintl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llroundl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_logbl.c2
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_lrintl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_lroundl.c6
-rw-r--r--sysdeps/ieee754/ldbl-96/e_gammal_r.c6
-rw-r--r--sysdeps/ieee754/ldbl-96/e_j0l.c16
-rw-r--r--sysdeps/ieee754/ldbl-96/e_j1l.c16
-rw-r--r--sysdeps/ieee754/ldbl-96/e_jnl.c6
-rw-r--r--sysdeps/ieee754/ldbl-96/s_fma.c4
-rw-r--r--sysdeps/ieee754/ldbl-96/s_fmal.c6
42 files changed, 129 insertions, 129 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)
 	{
diff --git a/sysdeps/ieee754/flt-32/e_atanhf.c b/sysdeps/ieee754/flt-32/e_atanhf.c
index dbd3fe4be2..da4fa4dc0b 100644
--- a/sysdeps/ieee754/flt-32/e_atanhf.c
+++ b/sysdeps/ieee754/flt-32/e_atanhf.c
@@ -48,7 +48,7 @@ __ieee754_atanhf (float x)
   float t;
   if (isless (xa, 0.5f))
     {
-      if (__builtin_expect (xa < 0x1.0p-28f, 0))
+      if (__glibc_unlikely (xa < 0x1.0p-28f))
 	{
 	  math_force_eval (huge + x);
 	  return x;
@@ -57,7 +57,7 @@ __ieee754_atanhf (float x)
       t = xa + xa;
       t = 0.5f * __log1pf (t + t * xa / (1.0f - xa));
     }
-  else if (__builtin_expect (isless (xa, 1.0f), 1))
+  else if (__glibc_likely (isless (xa, 1.0f)))
     t = 0.5f * __log1pf ((xa + xa) / (1.0f - xa));
   else
     {
diff --git a/sysdeps/ieee754/flt-32/e_gammaf_r.c b/sysdeps/ieee754/flt-32/e_gammaf_r.c
index e8da51a42c..7b72587e9d 100644
--- a/sysdeps/ieee754/flt-32/e_gammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_gammaf_r.c
@@ -114,7 +114,7 @@ __ieee754_gammaf_r (float x, int *signgamp)
 
   GET_FLOAT_WORD (hx, x);
 
-  if (__builtin_expect ((hx & 0x7fffffff) == 0, 0))
+  if (__glibc_unlikely ((hx & 0x7fffffff) == 0))
     {
       /* Return value for x == 0 is Inf with divide by zero exception.  */
       *signgamp = 0;
@@ -127,13 +127,13 @@ __ieee754_gammaf_r (float x, int *signgamp)
       *signgamp = 0;
       return (x - x) / (x - x);
     }
-  if (__builtin_expect (hx == 0xff800000, 0))
+  if (__glibc_unlikely (hx == 0xff800000))
     {
       /* x == -Inf.  According to ISO this is NaN.  */
       *signgamp = 0;
       return x - x;
     }
-  if (__builtin_expect ((hx & 0x7f800000) == 0x7f800000, 0))
+  if (__glibc_unlikely ((hx & 0x7f800000) == 0x7f800000))
     {
       /* Positive infinity (return positive infinity) or NaN (return
 	 NaN).  */
diff --git a/sysdeps/ieee754/flt-32/s_logbf.c b/sysdeps/ieee754/flt-32/s_logbf.c
index 011adbb2b7..ba0267ebcb 100644
--- a/sysdeps/ieee754/flt-32/s_logbf.c
+++ b/sysdeps/ieee754/flt-32/s_logbf.c
@@ -27,7 +27,7 @@ __logbf (float x)
     return (float) -1.0 / fabsf (x);
   if (ix >= 0x7f800000)
     return x * x;
-  if (__builtin_expect ((rix = ix >> 23) == 0, 0))
+  if (__glibc_unlikely ((rix = ix >> 23) == 0))
     {
       /* POSIX specifies that denormal number is treated as
          though it were normalized.  */
diff --git a/sysdeps/ieee754/ldbl-128/s_fmal.c b/sysdeps/ieee754/ldbl-128/s_fmal.c
index 48b63ab51d..1d5f27b7b6 100644
--- a/sysdeps/ieee754/ldbl-128/s_fmal.c
+++ b/sysdeps/ieee754/ldbl-128/s_fmal.c
@@ -178,7 +178,7 @@ __fmal (long double x, long double y, long 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;
@@ -220,7 +220,7 @@ __fmal (long double x, long double y, long double z)
   /* Perform m2 + a2 addition with round to odd.  */
   u.d = a2 + m2;
 
-  if (__builtin_expect (adjust == 0, 1))
+  if (__glibc_likely (adjust == 0))
     {
       if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
 	u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
@@ -228,7 +228,7 @@ __fmal (long double x, long double y, long double z)
       /* 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.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
 	u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
index a140fb322d..205097d38f 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
@@ -48,7 +48,7 @@ __ieee754_fmodl (long double x, long double y)
 			    (hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
 			    (hy>0x7ff0000000000000LL),0))	/* or y is NaN */
 	    return (x*y)/(x*y);
-	if (__builtin_expect (hx <= hy, 0))
+	if (__glibc_unlikely (hx <= hy))
 	  {
 	    /* If |x| < |y| return x.  */
 	    if (hx < hy)
@@ -83,7 +83,7 @@ __ieee754_fmodl (long double x, long double y)
 	ldbl_extract_mantissa(&hx, &lx, &ix, x);
 	ldbl_extract_mantissa(&hy, &ly, &iy, y);
 
-	if (__builtin_expect (ix == -IEEE754_DOUBLE_BIAS, 0))
+	if (__glibc_unlikely (ix == -IEEE754_DOUBLE_BIAS))
 	  {
 	    /* subnormal x, shift x to normal.  */
 	    while ((hx & (1LL << 48)) == 0)
@@ -94,7 +94,7 @@ __ieee754_fmodl (long double x, long double y)
 	      }
 	  }
 
-	if (__builtin_expect (iy == -IEEE754_DOUBLE_BIAS, 0))
+	if (__glibc_unlikely (iy == -IEEE754_DOUBLE_BIAS))
 	  {
 	    /* subnormal y, shift y to normal.  */
 	    while ((hy & (1LL << 48)) == 0)
diff --git a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
index 1b6e27a9ff..051352f9f7 100644
--- a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
+++ b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
@@ -215,14 +215,14 @@ ldbl_nearbyint (double a)
 {
   double two52 = 0x1p52;
 
-  if (__builtin_expect ((__builtin_fabs (a) < two52), 1))
+  if (__glibc_likely ((__builtin_fabs (a) < two52)))
     {
-      if (__builtin_expect ((a > 0.0), 1))
+      if (__glibc_likely ((a > 0.0)))
 	{
 	  a += two52;
 	  a -= two52;
 	}
-      else if (__builtin_expect ((a < 0.0), 1))
+      else if (__glibc_likely ((a < 0.0)))
 	{
 	  a = two52 - a;
 	  a = -(a - two52);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
index 345f3905d6..86996bff3d 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
@@ -45,7 +45,7 @@ __llrintl (long double x)
     {
       save_round = __fegetround ();
 
-      if (__builtin_expect ((xh == -(double) (-__LONG_LONG_MAX__ - 1)), 0))
+      if (__glibc_unlikely ((xh == -(double) (-__LONG_LONG_MAX__ - 1))))
 	{
 	  /* When XH is 9223372036854775808.0, converting to long long will
 	     overflow, resulting in an invalid operation.  However, XL might
@@ -72,7 +72,7 @@ __llrintl (long double x)
       res = hi + lo;
 
       /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi).  */
-      if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+      if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0)))
 	goto overflow;
 
       xh -= lo;
@@ -114,7 +114,7 @@ __llrintl (long double x)
 	  break;
 	}
 
-      if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+      if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0)))
 	goto overflow;
 
       return res;
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
index 4a6e2d5f83..dd84074cf7 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
@@ -41,7 +41,7 @@ __llroundl (long double x)
 #endif
     )
     {
-      if (__builtin_expect ((xh == -(double) (-__LONG_LONG_MAX__ - 1)), 0))
+      if (__glibc_unlikely ((xh == -(double) (-__LONG_LONG_MAX__ - 1))))
 	{
 	  /* When XH is 9223372036854775808.0, converting to long long will
 	     overflow, resulting in an invalid operation.  However, XL might
@@ -68,7 +68,7 @@ __llroundl (long double x)
       res = hi + lo;
 
       /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi).  */
-      if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+      if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0)))
 	goto overflow;
 
       xh -= lo;
@@ -94,7 +94,7 @@ __llroundl (long double x)
 	    res -= 1;
 	}
 
-      if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+      if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0)))
 	goto overflow;
 
       return res;
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
index da8d71bdec..dbd3478e63 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
@@ -36,7 +36,7 @@ __logbl (long double x)
     return -1.0 / fabs (x);
   if (hx >= 0x7ff0000000000000LL)
     return x * x;
-  if (__builtin_expect ((rhx = hx >> 52) == 0, 0))
+  if (__glibc_unlikely ((rhx = hx >> 52) == 0))
     {
       /* POSIX specifies that denormal number is treated as
          though it were normalized.  */
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
index 56c3a81cd3..2b47c52a06 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
@@ -59,7 +59,7 @@ __lrintl (long double x)
 	hi = llhi;
       xh -= hi;
 #else
-      if (__builtin_expect ((xh == -(double) (-__LONG_MAX__ - 1)), 0))
+      if (__glibc_unlikely ((xh == -(double) (-__LONG_MAX__ - 1))))
 	{
 	  /* When XH is 9223372036854775808.0, converting to long long will
 	     overflow, resulting in an invalid operation.  However, XL might
@@ -87,7 +87,7 @@ __lrintl (long double x)
       res = hi + lo;
 
       /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi).  */
-      if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+      if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0)))
 	goto overflow;
 
       xh -= lo;
@@ -129,7 +129,7 @@ __lrintl (long double x)
 	  break;
 	}
 
-      if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+      if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0)))
 	goto overflow;
 
       return res;
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
index 107778df3e..27b72e2ad1 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
@@ -55,7 +55,7 @@ __lroundl (long double x)
 	hi = llhi;
       xh -= hi;
 #else
-      if (__builtin_expect ((xh == -(double) (-__LONG_MAX__ - 1)), 0))
+      if (__glibc_unlikely ((xh == -(double) (-__LONG_MAX__ - 1))))
 	{
 	  /* When XH is 9223372036854775808.0, converting to long long will
 	     overflow, resulting in an invalid operation.  However, XL might
@@ -83,7 +83,7 @@ __lroundl (long double x)
       res = hi + lo;
 
       /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi).  */
-      if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+      if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0)))
 	goto overflow;
 
       xh -= lo;
@@ -109,7 +109,7 @@ __lroundl (long double x)
 	    res -= 1;
 	}
 
-      if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+      if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0)))
 	goto overflow;
 
       return res;
diff --git a/sysdeps/ieee754/ldbl-96/e_gammal_r.c b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
index 477c3a61d3..2832f417c9 100644
--- a/sysdeps/ieee754/ldbl-96/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
@@ -119,19 +119,19 @@ __ieee754_gammal_r (long double x, int *signgamp)
 
   GET_LDOUBLE_WORDS (es, hx, lx, x);
 
-  if (__builtin_expect (((es & 0x7fff) | hx | lx) == 0, 0))
+  if (__glibc_unlikely (((es & 0x7fff) | hx | lx) == 0))
     {
       /* Return value for x == 0 is Inf with divide by zero exception.  */
       *signgamp = 0;
       return 1.0 / x;
     }
-  if (__builtin_expect (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0, 0))
+  if (__glibc_unlikely (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0))
     {
       /* x == -Inf.  According to ISO this is NaN.  */
       *signgamp = 0;
       return x - x;
     }
-  if (__builtin_expect ((es & 0x7fff) == 0x7fff, 0))
+  if (__glibc_unlikely ((es & 0x7fff) == 0x7fff))
     {
       /* Positive infinity (return positive infinity) or NaN (return
 	 NaN).  */
diff --git a/sysdeps/ieee754/ldbl-96/e_j0l.c b/sysdeps/ieee754/ldbl-96/e_j0l.c
index 3939259d81..56f48f1ab9 100644
--- a/sysdeps/ieee754/ldbl-96/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-96/e_j0l.c
@@ -112,7 +112,7 @@ __ieee754_j0l (long double x)
 
   GET_LDOUBLE_EXP (se, x);
   ix = se & 0x7fff;
-  if (__builtin_expect (ix >= 0x7fff, 0))
+  if (__glibc_unlikely (ix >= 0x7fff))
     return one / (x * x);
   x = fabsl (x);
   if (ix >= 0x4000)		/* |x| >= 2.0 */
@@ -132,7 +132,7 @@ __ieee754_j0l (long double x)
        * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
        * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
        */
-      if (__builtin_expect (ix > 0x4080, 0))	/* 2^129 */
+      if (__glibc_unlikely (ix > 0x4080))      	/* 2^129 */
 	z = (invsqrtpi * cc) / __ieee754_sqrtl (x);
       else
 	{
@@ -142,7 +142,7 @@ __ieee754_j0l (long double x)
 	}
       return z;
     }
-  if (__builtin_expect (ix < 0x3fef, 0)) /* |x| < 2**-16 */
+  if (__glibc_unlikely (ix < 0x3fef))       /* |x| < 2**-16 */
     {
       /* raise inexact if x != 0 */
       math_force_eval (huge + x);
@@ -199,11 +199,11 @@ __ieee754_y0l (long double x)
   GET_LDOUBLE_WORDS (se, i0, i1, x);
   ix = se & 0x7fff;
   /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0  */
-  if (__builtin_expect (se & 0x8000, 0))
+  if (__glibc_unlikely (se & 0x8000))
     return zero / (zero * x);
-  if (__builtin_expect (ix >= 0x7fff, 0))
+  if (__glibc_unlikely (ix >= 0x7fff))
     return one / (x + x * x);
-  if (__builtin_expect ((i0 | i1) == 0, 0))
+  if (__glibc_unlikely ((i0 | i1) == 0))
     return -HUGE_VALL + x;  /* -inf and overflow exception.  */
   if (ix >= 0x4000)
     {				/* |x| >= 2.0 */
@@ -234,7 +234,7 @@ __ieee754_y0l (long double x)
 	  else
 	    ss = z / cc;
 	}
-      if (__builtin_expect (ix > 0x4080, 0))	/* 1e39 */
+      if (__glibc_unlikely (ix > 0x4080))      	/* 1e39 */
 	z = (invsqrtpi * ss) / __ieee754_sqrtl (x);
       else
 	{
@@ -244,7 +244,7 @@ __ieee754_y0l (long double x)
 	}
       return z;
     }
-  if (__builtin_expect (ix <= 0x3fde, 0)) /* x < 2^-33 */
+  if (__glibc_unlikely (ix <= 0x3fde))       /* x < 2^-33 */
     {
       z = -7.380429510868722527629822444004602747322E-2L
 	+ tpi * __ieee754_logl (x);
diff --git a/sysdeps/ieee754/ldbl-96/e_j1l.c b/sysdeps/ieee754/ldbl-96/e_j1l.c
index 4c13018aea..5c0a2e1992 100644
--- a/sysdeps/ieee754/ldbl-96/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-96/e_j1l.c
@@ -114,7 +114,7 @@ __ieee754_j1l (long double x)
 
   GET_LDOUBLE_EXP (se, x);
   ix = se & 0x7fff;
-  if (__builtin_expect (ix >= 0x7fff, 0))
+  if (__glibc_unlikely (ix >= 0x7fff))
     return one / x;
   y = fabsl (x);
   if (ix >= 0x4000)
@@ -134,7 +134,7 @@ __ieee754_j1l (long double x)
        * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
        * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
        */
-      if (__builtin_expect (ix > 0x4080, 0))
+      if (__glibc_unlikely (ix > 0x4080))
 	z = (invsqrtpi * cc) / __ieee754_sqrtl (y);
       else
 	{
@@ -147,7 +147,7 @@ __ieee754_j1l (long double x)
       else
 	return z;
     }
-  if (__builtin_expect (ix < 0x3fde, 0)) /* |x| < 2^-33 */
+  if (__glibc_unlikely (ix < 0x3fde))       /* |x| < 2^-33 */
     {
       if (huge + x > one)
 	return 0.5 * x;		/* inexact if x!=0 necessary */
@@ -192,11 +192,11 @@ __ieee754_y1l (long double x)
   GET_LDOUBLE_WORDS (se, i0, i1, x);
   ix = se & 0x7fff;
   /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
-  if (__builtin_expect (se & 0x8000, 0))
+  if (__glibc_unlikely (se & 0x8000))
     return zero / (zero * x);
-  if (__builtin_expect (ix >= 0x7fff, 0))
+  if (__glibc_unlikely (ix >= 0x7fff))
     return one / (x + x * x);
-  if (__builtin_expect ((i0 | i1) == 0, 0))
+  if (__glibc_unlikely ((i0 | i1) == 0))
     return -HUGE_VALL + x;  /* -inf and overflow exception.  */
   if (ix >= 0x4000)
     {				/* |x| >= 2.0 */
@@ -222,7 +222,7 @@ __ieee754_y1l (long double x)
        *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
        * to compute the worse one.
        */
-      if (__builtin_expect (ix > 0x4080, 0))
+      if (__glibc_unlikely (ix > 0x4080))
 	z = (invsqrtpi * ss) / __ieee754_sqrtl (x);
       else
 	{
@@ -232,7 +232,7 @@ __ieee754_y1l (long double x)
 	}
       return z;
     }
-  if (__builtin_expect (ix <= 0x3fbe, 0))
+  if (__glibc_unlikely (ix <= 0x3fbe))
     {				/* x < 2**-65 */
       return (-tpi / x);
     }
diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c
index fa8e27efec..11d097c271 100644
--- a/sysdeps/ieee754/ldbl-96/e_jnl.c
+++ b/sysdeps/ieee754/ldbl-96/e_jnl.c
@@ -81,7 +81,7 @@ __ieee754_jnl (int n, long double x)
   ix = se & 0x7fff;
 
   /* if J(n,NaN) is NaN */
-  if (__builtin_expect ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0), 0))
+  if (__glibc_unlikely ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0)))
     return x + x;
   if (n < 0)
     {
@@ -95,7 +95,7 @@ __ieee754_jnl (int n, long double x)
     return (__ieee754_j1l (x));
   sgn = (n & 1) & (se >> 15);	/* even n -- 0, odd n -- sign(x) */
   x = fabsl (x);
-  if (__builtin_expect ((ix | i0 | i1) == 0 || ix >= 0x7fff, 0))
+  if (__glibc_unlikely ((ix | i0 | i1) == 0 || ix >= 0x7fff))
     /* if x is 0 or inf */
     b = zero;
   else if ((long double) n <= x)
@@ -316,7 +316,7 @@ __ieee754_ynl (int n, long double x)
     return (__ieee754_y0l (x));
   if (n == 1)
     return (sign * __ieee754_y1l (x));
-  if (__builtin_expect (ix == 0x7fff, 0))
+  if (__glibc_unlikely (ix == 0x7fff))
     return zero;
   if (ix >= 0x412D)
     {				/* x > 2**302 */
diff --git a/sysdeps/ieee754/ldbl-96/s_fma.c b/sysdeps/ieee754/ldbl-96/s_fma.c
index fde2811040..354be4eae9 100644
--- a/sysdeps/ieee754/ldbl-96/s_fma.c
+++ b/sysdeps/ieee754/ldbl-96/s_fma.c
@@ -29,7 +29,7 @@
 double
 __fma (double x, double y, double z)
 {
-  if (__builtin_expect (isinf (z), 0))
+  if (__glibc_unlikely (isinf (z)))
     {
       /* If z is Inf, but x and y are finite, the result should be
 	 z rather than NaN.  */
@@ -39,7 +39,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;
diff --git a/sysdeps/ieee754/ldbl-96/s_fmal.c b/sysdeps/ieee754/ldbl-96/s_fmal.c
index 0564321354..4983eda9c6 100644
--- a/sysdeps/ieee754/ldbl-96/s_fmal.c
+++ b/sysdeps/ieee754/ldbl-96/s_fmal.c
@@ -176,7 +176,7 @@ __fmal (long double x, long double y, long 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;
@@ -218,7 +218,7 @@ __fmal (long double x, long double y, long double z)
   /* Perform m2 + a2 addition with round to odd.  */
   u.d = a2 + m2;
 
-  if (__builtin_expect (adjust == 0, 1))
+  if (__glibc_likely (adjust == 0))
     {
       if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
 	u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
@@ -226,7 +226,7 @@ __fmal (long double x, long double y, long double z)
       /* 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 != 0x7fff)
 	u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;