Patchwork [v2,11/20] target-i386: fix helper_fbld_ST0() wrt softfloat

login
register
mail settings
Submitter Aurelien Jarno
Date April 20, 2011, 10:12 a.m.
Message ID <1303294329-22634-12-git-send-email-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/92138/
State New
Headers show

Comments

Aurelien Jarno - April 20, 2011, 10:12 a.m.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 target-i386/op_helper.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

v1 -> v2: fix handling of -0
Peter Maydell - April 20, 2011, 10:41 a.m.
On 20 April 2011 11:12, Aurelien Jarno <aurelien@aurel32.net> wrote:
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
>  target-i386/op_helper.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
>
> v1 -> v2: fix handling of -0

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM

Patch

diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index f614893..22cb549 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -3920,9 +3920,10 @@  void helper_fbld_ST0(target_ulong ptr)
         v = ldub(ptr + i);
         val = (val * 100) + ((v >> 4) * 10) + (v & 0xf);
     }
-    tmp = val;
-    if (ldub(ptr + 9) & 0x80)
-        tmp = -tmp;
+    tmp = int64_to_floatx(val, &env->fp_status);
+    if (ldub(ptr + 9) & 0x80) {
+        floatx_chs(tmp);
+    }
     fpush();
     ST0 = tmp;
 }