qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] fpu/softfloat.c: Return correctly signed values


From: Aurelien Jarno
Subject: Re: [Qemu-devel] [PATCH] fpu/softfloat.c: Return correctly signed values from uint64_to_float32
Date: Mon, 1 Oct 2012 18:56:50 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Sep 28, 2012 at 04:17:03PM +0100, Peter Maydell wrote:
> 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 <address@hidden>
> ---
> 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<<shiftCount );
> +        return packFloat32(0, 0x95 - shiftCount, a<<shiftCount);
>      }
>      else {
>          shiftCount += 7;
> @@ -1248,7 +1248,7 @@ float32 uint64_to_float32( uint64 a STATUS_PARAM )
>          else {
>              a <<= shiftCount;
>          }
> -        return roundAndPackFloat32( 1 > 0, 0x9C - shiftCount, a STATUS_VAR );
> +        return roundAndPackFloat32(0, 0x9C - shiftCount, a STATUS_VAR);
>      }
>  }
>  

Reviewed-by: Aurelien Jarno <address@hidden>

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
address@hidden                 http://www.aurel32.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]