qemu-devel
[Top][All Lists]
Advanced

[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: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v3 15/16] target-m68k: add more FPU instructions
Date: Thu, 16 Feb 2017 12:46:35 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

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.

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.


r~



reply via email to

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