From patchwork Fri Mar 26 16:06:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 48676 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 B41E3B7CE7 for ; Sat, 27 Mar 2010 04:16:57 +1100 (EST) Received: from localhost ([127.0.0.1]:33190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvD9M-0002cr-RV for incoming@patchwork.ozlabs.org; Fri, 26 Mar 2010 13:16:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvC5X-0004A0-7H for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:08:47 -0400 Received: from [140.186.70.92] (port=41650 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvC5G-0003e7-BS for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:08:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvC4J-0006z3-RJ for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:08:22 -0400 Received: from afflict.kos.to ([92.243.29.197]:33623) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvC4F-0006t9-Q4 for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:07:29 -0400 Received: by afflict.kos.to (Postfix, from userid 1000) id C953226595; Fri, 26 Mar 2010 16:07:24 +0000 (UTC) From: Riku Voipio To: qemu-devel@nongnu.org Date: Fri, 26 Mar 2010 16:06:58 +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 38/48] target-arm: fix neon vrshl 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 | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c index ec1964f..0df13f5 100644 --- a/target-arm/neon_helper.c +++ b/target-arm/neon_helper.c @@ -547,20 +547,33 @@ uint64_t HELPER(neon_rshl_s64)(uint64_t valop, uint64_t shiftop) }} while (0) NEON_VOP(rshl_u8, neon_u8, 4) NEON_VOP(rshl_u16, neon_u16, 2) -NEON_VOP(rshl_u32, neon_u32, 1) #undef NEON_FN +uint32_t HELPER(neon_rshl_u32)(uint32_t val, uint32_t shiftop) +{ + int8_t shift = (int8_t)shiftop; + if (shift >= 32 || shift < -32) { + val = 0; + } else if (shift == -32) { + val >>= shift - 1; + } else if (shift < 0) { + val = ((uint64_t)val + (1 << (-1 - shift))) >> -shift; + } else { + val <<= shift; + } + return val; +} + uint64_t HELPER(neon_rshl_u64)(uint64_t val, uint64_t shiftop) { int8_t shift = (uint8_t)shiftop; - if (shift >= 64 || shift < 64) { + if (shift >= 64 || shift < -64) { val = 0; } else if (shift == -64) { /* Rounding a 1-bit result just preserves that bit. */ val >>= 63; } if (shift < 0) { val = (val + ((uint64_t)1 << (-1 - shift))) >> -shift; - val >>= -shift; } else { val <<= shift; }