Commit 78815c55 by Joseph Myers Committed by Joseph Myers

fp-bit.c (isnan, [...]): Use __builtin_expect.

	* config/fp-bit.c (isnan, isinf, pack_d, unpack_d): Use
	__builtin_expect.

From-SVN: r107603
parent e13dd54f
2005-11-28 Joseph S. Myers <joseph@codesourcery.com> 2005-11-28 Joseph S. Myers <joseph@codesourcery.com>
* config/fp-bit.c (isnan, isinf, pack_d, unpack_d): Use
__builtin_expect.
2005-11-28 Joseph S. Myers <joseph@codesourcery.com>
* config/fp-bit.h (LSHIFT): Take shift count parameter. * config/fp-bit.h (LSHIFT): Take shift count parameter.
* config/fp-bit.c (_fpadd_parts): Shift in one go instead of one * config/fp-bit.c (_fpadd_parts): Shift in one go instead of one
bit at a time. bit at a time.
......
...@@ -160,14 +160,15 @@ INLINE ...@@ -160,14 +160,15 @@ INLINE
static int static int
isnan ( fp_number_type * x) isnan ( fp_number_type * x)
{ {
return x->class == CLASS_SNAN || x->class == CLASS_QNAN; return __builtin_expect (x->class == CLASS_SNAN || x->class == CLASS_QNAN,
0);
} }
INLINE INLINE
static int static int
isinf ( fp_number_type * x) isinf ( fp_number_type * x)
{ {
return x->class == CLASS_INFINITY; return __builtin_expect (x->class == CLASS_INFINITY, 0);
} }
#endif /* NO_NANS */ #endif /* NO_NANS */
...@@ -249,7 +250,7 @@ pack_d ( fp_number_type * src) ...@@ -249,7 +250,7 @@ pack_d ( fp_number_type * src)
} }
else else
{ {
if (src->normal_exp < NORMAL_EXPMIN) if (__builtin_expect (src->normal_exp < NORMAL_EXPMIN, 0))
{ {
#ifdef NO_DENORMALS #ifdef NO_DENORMALS
/* Go straight to a zero representation if denormals are not /* Go straight to a zero representation if denormals are not
...@@ -296,7 +297,7 @@ pack_d ( fp_number_type * src) ...@@ -296,7 +297,7 @@ pack_d ( fp_number_type * src)
#endif /* NO_DENORMALS */ #endif /* NO_DENORMALS */
} }
else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS)
&& src->normal_exp > EXPBIAS) && __builtin_expect (src->normal_exp > EXPBIAS, 0))
{ {
exp = EXPMAX; exp = EXPMAX;
fraction = 0; fraction = 0;
...@@ -560,7 +561,8 @@ unpack_d (FLO_union_type * src, fp_number_type * dst) ...@@ -560,7 +561,8 @@ unpack_d (FLO_union_type * src, fp_number_type * dst)
dst->fraction.ll = fraction; dst->fraction.ll = fraction;
} }
} }
else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp == EXPMAX) else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS)
&& __builtin_expect (exp == EXPMAX, 0))
{ {
/* Huge exponent*/ /* Huge exponent*/
if (fraction == 0) if (fraction == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment