[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 15/16] target-m68k: add more FPU instructions
From: |
Andreas Schwab |
Subject: |
Re: [Qemu-devel] [PATCH v3 15/16] target-m68k: add more FPU instructions |
Date: |
Thu, 16 Feb 2017 11:18:52 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
On Feb 16 2017, Richard Henderson <address@hidden> wrote:
> On 02/07/2017 11:59 AM, Laurent Vivier wrote:
>> +static long double floatx80_to_ldouble(floatx80 val)
>> +{
>> + if (floatx80_is_infinity(val)) {
>> + if (floatx80_is_neg(val)) {
>> + return -__builtin_infl();
>> + }
>> + return __builtin_infl();
>> + }
>> + if (floatx80_is_any_nan(val)) {
>> + char low[20];
>> + sprintf(low, "0x%016"PRIx64, val.low);
>> +
>> + return nanl(low);
>> + }
>> +
>> + return *(long double *)&val;
>> +}
>
> This doesn't work except for x86 host.
Not even then.
> You ought to extract the mantissa, convert the 64-bit value to
> long-double, and use ldexpl to scale the result for the exponent.
>
> Similarly converting the other way use frexpl and ldexpl.
There is no guarantee that the host long double has the same range and
precision as floatx80.
Andreas.
--
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
- Re: [Qemu-devel] [PATCH v3 09/16] target-m68k: add fmovem, (continued)
- [Qemu-devel] [PATCH v3 11/16] target-m68k: add fmovecr, Laurent Vivier, 2017/02/06
- [Qemu-devel] [PATCH v3 12/16] target-m68k: add fscale, fgetman, fgetexp and fmod, Laurent Vivier, 2017/02/06
- [Qemu-devel] [PATCH v3 05/16] target-m68k: use floatx80 internally, Laurent Vivier, 2017/02/06
- [Qemu-devel] [PATCH v3 16/16] target-m68k: add fsincos, Laurent Vivier, 2017/02/06
- [Qemu-devel] [PATCH v3 15/16] target-m68k: add more FPU instructions, Laurent Vivier, 2017/02/06
[Qemu-devel] [PATCH v3 13/16] target-m68k: add fsglmul and fsgldiv, Laurent Vivier, 2017/02/06
[Qemu-devel] [PATCH v3 14/16] target-m68k: add explicit single and double precision operations, Laurent Vivier, 2017/02/06
[Qemu-devel] [PATCH v3 07/16] target-m68k: manage FPU exceptions, Laurent Vivier, 2017/02/06
[Qemu-devel] [PATCH v3 10/16] target-m68k: add fscc., Laurent Vivier, 2017/02/06