From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOdCk-0006eo-UZ for qemu-devel@nongnu.org; Mon, 23 May 2011 18:02:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOdCj-0007AS-V6 for qemu-devel@nongnu.org; Mon, 23 May 2011 18:02:26 -0400 Received: from mail-iw0-f173.google.com ([209.85.214.173]:45167) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOdCj-0007AO-SJ for qemu-devel@nongnu.org; Mon, 23 May 2011 18:02:25 -0400 Received: by iwl42 with SMTP id 42so6156487iwl.4 for ; Mon, 23 May 2011 15:02:24 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1306186971-9528-9-git-send-email-aurelien@aurel32.net> References: <1306186971-9528-1-git-send-email-aurelien@aurel32.net> <1306186971-9528-9-git-send-email-aurelien@aurel32.net> Date: Mon, 23 May 2011 23:02:24 +0100 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 8/9] target-i386: cleanup helper_fxam_ST0() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: qemu-devel@nongnu.org On 23 May 2011 22:42, Aurelien Jarno wrote: > Rewrite helper_fxam_ST0() using only softfloat functions. > > Signed-off-by: Aurelien Jarno (Sorry I didn't get round to this one earlier; I think I did the easy patches and stalled on the ones I'd have to pull out the x86 manuals for :-)) > =C2=A0 =C2=A0 /* XXX: test fptags too */ You could fix this XXX while you were here; it's just adding if (env->fptags[env->fpstt]) { env->fpus |=3D 0x4100; /* (C3,C2,C0) <-- 101 */ } else ... to the top of the ladder, right? (Catching the "Unsupported" case would be slightly more tedious, we'd need to identify all the floatx80 weirdo bitpatterns as per the table in the architecture manual. Could use a FIXME/XXX comment on that account, maybe.) > - =C2=A0 =C2=A0expdif =3D EXPD(temp); > - =C2=A0 =C2=A0if (expdif =3D=3D MAXEXPD) { > - =C2=A0 =C2=A0 =C2=A0 =C2=A0if (MANTD(temp) =3D=3D 0x8000000000000000ULL= ) > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0env->fpus |=3D =C2=A00x500 /*I= nfinity*/; > - =C2=A0 =C2=A0 =C2=A0 =C2=A0else > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0env->fpus |=3D =C2=A00x100 /*N= aN*/; > - =C2=A0 =C2=A0} else if (expdif =3D=3D 0) { > - =C2=A0 =C2=A0 =C2=A0 =C2=A0if (MANTD(temp) =3D=3D 0) > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0env->fpus |=3D =C2=A00x4000 /*= Zero*/; > - =C2=A0 =C2=A0 =C2=A0 =C2=A0else > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0env->fpus |=3D 0x4400 /*Denorm= al*/; > + =C2=A0 =C2=A0if (floatx80_is_infinity(ST0)) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0env->fpus |=3D =C2=A00x500; /* (C3,C2,C0) <-= - 011 */ > + =C2=A0 =C2=A0} else if (floatx80_is_any_nan(ST0)) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0env->fpus |=3D =C2=A00x100; /* (C3,C2,C0) <-= - 001 */ > + =C2=A0 =C2=A0} else if (floatx80_is_zero(ST0)) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0env->fpus |=3D 0x4000; /* (C3,C2,C0) <-- 100= */ > + =C2=A0 =C2=A0} else if (floatx80_is_zero_or_denormal(ST0)) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0env->fpus |=3D 0x4400; /* (C3,C2,C0) <-- 110= */ > =C2=A0 =C2=A0 } else { > - =C2=A0 =C2=A0 =C2=A0 =C2=A0env->fpus |=3D 0x400; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0env->fpus |=3D =C2=A00x400; /* (C3,C2,C0) <-= - 010 */ > =C2=A0 =C2=A0 } > =C2=A0} This all looks right. The C0/C1/C2/C3 bits seem to get enough use in this and other functions to merit FPUS_* constants, although that should probably be a different patch. There's also code in helper_fstenv() which is currently doing manual identification of zero/NaN/inf/denorm. -- PMM