All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: william lin <wlsaidhi@gmail.com>
Cc: Andreas Grabher <andreas.grabher@cable.vol.at>,
	Thomas Huth <huth@tuxfamily.org>,
	Peter Maydell <peter.maydell@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2 0/5] target/m68k: implement 680x0 FPU (part 3)
Date: Wed, 6 Dec 2017 09:20:45 +0100	[thread overview]
Message-ID: <94157a5d-4173-efaa-10eb-f47106431002@vivier.eu> (raw)
In-Reply-To: <CAGC02hR9tgwb2ZWHgSZGo09zXc+pM-syC-jOAVk=K9k39ExX1g@mail.gmail.com>

Le 05/12/2017 à 22:24, william lin a écrit :
> 
> 
> On Tue, Dec 5, 2017 at 2:01 PM, Laurent Vivier <laurent@vivier.eu
> <mailto:laurent@vivier.eu>> wrote:
> 
>     Le 05/12/2017 à 18:42, Andreas Grabher a écrit :
>     >
>     > Am 05.12.2017 um 10:46 schrieb Laurent Vivier <laurent@vivier.eu <mailto:laurent@vivier.eu>
>     > <mailto:laurent@vivier.eu <mailto:laurent@vivier.eu>>>:
>     >
>     >> Le 05/12/2017 à 09:56, william lin a écrit :
>     >>> On Wed, Nov 29, 2017 at 9:19 AM, Thomas Huth <huth@tuxfamily.org
>     <mailto:huth@tuxfamily.org>
>     >>> <mailto:huth@tuxfamily.org <mailto:huth@tuxfamily.org>>
>     >>> <mailto:huth@tuxfamily.org <mailto:huth@tuxfamily.org>>> 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	other threads:[~2017-12-06  8:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 16:35 [Qemu-devel] [PATCH v2 0/5] target/m68k: implement 680x0 FPU (part 3) Laurent Vivier
2017-11-23 16:35 ` [Qemu-devel] [PATCH v2 1/5] softfloat: add floatx80_mod() Laurent Vivier
2017-11-23 16:35 ` [Qemu-devel] [PATCH v2 2/5] target/m68k: add fmod/frem Laurent Vivier
2017-11-23 16:35 ` [Qemu-devel] [PATCH v2 3/5] softfloat: use floatx80_infinity in softfloat Laurent Vivier
2017-11-23 16:35 ` [Qemu-devel] [PATCH v2 4/5] softfloat: add floatx80_getman(), floatx80_getexp(), floatx80_scale() Laurent Vivier
2017-11-23 16:35 ` [Qemu-devel] [PATCH v2 5/5] target-m68k: add fscale, fgetman and fgetexp Laurent Vivier
2017-11-29 12:49 ` [Qemu-devel] [PATCH v2 0/5] target/m68k: implement 680x0 FPU (part 3) Peter Maydell
2017-11-29 13:42   ` Laurent Vivier
2017-11-29 13:59     ` Peter Maydell
2017-11-29 14:08       ` Thomas Huth
2017-11-29 14:17         ` Laurent Vivier
2017-11-29 15:19           ` Thomas Huth
2017-12-05  8:56             ` william lin
2017-12-05  9:46               ` Laurent Vivier
2017-12-05 17:42                 ` Andreas Grabher
2017-12-05 20:01                   ` Laurent Vivier
2017-12-05 21:24                     ` william lin
2017-12-06  8:20                       ` Laurent Vivier [this message]
2017-12-06 10:24 ` Alex Bennée
2017-12-15  8:29   ` william lin
2017-12-20 18:25 ` Laurent Vivier
2017-12-29  8:21   ` Thomas Huth

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=94157a5d-4173-efaa-10eb-f47106431002@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=andreas.grabher@cable.vol.at \
    --cc=aurelien@aurel32.net \
    --cc=huth@tuxfamily.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=wlsaidhi@gmail.com \
    /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.