softfloat: Implement floatx80_is_any_nan() and float128_is_any_nan()

Implement versions of float*_is_any_nan() for the floatx80 and
float128 types.

Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
This commit is contained in:
Peter Maydell 2011-01-06 18:34:43 +00:00 committed by Riku Voipio
parent 285da2b9a8
commit 2bed652fc5

View File

@ -489,6 +489,11 @@ INLINE int floatx80_is_zero(floatx80 a)
return (a.high & 0x7fff) == 0 && a.low == 0; return (a.high & 0x7fff) == 0 && a.low == 0;
} }
INLINE int floatx80_is_any_nan(floatx80 a)
{
return ((a.high & 0x7fff) == 0x7fff) && (a.low<<1);
}
#endif #endif
#ifdef FLOAT128 #ifdef FLOAT128
@ -556,6 +561,12 @@ INLINE int float128_is_zero(float128 a)
return (a.high & 0x7fffffffffffffffLL) == 0 && a.low == 0; return (a.high & 0x7fffffffffffffffLL) == 0 && a.low == 0;
} }
INLINE int float128_is_any_nan(float128 a)
{
return ((a.high >> 48) & 0x7fff) == 0x7fff &&
((a.low != 0) || ((a.high & 0xffffffffffffLL) != 0));
}
#endif #endif
#else /* CONFIG_SOFTFLOAT */ #else /* CONFIG_SOFTFLOAT */