qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6309] sh4: Add FMAC instruction support
@ 2009-01-14 21:03 Aurelien Jarno
  0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2009-01-14 21:03 UTC (permalink / raw)
  To: qemu-devel

Revision: 6309
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6309
Author:   aurel32
Date:     2009-01-14 21:02:59 +0000 (Wed, 14 Jan 2009)

Log Message:
-----------
sh4: Add FMAC instruction support

Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Modified Paths:
--------------
    trunk/target-sh4/helper.h
    trunk/target-sh4/op_helper.c
    trunk/target-sh4/translate.c

Modified: trunk/target-sh4/helper.h
===================================================================
--- trunk/target-sh4/helper.h	2009-01-14 19:40:54 UTC (rev 6308)
+++ trunk/target-sh4/helper.h	2009-01-14 21:02:59 UTC (rev 6309)
@@ -35,6 +35,7 @@
 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)

Modified: trunk/target-sh4/op_helper.c
===================================================================
--- trunk/target-sh4/op_helper.c	2009-01-14 19:40:54 UTC (rev 6308)
+++ trunk/target-sh4/op_helper.c	2009-01-14 21:02:59 UTC (rev 6309)
@@ -531,6 +531,17 @@
     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;

Modified: trunk/target-sh4/translate.c
===================================================================
--- trunk/target-sh4/translate.c	2009-01-14 19:40:54 UTC (rev 6308)
+++ trunk/target-sh4/translate.c	2009-01-14 21:02:59 UTC (rev 6309)
@@ -1176,6 +1176,17 @@
 	    }
 	}
 	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) {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-14 21:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14 21:03 [Qemu-devel] [6309] sh4: Add FMAC instruction support Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).