From patchwork Fri Jan 28 15:51:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 80863 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 CE858B7110 for ; Sat, 29 Jan 2011 02:59:08 +1100 (EST) Received: from localhost ([127.0.0.1]:53882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Piqj3-0000mV-VC for incoming@patchwork.ozlabs.org; Fri, 28 Jan 2011 10:59:06 -0500 Received: from [140.186.70.92] (port=48450 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiqbU-0005Oj-C5 for qemu-devel@nongnu.org; Fri, 28 Jan 2011 10:51:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiqbR-000102-PG for qemu-devel@nongnu.org; Fri, 28 Jan 2011 10:51:16 -0500 Received: from eu1sys200aog102.obsmtp.com ([207.126.144.113]:46826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiqbR-0000zS-HX for qemu-devel@nongnu.org; Fri, 28 Jan 2011 10:51:13 -0500 Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKTULl8FTsWRYvgDpA4GBT/jNUAREm1ro7@postini.com; Fri, 28 Jan 2011 15:51:13 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 1887A1FB for ; Fri, 28 Jan 2011 15:51:12 +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 06E8E2B0B for ; Fri, 28 Jan 2011 15:51:12 +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, 28 Jan 2011 16:51:11 +0100 From: To: Date: Fri, 28 Jan 2011 16:51:03 +0100 Message-ID: <1296229866-32011-6-git-send-email-christophe.lyon@st.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1296229866-32011-1-git-send-email-christophe.lyon@st.com> References: <1296229866-32011-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 5/8] target-arm: fix neon vqrshl instruction 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 Signed-off-by: Juha Riihimäki Signed-off-by: Christophe Lyon --- target-arm/neon_helper.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c index 71e3c74..3337c52 100644 --- a/target-arm/neon_helper.c +++ b/target-arm/neon_helper.c @@ -825,9 +825,24 @@ uint64_t HELPER(neon_qshlu_s64)(CPUState *env, uint64_t valop, uint64_t shiftop) }} while (0) NEON_VOP_ENV(qrshl_u8, neon_u8, 4) NEON_VOP_ENV(qrshl_u16, neon_u16, 2) -NEON_VOP_ENV(qrshl_u32, neon_u32, 1) #undef NEON_FN +uint32_t HELPER(neon_qrshl_u32)(CPUState *env, uint32_t val, uint32_t shiftop) +{ + int8_t shift = (int8_t)shiftop; + if (shift < 0) { + val = ((uint64_t)val + (1 << (-1 - shift))) >> -shift; + } else { + uint32_t tmp = val; + val <<= shift; + if ((val >> shift) != tmp) { + SET_QC(); + val = ~0; + } + } + return val; +} + uint64_t HELPER(neon_qrshl_u64)(CPUState *env, uint64_t val, uint64_t shiftop) { int8_t shift = (int8_t)shiftop; @@ -853,7 +868,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) @@ -869,7 +884,7 @@ uint64_t HELPER(neon_qrshl_s64)(CPUState *env, uint64_t valop, uint64_t shiftop) if (shift < 0) { val = (val + (1 << (-1 - shift))) >> -shift; } else { - int64_t tmp = val;; + int64_t tmp = val; val <<= shift; if ((val >> shift) != tmp) { SET_QC();