qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH] tcg-mips: Implement setcond2.
Date: Tue, 9 Feb 2010 12:12:34 -0800	[thread overview]
Message-ID: <20100209214214.7E711C29@are.twiddle.net> (raw)

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/mips/tcg-target.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
index d181ff1..3a53221 100644
--- a/tcg/mips/tcg-target.c
+++ b/tcg/mips/tcg-target.c
@@ -643,6 +643,30 @@ static void tcg_out_setcond(TCGContext *s, int cond, int ret,
     }
 }
 
+static void tcg_out_setcond2(TCGContext *s, int cond, int ret,
+                             int al, int ah, int bl, int bh)
+{
+    switch (cond) {
+    case TCG_COND_EQ:
+        tcg_out_setcond(s, TCG_COND_EQ, TCG_REG_T0, al, bl);
+        tcg_out_setcond(s, TCG_COND_EQ, ret, ah, bh);
+        tcg_out_opc_reg(s, OPC_AND, ret, ret, TCG_REG_T0);
+        break;
+    case TCG_COND_NE:
+        tcg_out_setcond(s, TCG_COND_NE, TCG_REG_T0, al, bl);
+        tcg_out_setcond(s, TCG_COND_NE, ret, ah, bh);
+        tcg_out_opc_reg(s, OPC_OR, ret, ret, TCG_REG_T0);
+        break;
+    default:
+        tcg_out_setcond(s, tcg_unsigned_cond(cond), TCG_REG_T0, al, bl);
+        tcg_out_setcond(s, TCG_COND_EQ, TCG_REG_AT, ah, bh);
+        tcg_out_opc_reg(s, OPC_AND, TCG_REG_T0, TCG_REG_T0, TCG_REG_AT);
+        tcg_out_setcond(s, cond, ret, ah, bh);
+        tcg_out_opc_reg(s, OPC_OR, ret, ret, TCG_REG_T0);
+        break;
+    }
+}
+
 #if defined(CONFIG_SOFTMMU)
 
 #include "../../softmmu_defs.h"
@@ -1218,6 +1242,10 @@ static inline void tcg_out_op(TCGContext *s, int opc,
     case INDEX_op_setcond_i32:
         tcg_out_setcond(s, args[3], args[0], args[1], args[2]);
         break;
+    case INDEX_op_setcond2_i32:
+        tcg_out_setcond2(s, args[5], args[0], args[1], args[2],
+                         args[3], args[4]);
+        break;
 
     case INDEX_op_qemu_ld8u:
         tcg_out_qemu_ld(s, args, 0);
@@ -1297,6 +1325,7 @@ static const TCGTargetOpDef mips_op_defs[] = {
     { INDEX_op_add2_i32, { "r", "r", "rZ", "rZ", "rJZ", "rJZ" } },
     { INDEX_op_sub2_i32, { "r", "r", "rZ", "rZ", "rJZ", "rJZ" } },
     { INDEX_op_brcond2_i32, { "rZ", "rZ", "rZ", "rZ" } },
+    { INDEX_op_setcond2_i32, { "r", "rZ", "rZ", "rZ", "rZ" } },
 
 #if TARGET_LONG_BITS == 32
     { INDEX_op_qemu_ld8u, { "L", "lZ" } },
-- 
1.6.6

                 reply	other threads:[~2010-02-09 21:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20100209214214.7E711C29@are.twiddle.net \
    --to=rth@twiddle.net \
    --cc=aurelien@aurel32.net \
    --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).