All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH 4/5] target-ppc: use the softfloat float32_muladd function
Date: Sun, 9 Sep 2012 12:03:35 +0200	[thread overview]
Message-ID: <20120909100335.GQ17750@hall.aurel32.net> (raw)
In-Reply-To: <CAFEAcA9evGx_f0NdLQ5UyENbehYwZ7j3F5fzxDn2OoPKibG_9A@mail.gmail.com>

On Sun, Sep 09, 2012 at 10:51:20AM +0100, Peter Maydell wrote:
> On 8 September 2012 22:12, Aurelien Jarno <aurelien@aurel32.net> wrote:
> > +#define VARITHFPFMA(suffix, type)                                       \
> > +    void helper_v##suffix(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, \
> > +                           ppc_avr_t *b, ppc_avr_t *c)                  \
> > +    {                                                                   \
> > +        int i;                                                          \
> > +        for (i = 0; i < ARRAY_SIZE(r->f); i++) {                        \
> > +            r->f[i] = float32_muladd(a->f[i], c->f[i], b->f[i],         \
> > +                                     type, &env->vec_status);           \
> > +        }                                                               \
> > +    }
> > +VARITHFPFMA(maddfp, 0);
> > +VARITHFPFMA(nmsubfp, float_muladd_negate_result);
> > +#undef VARITHFPFMA
> > +
> >  #define VARITHSAT_CASE(type, op, cvt, element)                          \
> >      {                                                                   \
> >          type result = (type)a->element[i] op (type)b->element[i];       \
> > -void helper_vnmsubfp(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a,
> > -                     ppc_avr_t *b, ppc_avr_t *c)
> > -{
> > -    int i;
> > -
> > -    for (i = 0; i < ARRAY_SIZE(r->f); i++) {
> > -        HANDLE_NAN3(r->f[i], a->f[i], b->f[i], c->f[i]) {
> > -            /* Need to do the computation is higher precision and round
> > -             * once at the end.  */
> > -            float64 af, bf, cf, t;
> > -
> > -            af = float32_to_float64(a->f[i], &env->vec_status);
> > -            bf = float32_to_float64(b->f[i], &env->vec_status);
> > -            cf = float32_to_float64(c->f[i], &env->vec_status);
> > -            t = float64_mul(af, cf, &env->vec_status);
> > -            t = float64_sub(t, bf, &env->vec_status);
> > -            t = float64_chs(t);
> > -            r->f[i] = float64_to_float32(t, &env->vec_status);
> > -        }
> > -    }
> > -}
> 
> I mentioned this in my comment on the other patch, but just to attach
> it to the right patch for the benefit of the archives:
> the code here for vnmsub is (correctly) doing a subtraction of bf
> and then negating the final result, so you need to pass float_muladd
> the flags negate_result | negate_c, not just negate_result.
> 

Correct, or alternatively it could use negate_product. I'll send an
updated patch later.


-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2012-09-09 10:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-08 21:12 [Qemu-devel] [PATCH 1/5] softfloat: fix float{32, 64}_muladd options Aurelien Jarno
2012-09-08 21:12 ` [Qemu-devel] [PATCH 2/5] target-ppc: simplify NaN propagation for vector functions Aurelien Jarno
2012-09-08 21:12 ` [Qemu-devel] [PATCH 3/5] target-ppc: use the softfloat min/max functions Aurelien Jarno
2012-09-08 21:12 ` [Qemu-devel] [PATCH 4/5] target-ppc: use the softfloat float32_muladd function Aurelien Jarno
2012-09-09  9:51   ` Peter Maydell
2012-09-09 10:03     ` Aurelien Jarno [this message]
2012-09-08 21:12 ` [Qemu-devel] [PATCH 5/5] target-ppc: get rid of the HANDLE_NAN{1, 2, 3} macros Aurelien Jarno
2012-09-08 22:40   ` Peter Maydell
2012-09-08 21:40 ` [Qemu-devel] [PATCH 1/5] softfloat: fix float{32, 64}_muladd options Max Filippov
2012-09-08 22:29   ` Peter Maydell
2012-09-09  9:24   ` Aurelien Jarno
2012-09-09  9:47     ` Peter Maydell
2012-09-09 10:04       ` Aurelien Jarno
2012-09-09 10:25     ` 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=20120909100335.GQ17750@hall.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=agraf@suse.de \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.