qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Aurelien Jarno <aurelien@aurel32.net>,
	Richard Henderson <rth@twiddle.net>,
	Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH v4 4/7] target-m68k: move fmove CR to a function
Date: Mon, 12 Jun 2017 01:16:30 +0200	[thread overview]
Message-ID: <20170611231633.32582-5-laurent@vivier.eu> (raw)
In-Reply-To: <20170611231633.32582-1-laurent@vivier.eu>

Move code of fmove to/from control register to a function

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 target/m68k/translate.c | 66 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 41 insertions(+), 25 deletions(-)

diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index 049d837..45733ce 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -4099,6 +4099,45 @@ DISAS_INSN(trap)
     gen_exception(s, s->pc - 2, EXCP_TRAP0 + (insn & 0xf));
 }
 
+static void gen_op_fmove_fcr(CPUM68KState *env, DisasContext *s,
+                             uint32_t insn, uint32_t ext)
+{
+    int mask = (ext >> 10) & 7;
+    int is_write = (ext >> 13) & 1;
+    TCGv val;
+
+    if (is_write) {
+        switch (mask) {
+        case 1: /* FPIAR */
+        case 2: /* FPSR */
+        default:
+            cpu_abort(NULL, "Unimplemented: fmove from control %d", mask);
+            goto undef;
+        case 4: /* FPCR */
+            val = tcg_const_i32(0);
+            DEST_EA(env, insn, OS_LONG, val, NULL);
+            tcg_temp_free(val);
+            break;
+        }
+        return;
+    }
+    switch (mask) {
+    case 1: /* FPIAR */
+    case 2: /* FPSR */
+    default:
+        cpu_abort(NULL, "Unimplemented: fmove to control %d",
+                  mask);
+        break;
+    case 4: /* FPCR */
+        /* Not implemented.  Ignore writes.  */
+        break;
+    }
+    return;
+undef:
+    s->pc -= 2;
+    disas_undef_fpu(env, s, insn);
+}
+
 /* ??? FP exceptions are not implemented.  Most exceptions are deferred until
    immediately before the next FP instruction is executed.  */
 DISAS_INSN(fpu)
@@ -4177,32 +4216,9 @@ DISAS_INSN(fpu)
         tcg_temp_free_i32(tmp32);
         return;
     case 4: /* fmove to control register.  */
-        switch ((ext >> 10) & 7) {
-        case 4: /* FPCR */
-            /* Not implemented.  Ignore writes.  */
-            break;
-        case 1: /* FPIAR */
-        case 2: /* FPSR */
-        default:
-            cpu_abort(NULL, "Unimplemented: fmove to control %d",
-                      (ext >> 10) & 7);
-        }
-        break;
     case 5: /* fmove from control register.  */
-        switch ((ext >> 10) & 7) {
-        case 4: /* FPCR */
-            /* Not implemented.  Always return zero.  */
-            tmp32 = tcg_const_i32(0);
-            break;
-        case 1: /* FPIAR */
-        case 2: /* FPSR */
-        default:
-            cpu_abort(NULL, "Unimplemented: fmove from control %d",
-                      (ext >> 10) & 7);
-            goto undef;
-        }
-        DEST_EA(env, insn, OS_LONG, tmp32, NULL);
-        break;
+        gen_op_fmove_fcr(env, s, insn, ext);
+        return;
     case 6: /* fmovem */
     case 7:
         {
-- 
2.9.4

  parent reply	other threads:[~2017-06-11 23:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-11 23:16 [Qemu-devel] [PATCH v4 0/7] target-m68k: implement 680x0 FPU Laurent Vivier
2017-06-11 23:16 ` [Qemu-devel] [PATCH v4 1/7] softfloat: define 680x0 specific values Laurent Vivier
2017-06-11 23:16 ` [Qemu-devel] [PATCH v4 2/7] target-m68k: move FPU helpers to fpu_helper.c Laurent Vivier
2017-06-11 23:16 ` [Qemu-devel] [PATCH v4 3/7] target-m68k: define ext_opsize Laurent Vivier
2017-06-11 23:16 ` Laurent Vivier [this message]
2017-06-12 16:13   ` [Qemu-devel] [PATCH v4 4/7] target-m68k: move fmove CR to a function Richard Henderson
2017-06-12 17:56     ` Laurent Vivier
2017-06-12 18:37       ` Richard Henderson
2017-06-12 19:12   ` Philippe Mathieu-Daudé
2017-06-11 23:16 ` [Qemu-devel] [PATCH v4 5/7] target-m68k: use floatx80 internally Laurent Vivier
2017-06-13  4:48   ` Thomas Huth
2017-06-19 20:53   ` Richard Henderson
2017-06-19 21:03     ` Laurent Vivier
2017-06-19 21:42       ` Laurent Vivier
2017-06-19 22:04         ` Richard Henderson
2017-06-11 23:16 ` [Qemu-devel] [PATCH v4 6/7] target-m68k: define 96bit FP registers for gdb on 680x0 Laurent Vivier
2017-06-11 23:16 ` [Qemu-devel] [PATCH v4 7/7] target-m68k: add FPCR and FPSR Laurent Vivier
2017-06-19 21:16   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170611231633.32582-5-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).