From patchwork Fri Feb 11 15:11:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 82804 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 DAA16B7178 for ; Sat, 12 Feb 2011 04:37:20 +1100 (EST) Received: from localhost ([127.0.0.1]:48499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnujT-0002Km-1t for incoming@patchwork.ozlabs.org; Fri, 11 Feb 2011 10:16:27 -0500 Received: from [140.186.70.92] (port=54066 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnueY-0008Ry-Hd for qemu-devel@nongnu.org; Fri, 11 Feb 2011 10:11:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnueR-0003dB-KF for qemu-devel@nongnu.org; Fri, 11 Feb 2011 10:11:22 -0500 Received: from eu1sys200aog102.obsmtp.com ([207.126.144.113]:37479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnueR-0003cm-6s for qemu-devel@nongnu.org; Fri, 11 Feb 2011 10:11:15 -0500 Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKTVVRkmgxvZsg2b65cvtuE1nG5r7yvfq+@postini.com; Fri, 11 Feb 2011 15:11:15 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 49970173 for ; Fri, 11 Feb 2011 15:11:14 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas5.st.com [10.75.90.71]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 34D9C4D11 for ; Fri, 11 Feb 2011 15:11:14 +0000 (GMT) Received: from localhost.localdomain (164.129.122.40) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.2.234.1; Fri, 11 Feb 2011 16:11:13 +0100 From: To: Date: Fri, 11 Feb 2011 16:11:00 +0100 Message-ID: <1297437062-6118-5-git-send-email-christophe.lyon@st.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1297437062-6118-1-git-send-email-christophe.lyon@st.com> References: <1297437062-6118-1-git-send-email-christophe.lyon@st.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 207.126.144.113 Subject: [Qemu-devel] [PATCH 4/6] target-arm: fix saturated values for Neon right shifts. 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: Christophe Lyon Fix value returned by signed qrshl helpers (8, 16 and 32 bits). Signed-off-by: Christophe Lyon --- 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 907f7b7..83d610a 100644 --- a/target-arm/neon_helper.c +++ b/target-arm/neon_helper.c @@ -903,7 +903,7 @@ uint64_t HELPER(neon_qrshl_u64)(CPUState *env, uint64_t val, uint64_t shiftop) dest = src1 << tmp; \ if ((dest >> tmp) != src1) { \ SET_QC(); \ - dest = src1 >> 31; \ + dest = (uint32_t)(1 << (sizeof(src1) * 8 - 1)) - (src1 > 0 ? 1 : 0); \ } \ }} while (0) NEON_VOP_ENV(qrshl_s8, neon_s8, 4) @@ -924,7 +924,11 @@ uint32_t HELPER(neon_qrshl_s32)(CPUState *env, uint32_t valop, uint32_t shiftop) dest = val << shift; if ((dest >> shift) != val) { SET_QC(); - dest = (uint32_t)(1 << (sizeof(val) * 8 - 1)) - (val > 0 ? 1 : 0); + if (val < 0) { + dest = INT32_MIN; + } else { + dest = INT32_MAX; + } } } return dest;