From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9Oud-00068A-88 for qemu-devel@nongnu.org; Tue, 22 Nov 2016 23:12:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9Ouc-0000XA-03 for qemu-devel@nongnu.org; Tue, 22 Nov 2016 23:11:59 -0500 Date: Wed, 23 Nov 2016 15:01:18 +1100 From: David Gibson Message-ID: <20161123040118.GK28479@umbus.fritz.box> References: <1479815165-31059-1-git-send-email-nikunj@linux.vnet.ibm.com> <1479815165-31059-3-git-send-email-nikunj@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pN9MePJoZbRKbUk1" Content-Disposition: inline In-Reply-To: <1479815165-31059-3-git-send-email-nikunj@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH 2/9] target-ppc: Fix xscmpodp and xscmpudp instructions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania Cc: qemu-ppc@nongnu.org, rth@twiddle.net, qemu-devel@nongnu.org, bharata@linux.vnet.ibm.com --pN9MePJoZbRKbUk1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 22, 2016 at 05:15:58PM +0530, Nikunj A Dadhania wrote: > From: Bharata B Rao >=20 > - xscmpodp & xscmpudp are missing flags reset. > - In xscmpodp, VXCC should be set only if VE is 0 for signalling NaN case > and VXCC should be set by explicitly checking for quiet NaN case. > - Comparison is being done only if the operands are not NaNs. However as > per ISA, it should be done even when operands are NaNs. For my interest, can you explain the difference between ordered and unordered comparisons? I looked at the ISA and mostly just became confused. >=20 > Signed-off-by: Bharata B Rao > Signed-off-by: Nikunj A Dadhania > --- > target-ppc/fpu_helper.c | 41 +++++++++++++++++++++++++---------------- > 1 file changed, 25 insertions(+), 16 deletions(-) >=20 > diff --git a/target-ppc/fpu_helper.c b/target-ppc/fpu_helper.c > index d3741b4..3027003 100644 > --- a/target-ppc/fpu_helper.c > +++ b/target-ppc/fpu_helper.c > @@ -2410,29 +2410,38 @@ void helper_##op(CPUPPCState *env, uint32_t opcod= e) \ > { = \ > ppc_vsr_t xa, xb; = \ > uint32_t cc =3D 0; = \ > + bool vxsnan_flag =3D false, vxvc_flag =3D false; = \ > = \ > + helper_reset_fpstatus(env); = \ > getVSR(xA(opcode), &xa, env); = \ > getVSR(xB(opcode), &xb, env); = \ > = \ > - if (unlikely(float64_is_any_nan(xa.VsrD(0)) || = \ > - float64_is_any_nan(xb.VsrD(0)))) { = \ > - if (float64_is_signaling_nan(xa.VsrD(0), &env->fp_status) || = \ > - float64_is_signaling_nan(xb.VsrD(0), &env->fp_status)) { = \ > - float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); = \ > - } = \ > - if (ordered) { = \ > - float_invalid_op_excp(env, POWERPC_EXCP_FP_VXVC, 0); = \ > + if (float64_is_signaling_nan(xa.VsrD(0), &env->fp_status) || = \ > + float64_is_signaling_nan(xb.VsrD(0), &env->fp_status)) { = \ > + vxsnan_flag =3D true; = \ > + cc =3D 1; = \ > + if (fpscr_ve =3D=3D 0 && ordered) { = \ > + vxvc_flag =3D true; = \ > } = \ > + } else if ((float64_is_quiet_nan(xa.VsrD(0), &env->fp_status) || = \ > + float64_is_quiet_nan(xb.VsrD(0), &env->fp_status)) = \ > + && ordered) { = \ > cc =3D 1; = \ Since you're basically rewriting this, could you please change it to use symbolic constants for the CC bits, which will make it easier to follow. > + vxvc_flag =3D true; = \ > + } = \ > + if (vxsnan_flag) { = \ > + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); = \ > + } = \ > + if (vxvc_flag) { = \ > + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXVC, 0); = \ > + } = \ > + = \ > + if (float64_lt(xa.VsrD(0), xb.VsrD(0), &env->fp_status)) { = \ > + cc |=3D 8; = \ > + } else if (!float64_le(xa.VsrD(0), xb.VsrD(0), &env->fp_status)) { = \ > + cc |=3D 4; = \ > } else { = \ > - if (float64_lt(xa.VsrD(0), xb.VsrD(0), &env->fp_status)) { = \ > - cc =3D 8; = \ > - } else if (!float64_le(xa.VsrD(0), xb.VsrD(0), = \ > - &env->fp_status)) { \ > - cc =3D 4; = \ > - } else { = \ > - cc =3D 2; = \ > - } = \ > + cc |=3D 2; = \ > } = \ > = \ > env->fpscr &=3D ~(0x0F << FPSCR_FPRF); = \ --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --pN9MePJoZbRKbUk1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYNRSOAAoJEGw4ysog2bOSA9wQALmi/ao1q9EQGA//2yOgBLDO WabwDt1dRw0wBe3gWdkTM+Ic81g9r1HSehVX9FnZ3Jh1WcaojQ2o6Pxwhd8ufJKa IyNUApeHufKizq580//ufAPCjGwOgJTqtHvDGM1ETf2xHGa+0W5bfBVz8k/FyDfk DygqDGcaHO+Wq+Jqax8RXi6wgmcdp+r0sT5dFOa1rm8YuUn0/WkFPKhyIpvWD6t2 rvq5B3DJKBsVGj85WCSXT7bKvyjTTes200wuEc/nFovvGRGaagvXgIX6zP77NG2i QDn94kg6SHR7VIgit+n0nYutgsKZRzTHwDT2kTUuvrPBaXYzALfTND4/sRgloBvJ 5vIGiZxPAlQlKNm3ytU6muxAiQbxoQcqtjFR6kkVSo0xEcTCWiPdJrFvwVAixaMp TXA3BdxCbGqQBFFjgnZgnoHlee6OSSZndcoq2GVy5FcH/UuBfxmL9wDh0Mrlo3Qz tsfsNfGLEPP335+zrmzoHcaNhJeL/WNtjp/5Iat7mZZgWOaC2mW5Pk42EPo2ExQF m2sVPcn2AhuXg2VZlOm+gzLvnnkqxcsWCUKsx+P8KhxPzCIkI4Hi3WAoOdJiuPDk Or4OPBTY5G9Pd42vJj1WdIdrXCl1KKkUDJyINDUAkaxETkAoqKCtBKB+i+LYfUxO SYhL/MRIcBXAaLSOD7TY =ZrhO -----END PGP SIGNATURE----- --pN9MePJoZbRKbUk1--