qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Joseph Myers <joseph@codesourcery.com>
Cc: peter.maydell@linaro.org, ehabkost@redhat.com,
	qemu-devel@nongnu.org, laurent@vivier.eu, pbonzini@redhat.com,
	aurelien@aurel32.net, rth@twiddle.net
Subject: Re: [PATCH 6/7] target/i386: reimplement fprem1 using floatx80 operations
Date: Mon, 08 Jun 2020 17:46:52 +0100	[thread overview]
Message-ID: <87a71d5wub.fsf@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2006051901480.13777@digraph.polyomino.org.uk>


Joseph Myers <joseph@codesourcery.com> writes:

> The x87 fprem1 emulation is currently based around conversion to
> double, which is inherently unsuitable for a good emulation of any
> floatx80 operation.  Reimplement using the soft-float floatx80
> remainder operations.
>
> Signed-off-by: Joseph Myers <joseph@codesourcery.com>
> ---
>  target/i386/fpu_helper.c | 96 +++++++++++++++++++---------------------
>  1 file changed, 45 insertions(+), 51 deletions(-)
>
> diff --git a/target/i386/fpu_helper.c b/target/i386/fpu_helper.c
> index 8ef5b463ea..bab35e00a0 100644
> --- a/target/i386/fpu_helper.c
> +++ b/target/i386/fpu_helper.c
> @@ -934,63 +934,57 @@ void helper_fxtract(CPUX86State *env)
>      merge_exception_flags(env, old_flags);
>  }
>  
> -void helper_fprem1(CPUX86State *env)
> +static void helper_fprem_common(CPUX86State *env, bool mod)
>  {
> -    double st0, st1, dblq, fpsrcop, fptemp;
> -    CPU_LDoubleU fpsrcop1, fptemp1;
> -    int expdif;
> -    signed long long int q;
> -
> -    st0 = floatx80_to_double(env, ST0);
> -    st1 = floatx80_to_double(env, ST1);
> -
> -    if (isinf(st0) || isnan(st0) || isnan(st1) || (st1 == 0.0)) {
> -        ST0 = double_to_floatx80(env, 0.0 / 0.0); /* NaN */
> -        env->fpus &= ~0x4700; /* (C3,C2,C1,C0) <-- 0000 */
> -        return;
> -    }
> -
> -    fpsrcop = st0;
> -    fptemp = st1;
> -    fpsrcop1.d = ST0;
> -    fptemp1.d = ST1;
> -    expdif = EXPD(fpsrcop1) - EXPD(fptemp1);
> -
> -    if (expdif < 0) {
> -        /* optimisation? taken from the AMD docs */
> -        env->fpus &= ~0x4700; /* (C3,C2,C1,C0) <-- 0000 */
> -        /* ST0 is unchanged */
> -        return;
> -    }
> +    uint8_t old_flags = save_exception_flags(env);

Hmm where did this come from:

/home/alex/lsrc/qemu.git/target/i386/fpu_helper.c: In function ‘helper_fprem_common’:
/home/alex/lsrc/qemu.git/target/i386/fpu_helper.c:784:25: error: implicit declaration of function ‘save_exception_flags’; did you mean ‘raise_exception_ra’? [-Werror=implicit-function-declaration]
     uint8_t old_flags = save_exception_flags(env);
                         ^~~~~~~~~~~~~~~~~~~~
                         raise_exception_ra
/home/alex/lsrc/qemu.git/target/i386/fpu_helper.c:784:25: error: nested extern declaration of ‘save_exception_flags’ [-Werror=nested-externs]
/home/alex/lsrc/qemu.git/target/i386/fpu_helper.c:827:5: error: implicit declaration of function ‘merge_exception_flags’; did you mean ‘get_float_exception_flags’? [-Werror=implicit-function-declaration]
     merge_exception_flags(env, old_flags);
     ^~~~~~~~~~~~~~~~~~~~~
     get_float_exception_flags
/home/alex/lsrc/qemu.git/target/i386/fpu_helper.c:827:5: error: nested extern declaration of ‘merge_exception_flags’ [-Werror=nested-externs]
cc1: all warnings being treated as errors

-- 
Alex Bennée


  parent reply	other threads:[~2020-06-08 16:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 18:58 [PATCH 0/7] softfloat, target/i386: fprem, fprem1 fixes Joseph Myers
2020-06-05 18:59 ` [PATCH 1/7] softfloat: merge floatx80_mod and floatx80_rem Joseph Myers
2020-06-06 19:06   ` Richard Henderson
2020-06-05 19:00 ` [PATCH 2/7] softfloat: fix floatx80 remainder pseudo-denormal check for zero Joseph Myers
2020-06-06 19:06   ` Richard Henderson
2020-06-05 19:00 ` [PATCH 3/7] softfloat: do not return pseudo-denormal from floatx80 remainder Joseph Myers
2020-06-06 19:08   ` Richard Henderson
2020-06-05 19:01 ` [PATCH 4/7] softfloat: do not set denominator high bit for " Joseph Myers
2020-06-06 19:08   ` Richard Henderson
2020-06-05 19:01 ` [PATCH 5/7] softfloat: return low bits of quotient from floatx80_modrem Joseph Myers
2020-06-06 19:15   ` Richard Henderson
2020-06-05 19:02 ` [PATCH 6/7] target/i386: reimplement fprem1 using floatx80 operations Joseph Myers
2020-06-06 19:16   ` Richard Henderson
2020-06-08 16:46   ` Alex Bennée [this message]
2020-06-08 16:51     ` Joseph Myers
2020-06-08 21:03       ` Alex Bennée
2020-06-05 19:02 ` [PATCH 7/7] target/i386: reimplement fprem " Joseph Myers

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=87a71d5wub.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=ehabkost@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=laurent@vivier.eu \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).