qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [4383] Simplify some constant loads
Date: Wed, 07 May 2008 18:04:29 +0000	[thread overview]
Message-ID: <E1Jto0D-00035p-FG@cvs.savannah.gnu.org> (raw)

Revision: 4383
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4383
Author:   blueswir1
Date:     2008-05-07 18:04:29 +0000 (Wed, 07 May 2008)

Log Message:
-----------
Simplify some constant loads

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

Modified: trunk/target-sparc/translate.c
===================================================================
--- trunk/target-sparc/translate.c	2008-05-07 18:03:02 UTC (rev 4382)
+++ trunk/target-sparc/translate.c	2008-05-07 18:04:29 UTC (rev 4383)
@@ -1909,8 +1909,7 @@
             case 0x4:           /* SETHI */
                 if (rd) { // nop
                     uint32_t value = GET_FIELD(insn, 10, 31);
-                    tcg_gen_movi_tl(cpu_dst, value << 10);
-                    gen_movl_TN_reg(rd, cpu_dst);
+                    gen_movl_TN_reg(rd, tcg_const_tl(value << 10));
                 }
                 break;
             case 0x0:           /* UNIMPL */
@@ -2015,8 +2014,7 @@
                     }
                     break;
                 case 0x5: /* V9 rdpc */
-                    tcg_gen_movi_tl(cpu_dst, dc->pc);
-                    gen_movl_TN_reg(rd, cpu_dst);
+                    gen_movl_TN_reg(rd, tcg_const_tl(dc->pc));
                     break;
                 case 0x6: /* V9 rdfprs */
                     tcg_gen_ld_i32(cpu_tmp32, cpu_env, offsetof(CPUSPARCState, fprs));
@@ -2821,27 +2819,29 @@
                     // or %g0, x, y -> mov T0, x; mov y, T0
                     if (IS_IMM) {       /* immediate */
                         rs2 = GET_FIELDs(insn, 19, 31);
-                        tcg_gen_movi_tl(cpu_dst, (int)rs2);
+                        gen_movl_TN_reg(rd, tcg_const_tl((int)rs2));
                     } else {            /* register */
                         rs2 = GET_FIELD(insn, 27, 31);
                         gen_movl_reg_TN(rs2, cpu_dst);
+                        gen_movl_TN_reg(rd, cpu_dst);
                     }
                 } else {
                     cpu_src1 = get_src1(insn, cpu_src1);
                     if (IS_IMM) {       /* immediate */
                         rs2 = GET_FIELDs(insn, 19, 31);
                         tcg_gen_ori_tl(cpu_dst, cpu_src1, (int)rs2);
+                        gen_movl_TN_reg(rd, cpu_dst);
                     } else {            /* register */
                         // or x, %g0, y -> mov T1, x; mov y, T1
                         rs2 = GET_FIELD(insn, 27, 31);
                         if (rs2 != 0) {
                             gen_movl_reg_TN(rs2, cpu_src2);
                             tcg_gen_or_tl(cpu_dst, cpu_src1, cpu_src2);
+                            gen_movl_TN_reg(rd, cpu_dst);
                         } else
-                            tcg_gen_mov_tl(cpu_dst, cpu_src1);
+                            gen_movl_TN_reg(rd, cpu_src1);
                     }
                 }
-                gen_movl_TN_reg(rd, cpu_dst);
 #ifdef TARGET_SPARC64
             } else if (xop == 0x25) { /* sll, V9 sllx */
                 cpu_src1 = get_src1(insn, cpu_src1);
@@ -3405,12 +3405,12 @@
                                               tcg_const_tl(0), l1);
                             if (IS_IMM) {       /* immediate */
                                 rs2 = GET_FIELD_SPs(insn, 0, 10);
-                                tcg_gen_movi_tl(cpu_dst, (int)rs2);
+                                gen_movl_TN_reg(rd, tcg_const_tl((int)rs2));
                             } else {
                                 rs2 = GET_FIELD_SP(insn, 0, 4);
-                                gen_movl_reg_TN(rs2, cpu_dst);
+                                gen_movl_reg_TN(rs2, cpu_tmp0);
+                                gen_movl_TN_reg(rd, cpu_tmp0);
                             }
-                            gen_movl_TN_reg(rd, cpu_dst);
                             gen_set_label(l1);
                             break;
                         }
@@ -3438,12 +3438,12 @@
                                               tcg_const_tl(0), l1);
                             if (IS_IMM) {       /* immediate */
                                 rs2 = GET_FIELD_SPs(insn, 0, 9);
-                                tcg_gen_movi_tl(cpu_dst, (int)rs2);
+                                gen_movl_TN_reg(rd, tcg_const_tl((int)rs2));
                             } else {
                                 rs2 = GET_FIELD_SP(insn, 0, 4);
-                                gen_movl_reg_TN(rs2, cpu_dst);
+                                gen_movl_reg_TN(rs2, cpu_tmp0);
+                                gen_movl_TN_reg(rd, cpu_tmp0);
                             }
-                            gen_movl_TN_reg(rd, cpu_dst);
                             gen_set_label(l1);
                             break;
                         }
@@ -3900,10 +3900,7 @@
                 switch (xop) {
                 case 0x38:      /* jmpl */
                     {
-                        if (rd != 0) {
-                            tcg_gen_movi_tl(cpu_tmp0, dc->pc);
-                            gen_movl_TN_reg(rd, cpu_tmp0);
-                        }
+                        gen_movl_TN_reg(rd, tcg_const_tl(dc->pc));
                         gen_mov_pc_npc(dc, cpu_cond);
                         tcg_gen_helper_0_2(helper_check_align, cpu_dst, tcg_const_i32(3));
                         tcg_gen_mov_tl(cpu_npc, cpu_dst);

                 reply	other threads:[~2008-05-07 18:04 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=E1Jto0D-00035p-FG@cvs.savannah.gnu.org \
    --to=blauwirbel@gmail.com \
    --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).