qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 8/9] target-i386: cleanup helper_fxam_ST0()
Date: Mon, 23 May 2011 23:02:24 +0100	[thread overview]
Message-ID: <BANLkTimtujPRAcTHuLUiUikQG1X-PRZQyw@mail.gmail.com> (raw)
In-Reply-To: <1306186971-9528-9-git-send-email-aurelien@aurel32.net>

On 23 May 2011 22:42, Aurelien Jarno <aurelien@aurel32.net> wrote:
> Rewrite helper_fxam_ST0() using only softfloat functions.
>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

(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 :-))

>     /* XXX: test fptags too */

You could fix this XXX while you were here; it's just adding

    if (env->fptags[env->fpstt]) {
       env->fpus |= 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.)

> -    expdif = EXPD(temp);
> -    if (expdif == MAXEXPD) {
> -        if (MANTD(temp) == 0x8000000000000000ULL)
> -            env->fpus |=  0x500 /*Infinity*/;
> -        else
> -            env->fpus |=  0x100 /*NaN*/;
> -    } else if (expdif == 0) {
> -        if (MANTD(temp) == 0)
> -            env->fpus |=  0x4000 /*Zero*/;
> -        else
> -            env->fpus |= 0x4400 /*Denormal*/;
> +    if (floatx80_is_infinity(ST0)) {
> +        env->fpus |=  0x500; /* (C3,C2,C0) <-- 011 */
> +    } else if (floatx80_is_any_nan(ST0)) {
> +        env->fpus |=  0x100; /* (C3,C2,C0) <-- 001 */
> +    } else if (floatx80_is_zero(ST0)) {
> +        env->fpus |= 0x4000; /* (C3,C2,C0) <-- 100 */
> +    } else if (floatx80_is_zero_or_denormal(ST0)) {
> +        env->fpus |= 0x4400; /* (C3,C2,C0) <-- 110 */
>     } else {
> -        env->fpus |= 0x400;
> +        env->fpus |=  0x400; /* (C3,C2,C0) <-- 010 */
>     }
>  }

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

  reply	other threads:[~2011-05-23 22:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 21:42 [Qemu-devel] [PATCH v2 0/9] softfloat-native removal and i386 improvement Aurelien Jarno
2011-05-23 21:42 ` [Qemu-devel] [PATCH v2 1/9] target-ppc: remove old CONFIG_SOFTFLOAT #ifdef Aurelien Jarno
2011-05-29 10:58   ` Andreas Färber
2011-05-23 21:42 ` [Qemu-devel] [PATCH v2 2/9] target-mips/gdbstub: remove old CONFIG_SOFTFLOAT #ifndef Aurelien Jarno
2011-05-23 22:09   ` Peter Maydell
2011-05-29 11:01   ` Andreas Färber
2011-05-23 21:42 ` [Qemu-devel] [PATCH v2 3/9] target-i386: remove old code handling float64 Aurelien Jarno
2011-05-24 15:12   ` Peter Maydell
2011-05-23 21:42 ` [Qemu-devel] [PATCH v2 4/9] softfloat-native: remove Aurelien Jarno
2011-05-23 21:42 ` [Qemu-devel] [PATCH v2 5/9] softfloat: always enable floatx80 and float128 support Aurelien Jarno
2011-05-23 21:42 ` [Qemu-devel] [PATCH v2 6/9] target-i386: use floatx80 constants in helper_fld*_ST0() Aurelien Jarno
2011-05-23 22:11   ` Peter Maydell
2011-05-29 10:38   ` Andreas Färber
2011-05-23 21:42 ` [Qemu-devel] [PATCH v2 7/9] softfloat: add float*_is_zero_or_denormal() Aurelien Jarno
2011-05-23 21:42 ` [Qemu-devel] [PATCH v2 8/9] target-i386: cleanup helper_fxam_ST0() Aurelien Jarno
2011-05-23 22:02   ` Peter Maydell [this message]
2011-05-23 21:42 ` [Qemu-devel] [PATCH v2 9/9] target-i386: add support for FPU exceptions Aurelien Jarno
2011-05-24 15:55   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTimtujPRAcTHuLUiUikQG1X-PRZQyw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).