Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCH1T-0004wz-Eg for qemu-devel@nongnu.org; Mon, 15 Dec 2008 12:14:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCH1S-0004wL-Gm for qemu-devel@nongnu.org; Mon, 15 Dec 2008 12:14:22 -0500 Received: from [199.232.76.173] (port=38794 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCH1S-0004wI-5m for qemu-devel@nongnu.org; Mon, 15 Dec 2008 12:14:22 -0500 Received: from savannah.gnu.org ([199.232.41.3]:48415 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LCH1R-0004lx-Pc for qemu-devel@nongnu.org; Mon, 15 Dec 2008 12:14:22 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LCH1Q-0002qk-Vq for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:14:21 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LCH1Q-0002qg-M3 for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:14:20 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Mon, 15 Dec 2008 17:14:20 +0000 Subject: [Qemu-devel] [6050] fp: add floatXX_is_infinity(), floatXX_is_neg(), floatXX_is_zero() Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6050 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6050 Author: aurel32 Date: 2008-12-15 17:14:20 +0000 (Mon, 15 Dec 2008) Log Message: ----------- fp: add floatXX_is_infinity(), floatXX_is_neg(), floatXX_is_zero() Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/fpu/softfloat-native.h trunk/fpu/softfloat.h Modified: trunk/fpu/softfloat-native.h =================================================================== --- trunk/fpu/softfloat-native.h 2008-12-15 17:14:12 UTC (rev 6049) +++ trunk/fpu/softfloat-native.h 2008-12-15 17:14:20 UTC (rev 6050) @@ -258,6 +258,21 @@ return -a; } +INLINE float32 float32_is_infinity(float32 a) +{ + return fpclassify(a) == FP_INFINITE; +} + +INLINE float32 float32_is_neg(float32 a) +{ + return a < 0.0; +} + +INLINE float32 float32_is_zero(float32 a) +{ + return fpclassify(a) == FP_ZERO; +} + INLINE float32 float32_scalbn(float32 a, int n) { return scalbnf(a, n); @@ -350,6 +365,21 @@ return -a; } +INLINE float64 float64_is_infinity(float64 a) +{ + return fpclassify(a) == FP_INFINITE; +} + +INLINE float64 float64_is_neg(float64 a) +{ + return a < 0.0; +} + +INLINE float64 float64_is_zero(float64 a) +{ + return fpclassify(a) == FP_ZERO; +} + INLINE float64 float64_scalbn(float64 a, int n) { return scalbn(a, n); @@ -437,6 +467,21 @@ return -a; } +INLINE floatx80 floatx80_is_infinity(floatx80 a) +{ + return fpclassify(a) == FP_INFINITE; +} + +INLINE floatx80 floatx80_is_neg(floatx80 a) +{ + return a < 0.0; +} + +INLINE floatx80 floatx80_is_zero(floatx80 a) +{ + return fpclassify(a) == FP_ZERO; +} + INLINE floatx80 floatx80_scalbn(floatx80 a, int n) { return scalbnl(a, n); Modified: trunk/fpu/softfloat.h =================================================================== --- trunk/fpu/softfloat.h 2008-12-15 17:14:12 UTC (rev 6049) +++ trunk/fpu/softfloat.h 2008-12-15 17:14:20 UTC (rev 6050) @@ -281,6 +281,21 @@ return make_float32(float32_val(a) ^ 0x80000000); } +INLINE int float32_is_infinity(float32 a) +{ + return (float32_val(a) & 0x7fffffff) == 0x7ff80000; +} + +INLINE int float32_is_neg(float32 a) +{ + return float32_val(a) >> 31; +} + +INLINE int float32_is_zero(float32 a) +{ + return (float32_val(a) & 0x7fffffff) == 0; +} + #define float32_zero make_float32(0) /*---------------------------------------------------------------------------- @@ -335,6 +350,21 @@ return make_float64(float64_val(a) ^ 0x8000000000000000LL); } +INLINE int float64_is_infinity(float64 a) +{ + return (float64_val(a) & 0x7fffffffffffffffLL ) == 0x7ff0000000000000LL; +} + +INLINE int float64_is_neg(float64 a) +{ + return float64_val(a) >> 63; +} + +INLINE int float64_is_zero(float64 a) +{ + return (float64_val(a) & 0x7fffffffffffffffLL) == 0; +} + #define float64_zero make_float64(0) #ifdef FLOATX80 @@ -384,6 +414,21 @@ return a; } +INLINE int floatx80_is_infinity(floatx80 a) +{ + return (a.high & 0x7fff) == 0x7fff && a.low == 0; +} + +INLINE int floatx80_is_neg(floatx80 a) +{ + return a.high >> 15; +} + +INLINE int floatx80_is_zero(floatx80 a) +{ + return (a.high & 0x7fff) == 0 && a.low == 0; +} + #endif #ifdef FLOAT128 @@ -435,6 +480,21 @@ return a; } +INLINE int float128_is_infinity(float128 a) +{ + return (a.high & 0x7fffffffffffffffLL) == 0x7fff000000000000LL && a.low == 0; +} + +INLINE int float128_is_neg(float128 a) +{ + return a.high >> 63; +} + +INLINE int float128_is_zero(float128 a) +{ + return (a.high & 0x7fffffffffffffffLL) == 0 && a.low == 0; +} + #endif #else /* CONFIG_SOFTFLOAT */