From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jto0G-0004EH-Bf for qemu-devel@nongnu.org; Wed, 07 May 2008 14:04:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jto0F-0004Dj-Kk for qemu-devel@nongnu.org; Wed, 07 May 2008 14:04:31 -0400 Received: from [199.232.76.173] (port=43561 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jto0F-0004DZ-EC for qemu-devel@nongnu.org; Wed, 07 May 2008 14:04:31 -0400 Received: from savannah.gnu.org ([199.232.41.3] helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jto0E-0006Ak-QM for qemu-devel@nongnu.org; Wed, 07 May 2008 14:04:30 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1Jto0D-00035t-Tj for qemu-devel@nongnu.org; Wed, 07 May 2008 18:04:30 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1Jto0D-00035p-FG for qemu-devel@nongnu.org; Wed, 07 May 2008 18:04:29 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Wed, 07 May 2008 18:04:29 +0000 Subject: [Qemu-devel] [4383] Simplify some constant loads Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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);