From: Thiemo Seufer <ths@networkno.de>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Fix NaN handling in softfloat
Date: Sat, 3 Nov 2007 18:30:49 +0000 [thread overview]
Message-ID: <20071103183048.GD14756@networkno.de> (raw)
In-Reply-To: <20071103173548.GA16847@hall.aurel32.net>
Aurelien Jarno wrote:
> Hi all,
>
> The current softfloat implementation changes qNaN into sNaN when
> converting between formats, for no reason. The attached patch fixes
> that.
Did you take into account that MIPS and PA-RISC have the signalling
bit inverted to the rest of the world?
> It also fixes an off-by-one in the extended double precision
> format (aka floatx80), the mantissa is 64-bit long and not 63-bit
> long.
>
> With this patch applied all the glibc 2.7 floating point tests
> are successfull on MIPS and MIPSEL.
>
> Bye,
> Aurelien
>
> Index: fpu/softfloat-specialize.h
> ===================================================================
> RCS file: /sources/qemu/qemu/fpu/softfloat-specialize.h,v
> retrieving revision 1.3
> diff -u -d -p -r1.3 softfloat-specialize.h
> --- fpu/softfloat-specialize.h 11 May 2007 17:10:14 -0000 1.3
> +++ fpu/softfloat-specialize.h 3 Nov 2007 17:21:38 -0000
> @@ -121,8 +121,7 @@ static commonNaNT float32ToCommonNaN( fl
> static float32 commonNaNToFloat32( commonNaNT a )
> {
>
> - return ( ( (bits32) a.sign )<<31 ) | 0x7FC00000 | ( a.high>>41 );
> -
> + return ( ( (bits32) a.sign )<<31 ) | 0x7F800000 | ( a.high>>41 );
> }
>
> /*----------------------------------------------------------------------------
> @@ -233,7 +232,7 @@ static float64 commonNaNToFloat64( commo
>
> return
> ( ( (bits64) a.sign )<<63 )
> - | LIT64( 0x7FF8000000000000 )
> + | LIT64( 0x7FF0000000000000 )
> | ( a.high>>12 );
>
> }
> @@ -329,7 +328,7 @@ static commonNaNT floatx80ToCommonNaN( f
> if ( floatx80_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR);
> z.sign = a.high>>15;
> z.low = 0;
> - z.high = a.low<<1;
> + z.high = a.low;
> return z;
>
> }
> @@ -343,7 +342,7 @@ static floatx80 commonNaNToFloatx80( com
> {
> floatx80 z;
>
> - z.low = LIT64( 0xC000000000000000 ) | ( a.high>>1 );
> + z.low = a.high;
> z.high = ( ( (bits16) a.sign )<<15 ) | 0x7FFF;
> return z;
>
> @@ -449,7 +448,7 @@ static float128 commonNaNToFloat128( com
> float128 z;
>
> shift128Right( a.high, a.low, 16, &z.high, &z.low );
> - z.high |= ( ( (bits64) a.sign )<<63 ) | LIT64( 0x7FFF800000000000 );
> + z.high |= ( ( (bits64) a.sign )<<63 ) | LIT64( 0x7FFF000000000000 );
> return z;
>
> }
>
> --
> .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
> : :' : Debian developer | Electrical Engineer
> `. `' aurel32@debian.org | aurelien@aurel32.net
> `- people.debian.org/~aurel32 | www.aurel32.net
>
>
>
next prev parent reply other threads:[~2007-11-03 18:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-03 17:35 [Qemu-devel] [PATCH] Fix NaN handling in softfloat Aurelien Jarno
2007-11-03 18:06 ` Daniel Jacobowitz
2007-11-03 19:14 ` Aurelien Jarno
2007-11-03 21:28 ` Aurelien Jarno
2007-11-06 20:01 ` J. Mayer
2007-11-06 21:14 ` Thiemo Seufer
2007-11-07 23:05 ` Aurelien Jarno
2007-11-07 23:12 ` Daniel Jacobowitz
2007-11-08 0:41 ` Thiemo Seufer
2007-11-09 22:31 ` J. Mayer
2007-11-10 9:35 ` Aurelien Jarno
2007-11-10 13:31 ` J. Mayer
2007-11-10 16:15 ` Aurelien Jarno
2007-11-10 17:14 ` J. Mayer
2007-11-10 18:09 ` Aurelien Jarno
2007-11-10 22:44 ` J. Mayer
2007-11-10 21:18 ` Thiemo Seufer
2007-11-10 21:46 ` Aurelien Jarno
2007-11-21 15:49 ` Aurelien Jarno
2007-12-16 12:43 ` Aurelien Jarno
2007-11-03 18:30 ` Thiemo Seufer [this message]
2007-11-03 19:13 ` Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071103183048.GD14756@networkno.de \
--to=ths@networkno.de \
--cc=aurelien@aurel32.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).