From patchwork Sat Oct 17 13:46:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 531785 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 391C214029E for ; Sun, 18 Oct 2015 00:46:37 +1100 (AEDT) Received: from localhost ([::1]:58378 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnRog-00059F-QR for incoming@patchwork.ozlabs.org; Sat, 17 Oct 2015 09:46:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnRoP-0004sp-5v for qemu-devel@nongnu.org; Sat, 17 Oct 2015 09:46:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZnRoK-0005ub-5H for qemu-devel@nongnu.org; Sat, 17 Oct 2015 09:46:17 -0400 Received: from col004-omc2s14.hotmail.com ([65.55.34.88]:58945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnRoJ-0005uX-TK for qemu-devel@nongnu.org; Sat, 17 Oct 2015 09:46:12 -0400 Received: from COL130-W54 ([65.55.34.72]) by COL004-OMC2S14.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Sat, 17 Oct 2015 06:46:10 -0700 X-TMN: [+IJfHifiO29x2QoyHLWNqIwj0Hdir/wq] X-Originating-Email: [xili_gchen_5257@hotmail.com] Message-ID: From: Chen Gang To: "rth@twiddle.net" , Peter Maydell , Chris Metcalf Date: Sat, 17 Oct 2015 21:46:10 +0800 Importance: Normal MIME-Version: 1.0 X-OriginalArrivalTime: 17 Oct 2015 13:46:10.0670 (UTC) FILETIME=[2E8738E0:01D108E2] X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 65.55.34.88 Cc: qemu-devel Subject: [Qemu-devel] [PATCH] temporary-floating-point: Use "0 - val" for the negtive value X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From 5bfae9eaa7c6757c83b1b3d958dd24988394fb03 Mon Sep 17 00:00:00 2001 From: Chen Gang 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 ---  target-tilegx/fpu_helper.c | 6 ++----  1 file changed, 2 insertions(+), 4 deletions(-) --  1.9.3 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);