From patchwork Fri Mar 26 16:06:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 48693 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 82F73B7CB9 for ; Sat, 27 Mar 2010 05:31:58 +1100 (EST) Received: from localhost ([127.0.0.1]:37594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvDv1-0008ML-FL for incoming@patchwork.ozlabs.org; Fri, 26 Mar 2010 14:06:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvC5v-0004Qw-5p for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:09:11 -0400 Received: from [140.186.70.92] (port=41638 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvC5X-0003e5-TD for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:09:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvC4I-0006xz-TV for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:08:07 -0400 Received: from afflict.kos.to ([92.243.29.197]:33629) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvC4F-0006tM-QA for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:07:29 -0400 Received: by afflict.kos.to (Postfix, from userid 1000) id C4B45265CC; Fri, 26 Mar 2010 16:07:24 +0000 (UTC) From: Riku Voipio To: qemu-devel@nongnu.org Date: Fri, 26 Mar 2010 16:06:57 +0000 Message-Id: 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 37/48] 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: Juha Riihimäki Signed-Off-By: Riku Voipio Signed-off-by: Juha Riihimäki --- 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 7985293..ec1964f 100644 --- a/target-arm/neon_helper.c +++ b/target-arm/neon_helper.c @@ -727,9 +727,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; @@ -755,7 +770,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) @@ -771,7 +786,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();