qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [Qemu-devel] How to add my implementation of the fmadds i


From: Eric Blake
Subject: Re: [Qemu-ppc] [Qemu-devel] How to add my implementation of the fmadds instruction to QEMU
Date: Tue, 27 Sep 2016 11:16:40 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

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: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]