From patchwork Fri Mar 26 16:07:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 48690 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 44321B7C59 for ; Sat, 27 Mar 2010 04:51:33 +1100 (EST) Received: from localhost ([127.0.0.1]:46962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvDeK-0003e4-9e for incoming@patchwork.ozlabs.org; Fri, 26 Mar 2010 13:48:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvC5m-0004Js-A6 for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:09:02 -0400 Received: from [140.186.70.92] (port=41676 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvC5Z-0003fW-8S for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:09:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvC4I-0006xm-RK for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:08:04 -0400 Received: from afflict.kos.to ([92.243.29.197]:33642) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvC4F-0006ub-Pm for qemu-devel@nongnu.org; Fri, 26 Mar 2010 12:07:29 -0400 Received: by afflict.kos.to (Postfix, from userid 1000) id 51434265D4; Fri, 26 Mar 2010 16:07:25 +0000 (UTC) From: Riku Voipio To: qemu-devel@nongnu.org Date: Fri, 26 Mar 2010 16:07:04 +0000 Message-Id: <912247d64af6b6f7aba2cb3b7d57acee33dc6106.1269617187.git.riku.voipio@nokia.com> 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 44/48] target-arm: fix neon v(q)(r)shrn instructions 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 | 23 +++++++++++++++++++++-- target-arm/translate.c | 19 ++++++++++++++----- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c index 6464317..7cef783 100644 --- a/target-arm/neon_helper.c +++ b/target-arm/neon_helper.c @@ -509,9 +509,28 @@ uint64_t HELPER(neon_shl_s64)(uint64_t valop, uint64_t shiftop) }} while (0) NEON_VOP(rshl_s8, neon_s8, 4) NEON_VOP(rshl_s16, neon_s16, 2) -NEON_VOP(rshl_s32, neon_s32, 1) #undef NEON_FN +uint32_t HELPER(neon_rshl_s32)(uint32_t valop, uint32_t shiftop) +{ + int8_t shift =(int8_t)shiftop; + int32_t val = valop; + if (shift >= 32) { + val = 0; + } else if (shift < -32) { + val >>= 31; + } else if (shift == -32) { + val >>= 31; + val++; + val >>= 1; + } else if (shift < 0) { + val = ((int64_t)val + (1 << (-1 - shift))) >> -shift; + } else { + val <<= shift; + } + return val; +} + uint64_t HELPER(neon_rshl_s64)(uint64_t valop, uint64_t shiftop) { int8_t shift = (int8_t)shiftop; @@ -520,7 +539,7 @@ uint64_t HELPER(neon_rshl_s64)(uint64_t valop, uint64_t shiftop) val = 0; } else if (shift < -64) { val >>= 63; - } else if (shift == -63) { + } else if (shift == -64) { val >>= 63; val++; val >>= 1; diff --git a/target-arm/translate.c b/target-arm/translate.c index de2ea92..92c8a1a 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -4781,6 +4781,7 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn) abort(); } + TCGV_UNUSED(tmp5); for (pass = 0; pass < 2; pass++) { if (size == 3) { neon_load_reg64(cpu_V0, rm + pass); @@ -4812,18 +4813,26 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn) dead_tmp(tmp); dead_tmp(tmp3); } - tmp = new_tmp(); + tmp4 = new_tmp(); if (op == 8) { if (u) { /* VQSHRUN / VQRSHRUN */ - gen_neon_unarrow_sats(size - 1, tmp, cpu_V0); + gen_neon_unarrow_sats(size - 1, tmp4, cpu_V0); } else { /* VSHRN / VRSHRN */ - gen_neon_narrow(size - 1, tmp, cpu_V0); + gen_neon_narrow(size - 1, tmp4, cpu_V0); } } else { /* VQSHRN / VQRSHRN */ - gen_neon_narrow_satu(size - 1, tmp, cpu_V0); + if (u) { + gen_neon_narrow_satu(size - 1, tmp4, cpu_V0); + } else { + gen_neon_narrow_sats(size - 1, tmp4, cpu_V0); + } + } + if (!pass) { + tmp5 = tmp4; } - neon_store_reg(rd, pass, tmp); } /* for pass */ + neon_store_reg(rd, 0, tmp5); + neon_store_reg(rd, 1, tmp4); if (size == 3) { tcg_temp_free_i64(tmp64); } else {