qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6937] target-mips: optimize gen_trap()
Date: Sun, 29 Mar 2009 01:19:03 +0000	[thread overview]
Message-ID: <E1Lnjfy-00085r-Vh@cvs.savannah.gnu.org> (raw)

Revision: 6937
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6937
Author:   aurel32
Date:     2009-03-29 01:19:02 +0000 (Sun, 29 Mar 2009)
Log Message:
-----------
target-mips: optimize gen_trap()

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Modified Paths:
--------------
    trunk/target-mips/translate.c

Modified: trunk/target-mips/translate.c
===================================================================
--- trunk/target-mips/translate.c	2009-03-29 01:18:52 UTC (rev 6936)
+++ trunk/target-mips/translate.c	2009-03-29 01:19:02 UTC (rev 6937)
@@ -2166,7 +2166,7 @@
                       int rs, int rt, int16_t imm)
 {
     int cond;
-    TCGv t0 = tcg_temp_local_new();
+    TCGv t0 = tcg_temp_new();
     TCGv t1 = tcg_temp_new();
 
     cond = 0;
@@ -2208,7 +2208,7 @@
         case OPC_TGEU:  /* rs >= rs unsigned */
         case OPC_TGEIU: /* r0 >= 0  unsigned */
             /* Always trap */
-            tcg_gen_movi_tl(t0, 1);
+            generate_exception(ctx, EXCP_TRAP);
             break;
         case OPC_TLT:   /* rs < rs           */
         case OPC_TLTI:  /* r0 < 0            */
@@ -2217,54 +2217,40 @@
         case OPC_TNE:   /* rs != rs          */
         case OPC_TNEI:  /* r0 != 0           */
             /* Never trap: treat as NOP. */
-            goto out;
-        default:
-            MIPS_INVAL("trap");
-            generate_exception(ctx, EXCP_RI);
-            goto out;
+            break;
         }
     } else {
+        int l1 = gen_new_label();
+
         switch (opc) {
         case OPC_TEQ:
         case OPC_TEQI:
-            gen_op_eq(t0, t0, t1);
+            tcg_gen_brcond_tl(TCG_COND_NE, t0, t1, l1);
             break;
         case OPC_TGE:
         case OPC_TGEI:
-            gen_op_ge(t0, t0, t1);
+            tcg_gen_brcond_tl(TCG_COND_LT, t0, t1, l1);
             break;
         case OPC_TGEU:
         case OPC_TGEIU:
-            gen_op_geu(t0, t0, t1);
+            tcg_gen_brcond_tl(TCG_COND_LTU, t0, t1, l1);
             break;
         case OPC_TLT:
         case OPC_TLTI:
-            gen_op_lt(t0, t0, t1);
+            tcg_gen_brcond_tl(TCG_COND_GE, t0, t1, l1);
             break;
         case OPC_TLTU:
         case OPC_TLTIU:
-            gen_op_ltu(t0, t0, t1);
+            tcg_gen_brcond_tl(TCG_COND_GEU, t0, t1, l1);
             break;
         case OPC_TNE:
         case OPC_TNEI:
-            gen_op_ne(t0, t0, t1);
+            tcg_gen_brcond_tl(TCG_COND_EQ, t0, t1, l1);
             break;
-        default:
-            MIPS_INVAL("trap");
-            generate_exception(ctx, EXCP_RI);
-            goto out;
         }
-    }
-    save_cpu_state(ctx, 1);
-    {
-        int l1 = gen_new_label();
-
-        tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1);
-        gen_helper_0i(raise_exception, EXCP_TRAP);
+        generate_exception(ctx, EXCP_TRAP);
         gen_set_label(l1);
     }
-    ctx->bstate = BS_STOP;
- out:
     tcg_temp_free(t0);
     tcg_temp_free(t1);
 }

                 reply	other threads:[~2009-03-29  1:19 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=E1Lnjfy-00085r-Vh@cvs.savannah.gnu.org \
    --to=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).