From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THcJX-0002rA-7G for qemu-devel@nongnu.org; Fri, 28 Sep 2012 11:17:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THcJR-0007Y6-0A for qemu-devel@nongnu.org; Fri, 28 Sep 2012 11:17:15 -0400 Received: from 38.0.169.217.in-addr.arpa ([217.169.0.38]:36253 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THcJQ-0007Xt-Pr for qemu-devel@nongnu.org; Fri, 28 Sep 2012 11:17:08 -0400 From: Peter Maydell Date: Fri, 28 Sep 2012 16:17:03 +0100 Message-Id: <1348845423-20085-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH] fpu/softfloat.c: Return correctly signed values from uint64_to_float32 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: patches@linaro.org, Alexander Graf , Aurelien Jarno , Richard Henderson The uint64_to_float32() conversion function was incorrectly always returning numbers with the sign bit set (ie negative numbers). Correct this so we return positive numbers instead. Signed-off-by: Peter Maydell --- As far as I can see we use this function only in the three PPC SPE insns efscfuf, efsctsf, efsctuf. It is therefore untested(!); if anybody with PPC hw to test against could check the results of those functions that would be cool. fpu/softfloat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index b29256a..91497e8 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1238,7 +1238,7 @@ float32 uint64_to_float32( uint64 a STATUS_PARAM ) if ( a == 0 ) return float32_zero; shiftCount = countLeadingZeros64( a ) - 40; if ( 0 <= shiftCount ) { - return packFloat32( 1 > 0, 0x95 - shiftCount, a< 0, 0x9C - shiftCount, a STATUS_VAR ); + return roundAndPackFloat32(0, 0x9C - shiftCount, a STATUS_VAR); } } -- 1.7.9.5