Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lgll6-0004ql-2D for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:07:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lgll2-0004k9-Dx for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:07:29 -0400 Received: from [199.232.76.173] (port=35981 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lgll1-0004ix-Pi for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:07:27 -0400 Received: from mx20.gnu.org ([199.232.41.8]:2558) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lgll0-0006ov-UZ for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:07:27 -0400 Received: from savannah.gnu.org ([199.232.41.3] helo=sv.gnu.org) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LgkZT-0002Mj-Ba for qemu-devel@nongnu.org; Mon, 09 Mar 2009 14:51:27 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LgkYU-0000wK-QW for qemu-devel@nongnu.org; Mon, 09 Mar 2009 18:50:26 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LgkYT-0000w8-13 for qemu-devel@nongnu.org; Mon, 09 Mar 2009 18:50:26 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Mon, 09 Mar 2009 18:50:25 +0000 Subject: [Qemu-devel] [6793] targe-ppc: optimize mfcr and mtcrf 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: 6793 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6793 Author: aurel32 Date: 2009-03-09 18:50:24 +0000 (Mon, 09 Mar 2009) Log Message: ----------- targe-ppc: optimize mfcr and mtcrf Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/target-ppc/helper.h trunk/target-ppc/op_helper.c trunk/target-ppc/translate.c Modified: trunk/target-ppc/helper.h =================================================================== --- trunk/target-ppc/helper.h 2009-03-09 18:08:56 UTC (rev 6792) +++ trunk/target-ppc/helper.h 2009-03-09 18:50:24 UTC (rev 6793) @@ -30,9 +30,6 @@ DEF_HELPER_1(icbi, void, tl) DEF_HELPER_4(lscbx, tl, tl, i32, i32, i32) -DEF_HELPER_0(load_cr, tl) -DEF_HELPER_2(store_cr, void, tl, i32) - #if defined(TARGET_PPC64) DEF_HELPER_2(mulhd, i64, i64, i64) DEF_HELPER_2(mulhdu, i64, i64, i64) Modified: trunk/target-ppc/op_helper.c =================================================================== --- trunk/target-ppc/op_helper.c 2009-03-09 18:08:56 UTC (rev 6792) +++ trunk/target-ppc/op_helper.c 2009-03-09 18:50:24 UTC (rev 6793) @@ -54,30 +54,6 @@ } /*****************************************************************************/ -/* Registers load and stores */ -target_ulong helper_load_cr (void) -{ - return (env->crf[0] << 28) | - (env->crf[1] << 24) | - (env->crf[2] << 20) | - (env->crf[3] << 16) | - (env->crf[4] << 12) | - (env->crf[5] << 8) | - (env->crf[6] << 4) | - (env->crf[7] << 0); -} - -void helper_store_cr (target_ulong val, uint32_t mask) -{ - int i, sh; - - for (i = 0, sh = 7; i < 8; i++, sh--) { - if (mask & (1 << sh)) - env->crf[i] = (val >> (sh * 4)) & 0xFUL; - } -} - -/*****************************************************************************/ /* SPR accesses */ void helper_load_dump_spr (uint32_t sprn) { Modified: trunk/target-ppc/translate.c =================================================================== --- trunk/target-ppc/translate.c 2009-03-09 18:08:56 UTC (rev 6792) +++ trunk/target-ppc/translate.c 2009-03-09 18:50:24 UTC (rev 6793) @@ -3859,7 +3859,24 @@ cpu_gpr[rD(ctx->opcode)], crn * 4); } } else { - gen_helper_load_cr(cpu_gpr[rD(ctx->opcode)]); + TCGv_i32 t0 = tcg_temp_new_i32(); + tcg_gen_mov_i32(t0, cpu_crf[0]); + tcg_gen_shli_i32(t0, t0, 4); + tcg_gen_or_i32(t0, t0, cpu_crf[1]); + tcg_gen_shli_i32(t0, t0, 4); + tcg_gen_or_i32(t0, t0, cpu_crf[2]); + tcg_gen_shli_i32(t0, t0, 4); + tcg_gen_or_i32(t0, t0, cpu_crf[3]); + tcg_gen_shli_i32(t0, t0, 4); + tcg_gen_or_i32(t0, t0, cpu_crf[4]); + tcg_gen_shli_i32(t0, t0, 4); + tcg_gen_or_i32(t0, t0, cpu_crf[5]); + tcg_gen_shli_i32(t0, t0, 4); + tcg_gen_or_i32(t0, t0, cpu_crf[6]); + tcg_gen_shli_i32(t0, t0, 4); + tcg_gen_or_i32(t0, t0, cpu_crf[7]); + tcg_gen_extu_i32_tl(cpu_gpr[rD(ctx->opcode)], t0); + tcg_temp_free_i32(t0); } } @@ -3956,8 +3973,14 @@ tcg_temp_free_i32(temp); } } else { - TCGv_i32 temp = tcg_const_i32(crm); - gen_helper_store_cr(cpu_gpr[rS(ctx->opcode)], temp); + TCGv_i32 temp = tcg_temp_new_i32(); + tcg_gen_trunc_tl_i32(temp, cpu_gpr[rS(ctx->opcode)]); + for (crn = 0 ; crn < 8 ; crn++) { + if (crm & (1 << crn)) { + tcg_gen_shri_i32(cpu_crf[7 - crn], temp, crn * 4); + tcg_gen_andi_i32(cpu_crf[7 - crn], cpu_crf[7 - crn], 0xf); + } + } tcg_temp_free_i32(temp); } }