From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LDRZa-0008Gk-Hp for qemu-devel@nongnu.org; Thu, 18 Dec 2008 17:42:26 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LDRZZ-0008GO-Uw for qemu-devel@nongnu.org; Thu, 18 Dec 2008 17:42:26 -0500 Received: from [199.232.76.173] (port=59842 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LDRZZ-0008GI-JC for qemu-devel@nongnu.org; Thu, 18 Dec 2008 17:42:25 -0500 Received: from savannah.gnu.org ([199.232.41.3]:43649 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 1LDRZZ-0007xN-8l for qemu-devel@nongnu.org; Thu, 18 Dec 2008 17:42:25 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LDRZY-0002JG-MA for qemu-devel@nongnu.org; Thu, 18 Dec 2008 22:42:24 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LDRZY-0002J9-EO for qemu-devel@nongnu.org; Thu, 18 Dec 2008 22:42:24 +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: Thu, 18 Dec 2008 22:42:24 +0000 Subject: [Qemu-devel] [6083] target-ppc: fix fres, fsqrte and remove useless code 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: 6083 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6083 Author: aurel32 Date: 2008-12-18 22:42:23 +0000 (Thu, 18 Dec 2008) Log Message: ----------- target-ppc: fix fres, fsqrte and remove useless code - fres and fsqrte should not assign a float32 number to a float64 value. - fre, fres and fsqrte are checking for cases already taken into account by softfloat and softfloat native. Remove those useless tests. Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/target-ppc/op_helper.c Modified: trunk/target-ppc/op_helper.c =================================================================== --- trunk/target-ppc/op_helper.c 2008-12-18 01:56:22 UTC (rev 6082) +++ trunk/target-ppc/op_helper.c 2008-12-18 22:42:23 UTC (rev 6083) @@ -563,18 +563,6 @@ return ((u.ll >> 52) & 0x7FF) == 0; } -#ifdef CONFIG_SOFTFLOAT -static always_inline int isnormal (float64 d) -{ - CPU_DoubleU u; - - u.d = d; - - uint32_t exp = (u.ll >> 52) & 0x7FF; - return ((0 < exp) && (exp < 0x7FF)); -} -#endif - uint32_t helper_compute_fprf (uint64_t arg, uint32_t set_fprf) { CPU_DoubleU farg; @@ -1528,20 +1516,8 @@ } else if (unlikely(float64_is_zero(farg.d))) { /* Zero reciprocal */ farg.ll = float_zero_divide_excp(fone.d, farg.d); - } else if (likely(isnormal(farg.d))) { - farg.d = float64_div(fone.d, farg.d, &env->fp_status); } else { - if (farg.ll == 0x8000000000000000ULL) { - farg.ll = 0xFFF0000000000000ULL; - } else if (farg.ll == 0x0000000000000000ULL) { - farg.ll = 0x7FF0000000000000ULL; - } else if (float64_is_nan(farg.d)) { - farg.ll = 0x7FF8000000000000ULL; - } else if (float64_is_neg(farg.d)) { - farg.ll = 0x8000000000000000ULL; - } else { - farg.ll = 0x0000000000000000ULL; - } + farg.d = float64_div(fone.d, farg.d, &env->fp_status); } return farg.d; } @@ -1550,6 +1526,7 @@ uint64_t helper_fres (uint64_t arg) { CPU_DoubleU fone, farg; + float32 f32; fone.ll = 0x3FF0000000000000ULL; /* 1.0 */ farg.ll = arg; @@ -1559,25 +1536,10 @@ } else if (unlikely(float64_is_zero(farg.d))) { /* Zero reciprocal */ farg.ll = float_zero_divide_excp(fone.d, farg.d); - } else if (likely(isnormal(farg.d))) { -#if USE_PRECISE_EMULATION - farg.d = float64_div(fone.d, farg.d, &env->fp_status); - farg.d = float64_to_float32(farg.d, &env->fp_status); -#else - farg.d = float32_div(fone.d, farg.d, &env->fp_status); -#endif } else { - if (farg.ll == 0x8000000000000000ULL) { - farg.ll = 0xFFF0000000000000ULL; - } else if (farg.ll == 0x0000000000000000ULL) { - farg.ll = 0x7FF0000000000000ULL; - } else if (float64_is_nan(farg.d)) { - farg.ll = 0x7FF8000000000000ULL; - } else if (float64_is_neg(farg.d)) { - farg.ll = 0x8000000000000000ULL; - } else { - farg.ll = 0x0000000000000000ULL; - } + farg.d = float64_div(fone.d, farg.d, &env->fp_status); + f32 = float64_to_float32(farg.d, &env->fp_status); + farg.d = float32_to_float64(f32, &env->fp_status); } return farg.ll; } @@ -1586,6 +1548,7 @@ uint64_t helper_frsqrte (uint64_t arg) { CPU_DoubleU fone, farg; + float32 f32; fone.ll = 0x3FF0000000000000ULL; /* 1.0 */ farg.ll = arg; @@ -1595,21 +1558,11 @@ } else if (unlikely(float64_is_neg(farg.d) && !float64_is_zero(farg.d))) { /* Reciprocal square root of a negative nonzero number */ farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSQRT); - } else if (likely(isnormal(farg.d))) { - farg.d = float64_sqrt(farg.d, &env->fp_status); - farg.d = float32_div(fone.d, farg.d, &env->fp_status); } else { - if (farg.ll == 0x8000000000000000ULL) { - farg.ll = 0xFFF0000000000000ULL; - } else if (farg.ll == 0x0000000000000000ULL) { - farg.ll = 0x7FF0000000000000ULL; - } else if (float64_is_nan(farg.d)) { - farg.ll |= 0x000FFFFFFFFFFFFFULL; - } else if (float64_is_neg(farg.d)) { - farg.ll = 0x7FF8000000000000ULL; - } else { - farg.ll = 0x0000000000000000ULL; - } + farg.d = float64_sqrt(farg.d, &env->fp_status); + farg.d = float64_div(fone.d, farg.d, &env->fp_status); + f32 = float64_to_float32(farg.d, &env->fp_status); + farg.d = float32_to_float64(f32, &env->fp_status); } return farg.ll; }