From patchwork Fri Mar 26 16:07:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 48684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A132DB7C98 for ; Sat, 27 Mar 2010 04:39:57 +1100 (EST) Received: from localhost ([127.0.0.1]:34384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvDTw-0000Rp-Qd for incoming@patchwork.ozlabs.org; Fri, 26 Mar 2010 13:38:04 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvC5d-0004DY-1I for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:08:53 -0400 Received: from [140.186.70.92] (port=41643 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvC5W-0003f0-FL for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:08:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvC4J-0006yy-SG for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:08:13 -0400 Received: from afflict.kos.to ([92.243.29.197]:33624) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvC4F-0006tA-Pt for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:07:29 -0400 Received: by afflict.kos.to (Postfix, from userid 1000) id 2637D265D2; Fri, 26 Mar 2010 16:07:25 +0000 (UTC) From: Riku Voipio To: qemu-devel@nongnu.org Date: Fri, 26 Mar 2010 16:07:02 +0000 Message-Id: <7d5786fe88c6fb3555cb4c24846d7cfae97994ae.1269617187.git.riku.voipio@nokia.com> X-Mailer: git-send-email 1.6.5 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Riku Voipio , =?UTF-8?q?Juha=20Riihim=C3=A4ki?= Subject: [Qemu-devel] [PATCH 42/48] target-arm: fix signed narrow 64->32 operation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Juha Riihimäki Signed-Off-By: Riku Voipio Signed-off-by: Juha Riihimäki --- target-arm/neon_helper.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c index 4604698..910f84a 100644 --- a/target-arm/neon_helper.c +++ b/target-arm/neon_helper.c @@ -1183,9 +1183,13 @@ uint32_t HELPER(neon_narrow_sat_u32)(CPUState *env, uint64_t x) uint32_t HELPER(neon_narrow_sat_s32)(CPUState *env, uint64_t x) { - if ((int64_t)x != (int32_t)x) { + if ((int64_t)x < -2147483648ll) { SET_QC(); - return (x >> 63) ^ 0x7fffffff; + return 0x80000000; + } + if ((int64_t)x > 2147483647ll) { + SET_QC(); + return 0x7fffffff; } return x; }