qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu
Subject: [Qemu-devel] [PATCH 4/4] target-m68k: Use gen_ea_mode in cmpm
Date: Tue,  1 Nov 2016 15:29:47 -0600	[thread overview]
Message-ID: <1478035787-16893-5-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1478035787-16893-1-git-send-email-rth@twiddle.net>

The writeback infrastructure takes care of ensuring that Ax == Ay
both uses the updated register value from Ay for Ax, and updating
the final register result twice.

??? Maybe squash into previous.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-m68k/translate.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 85cdba5..aefd90c 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -2227,26 +2227,14 @@ DISAS_INSN(cmpa)
 DISAS_INSN(cmpm)
 {
     int opsize = insn_opsize(insn);
-    TCGv tmp = tcg_temp_new();
-    TCGv src, dst, addr;
-
-    src = gen_load(s, opsize, AREG(insn, 0), 1);
-    /* delay the update after the second gen_load() */
-    tcg_gen_addi_i32(tmp, AREG(insn, 0), opsize_bytes(opsize));
-
-    /* but if the we use the same address register to
-     * read the second value, we must use the updated address
-     */
-    if (REG(insn, 0) == REG(insn, 9)) {
-        addr = tmp;
-    } else {
-        addr = AREG(insn, 9);
-    }
-
-    dst = gen_load(s, opsize, addr, 1);
-    tcg_gen_mov_i32(AREG(insn, 0), tmp);
-    tcg_gen_addi_i32(AREG(insn, 9), addr, opsize_bytes(opsize));
-    tcg_temp_free(tmp);
+    TCGv src, dst;
+
+    /* Post-increment load (mode 3) from Ay.  */
+    src = gen_ea_mode(env, s, 3, REG(insn, 0), opsize,
+                      NULL_QREG, NULL, EA_LOADS);
+    /* Post-increment load (mode 3) from Ax.  */
+    dst = gen_ea_mode(env, s, 3, REG(insn, 9), opsize,
+                      NULL_QREG, NULL, EA_LOADS);
 
     gen_update_cc_cmp(s, dst, src, opsize);
 }
-- 
2.7.4

  parent reply	other threads:[~2016-11-01 21:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 21:29 [Qemu-devel] [PATCH 0/4] target-m68k areg writeback Richard Henderson
2016-11-01 21:29 ` [Qemu-devel] [PATCH 1/4] target-m68k: Delay autoinc writeback Richard Henderson
2016-11-01 21:29 ` [Qemu-devel] [PATCH 2/4] target-m68k: Split gen_lea and gen_ea Richard Henderson
2016-11-01 21:29 ` [Qemu-devel] [PATCH 3/4] target-m68k: add cmpm Richard Henderson
2016-11-01 21:29 ` Richard Henderson [this message]
2016-11-02 13:04   ` [Qemu-devel] [PATCH 4/4] target-m68k: Use gen_ea_mode in cmpm Laurent Vivier
2016-11-02 12:07 ` [Qemu-devel] [PATCH 0/4] target-m68k areg writeback Laurent Vivier
2016-11-02 15:25   ` Richard Henderson
2016-11-02 15:32     ` Laurent Vivier

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=1478035787-16893-5-git-send-email-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    /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).