From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=41079 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnFDh-00089w-Qi for qemu-devel@nongnu.org; Wed, 09 Feb 2011 13:56:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnFDg-0000NU-A6 for qemu-devel@nongnu.org; Wed, 09 Feb 2011 13:56:53 -0500 Received: from mail-ew0-f45.google.com ([209.85.215.45]:48385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnFDg-0000NO-41 for qemu-devel@nongnu.org; Wed, 09 Feb 2011 13:56:52 -0500 Received: by ewy10 with SMTP id 10so340476ewy.4 for ; Wed, 09 Feb 2011 10:56:51 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20110209183526.GA3131@volta.aurel32.net> References: <4D50252A.2000100@st.com> <4D5182BF.9050002@st.com> <20110209183526.GA3131@volta.aurel32.net> Date: Wed, 9 Feb 2011 18:56:50 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH v3] Softfloat: Add support to softfloat to return floatxx_default_nan when, the corresponding target status flag is set. From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: Christophe Lyon , "qemu-devel@nongnu.org" On 9 February 2011 18:35, Aurelien Jarno wrote: > On Tue, Feb 08, 2011 at 08:06:57PM +0000, Peter Maydell wrote: >> On 8 February 2011 18:53, Peter Maydell wrote= : >> Also, at the moment the commonNaNToFloatX(floatYToCommonNaN()) >> idiom doesn't do anything to avoid signaling NaNs showing up in >> the output. On ARM this got fixed by having the helper.c wrappers >> call float*_maybe_silence_nan() but maybe we should do it >> in the generic softfloat code? >> >> ie instead of: >> >> =C2=A0 =C2=A0 if ( mantissa ) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return make_float32( >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ( ( (bits32) a.sign )<<31 ) | = 0x7F800000 | ( a.high>>41 ) ); >> =C2=A0 =C2=A0 else >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return float32_default_nan; >> >> do: >> =C2=A0 =C2=A0float32 r =3D make_float32( >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ( ( (bits32) a.sign )<<31 ) | = 0x7F800000 | ( a.high>>41 ) ); > > On an unrelated note, if we changes in this function, it might be a good > idea to use mantissa instead of a.high>>41. It's the same, but probably > easier to read. Mmm, I noticed that (although I don't think I fixed it in my other patchset.) >> =C2=A0 =C2=A0if (!mantissa) { >> =C2=A0 =C2=A0 =C2=A0 /* target specific, !SNAN_BIT_IS_ONE targets probab= ly >> =C2=A0 =C2=A0 =C2=A0 =C2=A0* just set the QNAN bit (true for ARM, SPARC) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0* others likely return the default NaN ? >> =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ >> =C2=A0 =C2=A0} else { >> =C2=A0 =C2=A0 =C2=A0 return float32_maybe_silence_nan(r); >> =C2=A0 =C2=A0} >> >> I'm pretty sure the existing code is wrong for SPARC, for instance, >> which is supposed to return a float32 qNaN with just the QNAN bit set >> if it is presented with a float64 signalling NaN all of whose non-zero >> mantissa bits are at the bottom end and don't make it into the float32. >> (ARM dodges a bullet here because as it happens our float32 >> default_nan has only the QNAN bit set, but SPARC's has all the >> mantissa bits set.) >> >> Opinions? >> > > It makes sense. I will play a bit with a real MIPS machine to see how it > behaves and come back with my results. Thanks. (The patchset I sent skips this issue and just treats float16 the same way target-arm already treats float32 etc, ie does the silencing in the helper wrapper function, because it seemed more useful to fix that without bogging it down in whether we want to do NaN handling in the softfloat core.) -- PMM