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] [5152] alpha: convert a few more instructions to TCG
Date: Thu, 04 Sep 2008 04:36:20 +0000	[thread overview]
Message-ID: <E1Kb6Zw-0007TC-DW@cvs.savannah.gnu.org> (raw)

Revision: 5152
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5152
Author:   aurel32
Date:     2008-09-04 04:36:20 +0000 (Thu, 04 Sep 2008)

Log Message:
-----------
alpha: convert a few more instructions to TCG

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

Modified Paths:
--------------
    trunk/target-alpha/op.c
    trunk/target-alpha/translate.c

Modified: trunk/target-alpha/op.c
===================================================================
--- trunk/target-alpha/op.c	2008-09-04 04:36:00 UTC (rev 5151)
+++ trunk/target-alpha/op.c	2008-09-04 04:36:20 UTC (rev 5152)
@@ -148,13 +148,6 @@
 #include "op_mem.h"
 #endif
 
-/* Special operation for load and store */
-void OPPROTO op_n7 (void)
-{
-    T0 &= ~(uint64_t)0x7;
-    RETURN();
-}
-
 /* Misc */
 void OPPROTO op_excp (void)
 {
@@ -259,18 +252,6 @@
     RETURN();
 }
 
-void OPPROTO op_s4 (void)
-{
-    T0 <<= 2;
-    RETURN();
-}
-
-void OPPROTO op_s8 (void)
-{
-    T0 <<= 3;
-    RETURN();
-}
-
 void OPPROTO op_mull (void)
 {
     T0 = (int64_t)((int32_t)T0 * (int32_t)T1);
@@ -646,19 +627,6 @@
     RETURN();
 }
 
-/* Branches */
-void OPPROTO op_branch (void)
-{
-    env->pc = T0 & ~3;
-    RETURN();
-}
-
-void OPPROTO op_addq1 (void)
-{
-    T1 += T0;
-    RETURN();
-}
-
 #if 0 // Qemu does not know how to do this...
 void OPPROTO op_bcond (void)
 {

Modified: trunk/target-alpha/translate.c
===================================================================
--- trunk/target-alpha/translate.c	2008-09-04 04:36:00 UTC (rev 5151)
+++ trunk/target-alpha/translate.c	2008-09-04 04:36:20 UTC (rev 5152)
@@ -273,15 +273,11 @@
         gen_op_nop();
     } else {
         if (rb != 31)
-            tcg_gen_mov_i64(cpu_T[0], cpu_ir[rb]);
+            tcg_gen_addi_i64(cpu_T[0], cpu_ir[rb], disp16);
         else
-            tcg_gen_movi_i64(cpu_T[0], 0);
-        if (disp16 != 0) {
-            tcg_gen_movi_i64(cpu_T[1], disp16);
-            gen_op_addq();
-        }
+            tcg_gen_movi_i64(cpu_T[0], disp16);
         if (clear)
-            gen_op_n7();
+            tcg_gen_andi_i64(cpu_T[0], cpu_T[0], ~0x7);
         (*gen_load_op)(ctx);
         if (ra != 31)
             tcg_gen_mov_i64(cpu_ir[ra], cpu_T[1]);
@@ -294,15 +290,11 @@
                                          int clear)
 {
     if (rb != 31)
-        tcg_gen_mov_i64(cpu_T[0], cpu_ir[rb]);
+        tcg_gen_addi_i64(cpu_T[0], cpu_ir[rb], disp16);
     else
-        tcg_gen_movi_i64(cpu_T[0], 0);
-    if (disp16 != 0) {
-        tcg_gen_movi_i64(cpu_T[1], disp16);
-        gen_op_addq();
-    }
+        tcg_gen_movi_i64(cpu_T[0], disp16);
     if (clear)
-        gen_op_n7();
+        tcg_gen_andi_i64(cpu_T[0], cpu_T[0], ~0x7);
     if (ra != 31)
         tcg_gen_mov_i64(cpu_T[1], cpu_ir[ra]);
     else
@@ -315,13 +307,9 @@
                                          int ra, int rb, int32_t disp16)
 {
     if (rb != 31)
-        tcg_gen_mov_i64(cpu_T[0], cpu_ir[rb]);
+        tcg_gen_addi_i64(cpu_T[0], cpu_ir[rb], disp16);
     else
-        tcg_gen_movi_i64(cpu_T[0], 0);
-    if (disp16 != 0) {
-        tcg_gen_movi_i64(cpu_T[1], disp16);
-        gen_op_addq();
-    }
+        tcg_gen_movi_i64(cpu_T[0], disp16);
     (*gen_load_fop)(ctx);
     gen_store_fir(ctx, ra, 1);
 }
@@ -331,13 +319,9 @@
                                           int ra, int rb, int32_t disp16)
 {
     if (rb != 31)
-        tcg_gen_mov_i64(cpu_T[0], cpu_ir[rb]);
+        tcg_gen_addi_i64(cpu_T[0], cpu_ir[rb], disp16);
     else
-        tcg_gen_movi_i64(cpu_T[0], 0);
-    if (disp16 != 0) {
-        tcg_gen_movi_i64(cpu_T[1], disp16);
-        gen_op_addq();
-    }
+        tcg_gen_movi_i64(cpu_T[0], disp16);
     gen_load_fir(ctx, ra, 1);
     (*gen_store_fop)(ctx);
 }
@@ -346,13 +330,7 @@
                                      void (*gen_test_op)(void),
                                      int ra, int32_t disp16)
 {
-    if (disp16 != 0) {
-        tcg_gen_movi_i64(cpu_T[0], ctx->pc);
-        tcg_gen_movi_i64(cpu_T[1], disp16 << 2);
-        gen_op_addq1();
-    } else {
-        tcg_gen_movi_i64(cpu_T[1], ctx->pc);
-    }
+    tcg_gen_movi_i64(cpu_T[1], ctx->pc + (int64_t)(disp16 << 2));
     if (ra != 31)
         tcg_gen_mov_i64(cpu_T[0], cpu_ir[ra]);
     else
@@ -365,13 +343,7 @@
                                       void (*gen_test_op)(void),
                                       int ra, int32_t disp16)
 {
-    if (disp16 != 0) {
-        tcg_gen_movi_i64(cpu_T[0], ctx->pc);
-        tcg_gen_movi_i64(cpu_T[1], disp16 << 2);
-        gen_op_addq1();
-    } else {
-        tcg_gen_movi_i64(cpu_T[1], ctx->pc);
-    }
+    tcg_gen_movi_i64(cpu_T[1], ctx->pc + (int64_t)(disp16 << 2));
     gen_load_fir(ctx, ra, 0);
     (*gen_test_op)();
     _gen_op_bcond(ctx);
@@ -484,50 +456,50 @@
 
 static always_inline void gen_s4addl (void)
 {
-    gen_op_s4();
+    tcg_gen_shli_i64(cpu_T[0], cpu_T[0], 2);
     gen_op_addl();
 }
 
 static always_inline void gen_s4subl (void)
 {
-    gen_op_s4();
+    tcg_gen_shli_i64(cpu_T[0], cpu_T[0], 2);
     gen_op_subl();
 }
 
 static always_inline void gen_s8addl (void)
 {
-    gen_op_s8();
+    tcg_gen_shli_i64(cpu_T[0], cpu_T[0], 3);
     gen_op_addl();
 }
 
 static always_inline void gen_s8subl (void)
 {
-    gen_op_s8();
+    tcg_gen_shli_i64(cpu_T[0], cpu_T[0], 3);
     gen_op_subl();
 }
 
 static always_inline void gen_s4addq (void)
 {
-    gen_op_s4();
-    gen_op_addq();
+    tcg_gen_shli_i64(cpu_T[0], cpu_T[0], 2);
+    tcg_gen_add_i64(cpu_T[0], cpu_T[0], cpu_T[1]);
 }
 
 static always_inline void gen_s4subq (void)
 {
-    gen_op_s4();
-    gen_op_subq();
+    tcg_gen_shli_i64(cpu_T[0], cpu_T[0], 2);
+    tcg_gen_sub_i64(cpu_T[0], cpu_T[0], cpu_T[1]);
 }
 
 static always_inline void gen_s8addq (void)
 {
-    gen_op_s8();
-    gen_op_addq();
+    tcg_gen_shli_i64(cpu_T[0], cpu_T[0], 3);
+    tcg_gen_add_i64(cpu_T[0], cpu_T[0], cpu_T[1]);
 }
 
 static always_inline void gen_s8subq (void)
 {
-    gen_op_s8();
-    gen_op_subq();
+    tcg_gen_shli_i64(cpu_T[0], cpu_T[0], 3);
+    tcg_gen_sub_i64(cpu_T[0], cpu_T[0], cpu_T[1]);
 }
 
 static always_inline void gen_amask (void)
@@ -1383,7 +1355,7 @@
         else
             tcg_gen_movi_i64(cpu_T[0], 0);
         tcg_gen_movi_i64(cpu_T[1], disp12);
-        gen_op_addq();
+        tcg_gen_add_i64(cpu_T[0], cpu_T[0], cpu_T[1]);
         switch ((insn >> 12) & 0xF) {
         case 0x0:
             /* Longword physical access */
@@ -1638,7 +1610,7 @@
             else
                 tcg_gen_movi_i64(cpu_T[0], 0);
             tcg_gen_movi_i64(cpu_T[1], (((int64_t)insn << 51) >> 51));
-            gen_op_addq();
+            tcg_gen_add_i64(cpu_T[0], cpu_T[0], cpu_T[1]);
             gen_op_hw_ret();
         }
         ret = 2;
@@ -1652,11 +1624,9 @@
         if (!ctx->pal_mode)
             goto invalid_opc;
         if (ra != 31)
-            tcg_gen_mov_i64(cpu_T[0], cpu_ir[rb]);
+            tcg_gen_addi_i64(cpu_T[0], cpu_ir[rb], disp12);
         else
-            tcg_gen_movi_i64(cpu_T[0], 0);
-        tcg_gen_movi_i64(cpu_T[1], disp12);
-        gen_op_addq();
+            tcg_gen_movi_i64(cpu_T[0], disp12);
         if (ra != 31)
             tcg_gen_mov_i64(cpu_T[1], cpu_ir[ra]);
         else

                 reply	other threads:[~2008-09-04  4:36 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=E1Kb6Zw-0007TC-DW@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).