From patchwork Tue Feb 15 13:44:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 83249 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 56B05B70D0 for ; Wed, 16 Feb 2011 00:46:36 +1100 (EST) Received: from localhost ([127.0.0.1]:47794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpLEf-0005rc-Fv for incoming@patchwork.ozlabs.org; Tue, 15 Feb 2011 08:46:33 -0500 Received: from [140.186.70.92] (port=41099 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpLDH-0005pr-Gr for qemu-devel@nongnu.org; Tue, 15 Feb 2011 08:45:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PpLDE-0005NS-2i for qemu-devel@nongnu.org; Tue, 15 Feb 2011 08:45:07 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:56889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PpLDD-0005J7-Gn for qemu-devel@nongnu.org; Tue, 15 Feb 2011 08:45:03 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1PpLD0-0001OS-Fo; Tue, 15 Feb 2011 13:44:50 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 15 Feb 2011 13:44:45 +0000 Message-Id: <1297777490-5323-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1297777490-5323-1-git-send-email-peter.maydell@linaro.org> References: <1297777490-5323-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: Christophe Lyon , patches@linaro.org Subject: [Qemu-devel] [PATCH 05/10] 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 Fix value returned by signed 8 and 16 bit qrshl helpers when the result has saturated. Signed-off-by: Peter Maydell --- target-arm/neon_helper.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c index a8885fa..7859f0b 100644 --- a/target-arm/neon_helper.c +++ b/target-arm/neon_helper.c @@ -886,7 +886,10 @@ 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)); \ + if (src1 > 0) { \ + dest--; \ + } \ } \ }} while (0) NEON_VOP_ENV(qrshl_s8, neon_s8, 4)