qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: G 3 <programmingkidx@gmail.com>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: "list@suse.de:PowerPC list:PowerPC" <qemu-ppc@nongnu.org>,
	qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] How to add my implementation of the fmadds instruction to QEMU
Date: Tue, 27 Sep 2016 11:16:40 -0500	[thread overview]
Message-ID: <7e2274fa-f649-887c-c78e-7f5b09749450@redhat.com> (raw)
In-Reply-To: <F705365A-5746-44BA-B820-33A4A993EDDD@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1222 bytes --]

On 09/27/2016 09:33 AM, G 3 wrote:
>>> void fmadds(float *frD, float frA, float frC, float frB)
>>> {
>>>         *frD = frA * frC + frB;
>>> }

> 
> It sounds like I should change my argument types to double.

Insufficient.  The whole reason that fmadds exists is that there are
provably cases where two operations that both round are GUARANTEED to
get the wrong answer when compared to a single operation, regardless of
the precisions involved.  Widening from float to double does NOT
eliminate the double-rounding problem.

> 
> I still want to try implementing this function. I'm thinking rewriting the
> helper_fmadd() function in target-ppc/fpu_helper.c. Does that
> sound correct?

I seriously doubt you would be able to write a correct implementation,
if you aren't even aware of the double-rounding reasons why fmadds was
added to the IEEE floating point specification in the first place.  Your
idea that you would be able to speed things up is probably a premature
optimization, given that you have no realistic clue how hard it is to
CORRECTLY implement fused-multiply-add.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  parent reply	other threads:[~2016-09-27 16:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27  1:05 [Qemu-devel] How to add my implementation of the fmadds instruction to QEMU G 3
2016-09-27  3:41 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-27 11:43 ` [Qemu-devel] " Peter Maydell
2016-09-27 14:33   ` G 3
2016-09-27 15:21     ` Peter Maydell
2016-09-27 16:16     ` Eric Blake [this message]
2016-09-27 16:51       ` G 3
2016-09-27 16:58         ` Peter Maydell
2016-09-29  4:17           ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-29 15:20             ` Programmingkid
2016-09-29 18:19               ` Alex Bennée
2016-09-29 21:52                 ` Programmingkid
2016-09-29 22:36                   ` Alex Bennée
2016-09-29 22:39                     ` Programmingkid
2016-09-29 15:41             ` Peter Maydell
2016-09-29 16:55               ` Programmingkid
2016-09-30  0:39                 ` David Gibson
2016-09-30  0:44                   ` Programmingkid

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=7e2274fa-f649-887c-c78e-7f5b09749450@redhat.com \
    --to=eblake@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).