Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LMU75-0006aG-Vj for qemu-devel@nongnu.org; Mon, 12 Jan 2009 16:14:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LMU72-0006Vt-Cu for qemu-devel@nongnu.org; Mon, 12 Jan 2009 16:14:23 -0500 Received: from [199.232.76.173] (port=60247 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMU72-0006Vc-51 for qemu-devel@nongnu.org; Mon, 12 Jan 2009 16:14:20 -0500 Received: from soufre.accelance.net ([213.162.48.15]:50634) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LMU71-0008ST-Ib for qemu-devel@nongnu.org; Mon, 12 Jan 2009 16:14:19 -0500 Received: from [192.168.0.3] (potipota.net [88.168.176.51]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id CEE874501A for ; Mon, 12 Jan 2009 22:14:15 +0100 (CET) From: Lionel Landwerlin Content-Type: text/plain Date: Mon, 12 Jan 2009 22:14:14 +0100 Message-Id: <1231794854.3905.1.camel@cocoduo.atr> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] sh4: Add FMAC instruction support Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org sh4: Add FMAC instruction support Signed-off-by: Laurent Desnogues Signed-off-by: Lionel Landwerlin --- target-sh4/helper.h | 1 + target-sh4/op_helper.c | 11 +++++++++++ target-sh4/translate.c | 11 +++++++++++ 3 files changed, 23 insertions(+), 0 deletions(-) diff --git a/target-sh4/helper.h b/target-sh4/helper.h index 631e7e1..e665185 100644 --- a/target-sh4/helper.h +++ b/target-sh4/helper.h @@ -35,6 +35,7 @@ DEF_HELPER_2(fdiv_FT, i32, i32, i32) DEF_HELPER_2(fdiv_DT, i64, i64, i64) DEF_HELPER_1(float_FT, i32, i32) DEF_HELPER_1(float_DT, i64, i32) +DEF_HELPER_3(fmac_FT, i32, i32, i32, i32) DEF_HELPER_2(fmul_FT, i32, i32, i32) DEF_HELPER_2(fmul_DT, i64, i64, i64) DEF_HELPER_1(fneg_T, i32, i32) diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c index 6352219..ead14e3 100644 --- a/target-sh4/op_helper.c +++ b/target-sh4/op_helper.c @@ -531,6 +531,17 @@ uint64_t helper_float_DT(uint32_t t0) return d.ll; } +uint32_t helper_fmac_FT(uint32_t t0, uint32_t t1, uint32_t t2) +{ + CPU_FloatU f0, f1, f2; + f0.l = t0; + f1.l = t1; + f2.l = t2; + f0.f = float32_mul(f0.f, f1.f, &env->fp_status); + f0.f = float32_add(f0.f, f2.f, &env->fp_status); + return f0.l; +} + uint32_t helper_fmul_FT(uint32_t t0, uint32_t t1) { CPU_FloatU f0, f1; diff --git a/target-sh4/translate.c b/target-sh4/translate.c index 73134f0..bce7463 100644 --- a/target-sh4/translate.c +++ b/target-sh4/translate.c @@ -1176,6 +1176,17 @@ static void _decode_opc(DisasContext * ctx) } } return; + case 0xf00e: /* fmac FR0,RM,Rn */ + { + CHECK_FPU_ENABLED + if (ctx->fpscr & FPSCR_PR) { + break; /* illegal instruction */ + } else { + gen_helper_fmac_FT(cpu_fregs[FREG(B11_8)], + cpu_fregs[FREG(0)], cpu_fregs[FREG(B7_4)], cpu_fregs[FREG(B11_8)]); + return; + } + } } switch (ctx->opcode & 0xff00) { -- 1.5.6.5