qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 0/5] target/m68k: implement 680x0 FPU (part 3


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH v2 0/5] target/m68k: implement 680x0 FPU (part 3)
Date: Wed, 6 Dec 2017 09:20:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Le 05/12/2017 à 22:24, william lin a écrit :
> 
> 
> On Tue, Dec 5, 2017 at 2:01 PM, Laurent Vivier <address@hidden
> <mailto:address@hidden>> wrote:
> 
>     Le 05/12/2017 à 18:42, Andreas Grabher a écrit :
>     >
>     > Am 05.12.2017 um 10:46 schrieb Laurent Vivier <address@hidden 
> <mailto:address@hidden>
>     > <mailto:address@hidden <mailto:address@hidden>>>:
>     >
>     >> Le 05/12/2017 à 09:56, william lin a écrit :
>     >>> On Wed, Nov 29, 2017 at 9:19 AM, Thomas Huth <address@hidden
>     <mailto:address@hidden>
>     >>> <mailto:address@hidden <mailto:address@hidden>>
>     >>> <mailto:address@hidden <mailto:address@hidden>>> wrote:
>     >>>
>     >>>    On 29.11.2017 15:17, Laurent Vivier wrote:
...
>     >>>
>     >>> So we can't use these C code directly as it uses helpers from 2b.
>     >>> However, would it be 
>     >>> ok to write our own set of C code along with the necessary
>     helpers using
>     >>> the C and asm 
>     >>> code as reference? (would be part of 2a)
>     >>
>     >> I've ported all the functions written by Andreas to QEMU/softfloat 2a
>     >> and it doesn't need any helpers from 2b.
>     >>
>     >> What we need to know is what is the license of his code and if it has
>     >> been written based on the NetBSD code (BSD license) or from the
>     libFPSP
>     >> (proprietary code) [but I think the code is the same...]
>     >>
>     >> Thanks,
>     >> Laurent
> 
> 
> The functions we are looking for in particular are the transcendental
> and trig functions
> for floatx80. (sin, cos, twotox, etc..)
> 
> For some context:
> We need and implementation of those  functions for x86 as it currently
> converts floatx80 to
> double before calling into glibc and then converting back to floatx80.
> This results 
> in inaccuracies for calculations that use x87 instructions for
> intermediate operations.
> (https://bugs.launchpad.net/qemu/+bug/645662)
> 
> 
> I searched through the archive and found your code for this patch:
> 
> https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg03766.html
> 
> ...
> 
> +void HELPER(sincos_FP0_FP1)(CPUM68KState *env)
> +{
> +    floatx80 res;
> +    long double val, valsin, valcos;
> +
> +    val = floatx80_to_ldouble(FP0_to_floatx80(env));
> +
> +    sincosl(val, &valsin, &valcos);
> +    res = ldouble_to_floatx80(valsin);
> +    floatx80_to_FP0(env, res);
> +    res = ldouble_to_floatx80(valcos);
> +    floatx80_to_FP1(env, res);
> +}
> 
> ...
> 
> In relation to the bug, this implementation would provide more accurate 
> results, but not be consistent with actual x87 hardware.
> 
> If these are not the code you are referring to, then can you please
> point to us the 
> correct ones?

The code ported from "previous" to QEMU can be found here:

https://github.com/vivier/qemu-m68k/blob/m68k-dev/fpu/softfloat.c#L7422

but it needs some more polishing.

Thanks,
Laurent



reply via email to

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