From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LeNrV-0001aa-Ks for qemu-devel@nongnu.org; Tue, 03 Mar 2009 01:12:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LeNrU-0001Zx-UE for qemu-devel@nongnu.org; Tue, 03 Mar 2009 01:12:17 -0500 Received: from [199.232.76.173] (port=39195 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LeNrU-0001Zk-OX for qemu-devel@nongnu.org; Tue, 03 Mar 2009 01:12:16 -0500 Received: from savannah.gnu.org ([199.232.41.3]:46768 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 1LeNrU-0004yc-HT for qemu-devel@nongnu.org; Tue, 03 Mar 2009 01:12:16 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LeNrT-0004bh-Vn for qemu-devel@nongnu.org; Tue, 03 Mar 2009 06:12:16 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LeNrT-0004aD-63 for qemu-devel@nongnu.org; Tue, 03 Mar 2009 06:12:15 +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: Tue, 03 Mar 2009 06:12:15 +0000 Subject: [Qemu-devel] [6669] target-ppc: improve mfcr/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: 6669 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6669 Author: aurel32 Date: 2009-03-03 06:12:14 +0000 (Tue, 03 Mar 2009) Log Message: ----------- target-ppc: improve mfcr/mtcrf - use ctz32 instead of ffs - 1 - small optimisation of mtcrf - add the name of both opcodes Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/target-ppc/translate.c trunk/target-ppc/translate_init.c Modified: trunk/target-ppc/translate.c =================================================================== --- trunk/target-ppc/translate.c 2009-03-03 06:12:03 UTC (rev 6668) +++ trunk/target-ppc/translate.c 2009-03-03 06:12:14 UTC (rev 6669) @@ -28,6 +28,7 @@ #include "disas.h" #include "tcg-op.h" #include "qemu-common.h" +#include "host-utils.h" #include "helper.h" #define GEN_HELPER 1 @@ -3836,7 +3837,7 @@ tcg_gen_andi_tl(cpu_xer, cpu_xer, ~(1 << XER_SO | 1 << XER_OV | 1 << XER_CA)); } -/* mfcr */ +/* mfcr mfocrf */ GEN_HANDLER(mfcr, 0x1F, 0x13, 0x00, 0x00000801, PPC_MISC) { uint32_t crm, crn; @@ -3844,7 +3845,7 @@ if (likely(ctx->opcode & 0x00100000)) { crm = CRM(ctx->opcode); if (likely(crm && ((crm & (crm - 1)) == 0))) { - crn = ffs (crm) - 1; + crn = ctz32 (crm); tcg_gen_extu_i32_tl(cpu_gpr[rD(ctx->opcode)], cpu_crf[7 - crn]); tcg_gen_shli_i32(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rD(ctx->opcode)], crn * 4); @@ -3931,7 +3932,7 @@ gen_op_mfspr(ctx); } -/* mtcrf */ +/* mtcrf mtocrf*/ GEN_HANDLER(mtcrf, 0x1F, 0x10, 0x04, 0x00000801, PPC_MISC) { uint32_t crm, crn; @@ -3940,10 +3941,10 @@ if (likely((ctx->opcode & 0x00100000))) { if (crm && ((crm & (crm - 1)) == 0)) { TCGv_i32 temp = tcg_temp_new_i32(); - crn = ffs (crm) - 1; + crn = ctz32 (crm); tcg_gen_trunc_tl_i32(temp, cpu_gpr[rS(ctx->opcode)]); - 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_gen_shri_i32(temp, temp, crn * 4); + tcg_gen_andi_i32(cpu_crf[7 - crn], temp, 0xf); tcg_temp_free_i32(temp); } } else { Modified: trunk/target-ppc/translate_init.c =================================================================== --- trunk/target-ppc/translate_init.c 2009-03-03 06:12:03 UTC (rev 6668) +++ trunk/target-ppc/translate_init.c 2009-03-03 06:12:14 UTC (rev 6669) @@ -24,7 +24,6 @@ */ #include "dis-asm.h" -#include "host-utils.h" #include "gdbstub.h" //#define PPC_DUMP_CPU