qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] temporary-floating-point: Use "0 - val" for the neg


From: Chen Gang
Subject: [Qemu-devel] [PATCH] temporary-floating-point: Use "0 - val" for the negtive value
Date: Sat, 17 Oct 2015 21:46:10 +0800

>From 5bfae9eaa7c6757c83b1b3d958dd24988394fb03 Mon Sep 17 00:00:00 2001
From: Chen Gang <address@hidden>
Date: Sat, 17 Oct 2015 21:39:25 +0800
Subject: [PATCH] temporary-floating-point: Use "0 - val" for the negtive value

It is a bug, original implementation is incorrect.

Signed-off-by: Chen Gang <address@hidden>
---
 target-tilegx/fpu_helper.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/target-tilegx/fpu_helper.c b/target-tilegx/fpu_helper.c
index 095085d..4aafda4 100644
--- a/target-tilegx/fpu_helper.c
+++ b/target-tilegx/fpu_helper.c
@@ -23,7 +23,6 @@
 #include "exec/helper-proto.h"
 #include "fpu/softfloat.h"
 
-#define SIGNBIT32 0x80000000
 #define FP_STATUS (fpu->fp_status)
 
 static void fdouble_ana(FPUTLGState *fpu,
@@ -129,8 +128,7 @@ uint64_t helper_fdouble_pack1(CPUTLGState *env,
     case 0x21b00:
         return float64_val(uint32_to_float64(rsrc>> 4, &FP_STATUS));
     case 0x121b00:
-        return float64_val(int32_to_float64((rsrc>> 4) | SIGNBIT32,
-                                            &FP_STATUS));
+        return float64_val(int32_to_float64(0 - (rsrc>> 4), &FP_STATUS));
     default:
         qemu_log_mask(LOG_UNIMP, "\nUIMP: in %s.\n", __FUNCTION__);
         helper_exception(env, TILEGX_EXCP_OPCODE_UNIMPLEMENTED);
@@ -217,7 +215,7 @@ uint64_t helper_fsingle_pack2(CPUTLGState *env, uint64_t 
rsrc)
     case 0x9e:
         return float32_val(uint32_to_float32(ctx.data, &FP_STATUS));
     case 0x49e:
-        return float32_val(int32_to_float32(ctx.data | SIGNBIT32, &FP_STATUS));
+        return float32_val(int32_to_float32(0 - ctx.data, &FP_STATUS));
     default:
         qemu_log_mask(LOG_UNIMP, "\nUIMP: in %s.\n", __FUNCTION__);
         helper_exception(env, TILEGX_EXCP_OPCODE_UNIMPLEMENTED);
-- 
1.9.3

                                          

Attachment: 0001-temporary-floating-point-Use-0-val-for-the-negtive-v.patch
Description: Binary data


reply via email to

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