From patchwork Tue Jan 11 21:01:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 78436 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 35E8FB70A3 for ; Wed, 12 Jan 2011 08:14:10 +1100 (EST) Received: from localhost ([127.0.0.1]:51175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PclXW-00074Y-S1 for incoming@patchwork.ozlabs.org; Tue, 11 Jan 2011 16:14:03 -0500 Received: from [140.186.70.92] (port=34845 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PclMq-0000XP-MH for qemu-devel@nongnu.org; Tue, 11 Jan 2011 16:04:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PclLd-0001Mp-N6 for qemu-devel@nongnu.org; Tue, 11 Jan 2011 16:02:53 -0500 Received: from hall.aurel32.net ([88.191.126.93]:47321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PclLd-0001Lq-IA for qemu-devel@nongnu.org; Tue, 11 Jan 2011 16:01:45 -0500 Received: from [2001:470:d4ed:0:5e26:aff:fe2b:6f5b] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1PclLc-0001no-Rv; Tue, 11 Jan 2011 22:01:44 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.72) (envelope-from ) id 1PclLd-0004fH-FH; Tue, 11 Jan 2011 22:01:45 +0100 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Tue, 11 Jan 2011 22:01:37 +0100 Message-Id: <1294779698-17694-9-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1294779698-17694-1-git-send-email-aurelien@aurel32.net> References: <1294779698-17694-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Aurelien Jarno Subject: [Qemu-devel] [PATCH 8/9] target-sh4: add fipr 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 Add the fipr FVm,FVn instruction, which computes the inner products of a 4-dimensional single precision floating-point vector. Signed-off-by: Aurelien Jarno --- target-sh4/helper.h | 1 + target-sh4/op_helper.c | 20 ++++++++++++++++++++ target-sh4/translate.c | 12 ++++++++++++ 3 files changed, 33 insertions(+), 0 deletions(-) diff --git a/target-sh4/helper.h b/target-sh4/helper.h index e4f6230..74d839f 100644 --- a/target-sh4/helper.h +++ b/target-sh4/helper.h @@ -48,5 +48,6 @@ DEF_HELPER_1(fsqrt_FT, i32, i32) DEF_HELPER_1(fsqrt_DT, i64, i64) DEF_HELPER_1(ftrc_FT, i32, i32) DEF_HELPER_1(ftrc_DT, i32, i64) +DEF_HELPER_2(fipr, void, i32, i32) #include "def-helper.h" diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c index 6ab87d9..d7df3fe 100644 --- a/target-sh4/op_helper.c +++ b/target-sh4/op_helper.c @@ -767,3 +767,23 @@ uint32_t helper_ftrc_DT(uint64_t t0) update_fpscr(GETPC()); return ret; } + +void helper_fipr(uint32_t m, uint32_t n) +{ + int bank, i; + float32 r, p; + + bank = (env->sr & FPSCR_FR) ? 16 : 0; + r = float32_zero; + set_float_exception_flags(0, &env->fp_status); + + for (i = 0 ; i < 4 ; i++) { + p = float32_mul(env->fregs[bank + m + i], + env->fregs[bank + n + i], + &env->fp_status); + r = float32_add(r, p, &env->fp_status); + } + update_fpscr(GETPC()); + + env->fregs[bank + n + 3] = r; +} diff --git a/target-sh4/translate.c b/target-sh4/translate.c index 080ff6e..566ce23 100644 --- a/target-sh4/translate.c +++ b/target-sh4/translate.c @@ -1869,6 +1869,18 @@ static void _decode_opc(DisasContext * ctx) tcg_temp_free_i64(fp); } return; + case 0xf0ed: /* fipr FVm,FVn */ + CHECK_FPU_ENABLED + if ((ctx->fpscr & FPSCR_PR) == 0) { + TCGv m, n; + m = tcg_const_i32((ctx->opcode >> 16) & 3); + n = tcg_const_i32((ctx->opcode >> 18) & 3); + gen_helper_fipr(m, n); + tcg_temp_free(m); + tcg_temp_free(n); + return; + } + break; } #if 0 fprintf(stderr, "unknown instruction 0x%04x at pc 0x%08x\n",