From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QA1QZ-0007jz-9F for qemu-devel@nongnu.org; Wed, 13 Apr 2011 10:52:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QA1QT-0006Df-3G for qemu-devel@nongnu.org; Wed, 13 Apr 2011 10:52:19 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:53571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QA1QT-0006D9-0x for qemu-devel@nongnu.org; Wed, 13 Apr 2011 10:52:13 -0400 Received: by vws17 with SMTP id 17so593155vws.4 for ; Wed, 13 Apr 2011 07:52:12 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1302645571-20500-9-git-send-email-aurelien@aurel32.net> References: <1302645571-20500-1-git-send-email-aurelien@aurel32.net> <1302645571-20500-9-git-send-email-aurelien@aurel32.net> Date: Wed, 13 Apr 2011 15:52:11 +0100 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 08/19] target-alpha: use new float64_unordered() function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: qemu-devel@nongnu.org On 12 April 2011 22:59, Aurelien Jarno wrote: > Use float64_unordered() in helper_cmptun() instead of doing the > the comparison manually. This also fixes the wrong behaviours with > sNaNs. > > Signed-off-by: Aurelien Jarno > --- > =C2=A0target-alpha/op_helper.c | =C2=A0 =C2=A05 +++-- > =C2=A01 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c > index 6c2ae20..e07ae69 100644 > --- a/target-alpha/op_helper.c > +++ b/target-alpha/op_helper.c > @@ -904,10 +904,11 @@ uint64_t helper_cmptun (uint64_t a, uint64_t b) > =C2=A0 =C2=A0 fa =3D t_to_float64(a); > =C2=A0 =C2=A0 fb =3D t_to_float64(b); > > - =C2=A0 =C2=A0if (float64_is_quiet_nan(fa) || float64_is_quiet_nan(fb)) > + =C2=A0 =C2=A0if (float64_unordered(fa, fb, &FP_STATUS)) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0x4000000000000000ULL; > - =C2=A0 =C2=A0else > + =C2=A0 =C2=A0} else { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0; > + =C2=A0 =C2=A0} > =C2=A0} I'm not sure this is right. The Alpha Architecture Handbook is a bit opaque, but the Compiler Writer's Guide is clearer: www.compaq.com/cpq-alphaserver/technology/literature/cmpwrgd.pdf page D-4 says that CMPTUN (like CMPTEQ) should generate InvalidOp for SNaNs but not for QNaNs. (Contrast CMPTLT, CMPTLE, which set InvalidOp for both SNaNs and QNaNs.) So I think you want the _quiet version here. (And helper_cmpteq needs to use float64_eq_quiet rather than float64_eq.) -- PMM