From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=43675 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pmq2E-00038u-La for qemu-devel@nongnu.org; Tue, 08 Feb 2011 11:03:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pmq2D-0002Xy-JV for qemu-devel@nongnu.org; Tue, 08 Feb 2011 11:03:22 -0500 Received: from mail-gy0-f173.google.com ([209.85.160.173]:59336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pmq2D-0002Xp-Gt for qemu-devel@nongnu.org; Tue, 08 Feb 2011 11:03:21 -0500 Received: by gye5 with SMTP id 5so2572177gye.4 for ; Tue, 08 Feb 2011 08:03:20 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <4D50252A.2000100@st.com> References: <4D50252A.2000100@st.com> Date: Tue, 8 Feb 2011 15:59:46 +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: Christophe Lyon Cc: "qemu-devel@nongnu.org" On 7 February 2011 17:00, Christophe Lyon wrote: > > Some CPUs have a status flag imposing to return floatxx_default_nan > whatever the input value, when converting from one FP format to > another. Implement this, using the already existing default_nan_mode > status flag (currently used on ARM and SH4 at the moment). > > Signed-off-by: Christophe Lyon Your subject is a bit long, which can make it wrap annoyingly in git logs. I'd suggest something like: =3D=3D=3Dbegin=3D=3D=3D softfloat: Honour default_nan_mode for float-to-float conversions Honour the default_nan_mode flag when doing conversions between different floating point formats, as well as when returning a NaN from a two-operand floating point function. This corrects the behaviour of float<->double conversions on both ARM and SH4. =3D=3D=3Dendit=3D=3D=3D > +/*----------------------------------------------------------------------= ------ > +| The pattern for a default generated haft-precision NaN. > +*-----------------------------------------------------------------------= -----*/ "half-precision". > @@ -2767,11 +2767,7 @@ bits16 float32_to_float16( float32 a, flag ieee ST= ATUS_PARAM) > =C2=A0 =C2=A0 aExp =3D extractFloat32Exp( a ); > =C2=A0 =C2=A0 aSign =3D extractFloat32Sign( a ); > =C2=A0 =C2=A0 if ( aExp =3D=3D 0xFF ) { > - =C2=A0 =C2=A0 =C2=A0 =C2=A0if (aSig) { > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Make sure correct exception= s are raised. =C2=A0*/ > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0float32ToCommonNaN(a STATUS_VA= R); > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0aSig |=3D 0x00400000; > - =C2=A0 =C2=A0 =C2=A0 =C2=A0} > + =C2=A0 =C2=A0 =C2=A0 =C2=A0if ( aSig ) return commonNaNToFloat16( float= 32ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return packFloat16(aSign, 0x1f, aSig >> 13); > =C2=A0 =C2=A0 } > =C2=A0 =C2=A0 if (aExp =3D=3D 0 && aSign =3D=3D 0) { This is float32_to_float16() but it looks like you've missed float16_to_float32() ? Otherwise, looks good, and I can confirm that it fixes behaviour of VCVT.F32.F64 and VCVT.F64.F32 when the FPSCR.DN bit is set. -- PMM