Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L6p59-0005xS-E5 for qemu-devel@nongnu.org; Sun, 30 Nov 2008 11:23:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L6p58-0005wZ-Jh for qemu-devel@nongnu.org; Sun, 30 Nov 2008 11:23:38 -0500 Received: from [199.232.76.173] (port=39011 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L6p58-0005wM-Eb for qemu-devel@nongnu.org; Sun, 30 Nov 2008 11:23:38 -0500 Received: from savannah.gnu.org ([199.232.41.3]:48779 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 1L6p58-0006pJ-6l for qemu-devel@nongnu.org; Sun, 30 Nov 2008 11:23:38 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1L6p57-0005v4-7L for qemu-devel@nongnu.org; Sun, 30 Nov 2008 16:23:37 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1L6p56-0005v0-Bc for qemu-devel@nongnu.org; Sun, 30 Nov 2008 16:23:36 +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: Sun, 30 Nov 2008 16:23:36 +0000 Subject: [Qemu-devel] [5823] target-ppc: convert mfrom instruction to TCG 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: 5823 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5823 Author: aurel32 Date: 2008-11-30 16:23:35 +0000 (Sun, 30 Nov 2008) Log Message: ----------- target-ppc: convert mfrom instruction to TCG Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/target-ppc/helper.h trunk/target-ppc/op.c trunk/target-ppc/op_helper.c trunk/target-ppc/translate.c Modified: trunk/target-ppc/helper.h =================================================================== --- trunk/target-ppc/helper.h 2008-11-30 16:23:25 UTC (rev 5822) +++ trunk/target-ppc/helper.h 2008-11-30 16:23:35 UTC (rev 5823) @@ -144,6 +144,8 @@ DEF_HELPER_1(load_6xx_tlbi, void, tl) DEF_HELPER_1(load_74xx_tlbd, void, tl) DEF_HELPER_1(load_74xx_tlbi, void, tl) + +DEF_HELPER_1(602_mfrom, tl, tl) #endif #include "def-helper.h" Modified: trunk/target-ppc/op.c =================================================================== --- trunk/target-ppc/op.c 2008-11-30 16:23:25 UTC (rev 5822) +++ trunk/target-ppc/op.c 2008-11-30 16:23:35 UTC (rev 5823) @@ -684,15 +684,6 @@ } #endif -/* PowerPC 602 specific instruction */ -#if !defined(CONFIG_USER_ONLY) -void OPPROTO op_602_mfrom (void) -{ - do_op_602_mfrom(); - RETURN(); -} -#endif - /* PowerPC 4xx specific micro-ops */ void OPPROTO op_load_dcr (void) { Modified: trunk/target-ppc/op_helper.c =================================================================== --- trunk/target-ppc/op_helper.c 2008-11-30 16:23:25 UTC (rev 5822) +++ trunk/target-ppc/op_helper.c 2008-11-30 16:23:35 UTC (rev 5823) @@ -1645,19 +1645,19 @@ /* mfrom is the most crazy instruction ever seen, imho ! */ /* Real implementation uses a ROM table. Do the same */ #define USE_MFROM_ROM_TABLE -void do_op_602_mfrom (void) +target_ulong helper_602_mfrom (target_ulong arg) { - if (likely(T0 < 602)) { + if (likely(arg < 602)) { #if defined(USE_MFROM_ROM_TABLE) #include "mfrom_table.c" - T0 = mfrom_ROM_table[T0]; + return mfrom_ROM_table[T0]; #else double d; /* Extremly decomposed: - * -T0 / 256 - * T0 = 256 * log10(10 + 1.0) + 0.5 + * -arg / 256 + * return 256 * log10(10 + 1.0) + 0.5 */ - d = T0; + d = arg; d = float64_div(d, 256, &env->fp_status); d = float64_chs(d); d = exp10(d); // XXX: use float emulation function @@ -1665,10 +1665,10 @@ d = log10(d); // XXX: use float emulation function d = float64_mul(d, 256, &env->fp_status); d = float64_add(d, 0.5, &env->fp_status); - T0 = float64_round_to_int(d, &env->fp_status); + return float64_round_to_int(d, &env->fp_status); #endif } else { - T0 = 0; + return 0; } } Modified: trunk/target-ppc/translate.c =================================================================== --- trunk/target-ppc/translate.c 2008-11-30 16:23:25 UTC (rev 5822) +++ trunk/target-ppc/translate.c 2008-11-30 16:23:35 UTC (rev 5823) @@ -4948,9 +4948,7 @@ GEN_EXCP_PRIVOPC(ctx); return; } - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); - gen_op_602_mfrom(); - tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); + gen_helper_602_mfrom(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); #endif }