From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L4duY-0008Q2-Oq for qemu-devel@nongnu.org; Mon, 24 Nov 2008 11:03:43 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L4duX-0008Ou-Dl for qemu-devel@nongnu.org; Mon, 24 Nov 2008 11:03:41 -0500 Received: from [199.232.76.173] (port=46021 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4dlK-0002Xo-Hk for qemu-devel@nongnu.org; Mon, 24 Nov 2008 10:54:10 -0500 Received: from savannah.gnu.org ([199.232.41.3]:38942 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 1L4ZdF-0002Fi-M6 for qemu-devel@nongnu.org; Mon, 24 Nov 2008 06:29:33 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1L4Zc3-00065p-VW for qemu-devel@nongnu.org; Mon, 24 Nov 2008 11:28:20 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1L4Zc3-00065l-Jr for qemu-devel@nongnu.org; Mon, 24 Nov 2008 11:28:19 +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, 24 Nov 2008 11:28:19 +0000 Subject: [Qemu-devel] [5788] target-ppc: convert trap instructions 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: 5788 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5788 Author: aurel32 Date: 2008-11-24 11:28:19 +0000 (Mon, 24 Nov 2008) Log Message: ----------- target-ppc: convert trap instructions 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/op_helper.h trunk/target-ppc/translate.c Modified: trunk/target-ppc/helper.h =================================================================== --- trunk/target-ppc/helper.h 2008-11-24 08:47:21 UTC (rev 5787) +++ trunk/target-ppc/helper.h 2008-11-24 11:28:19 UTC (rev 5788) @@ -2,6 +2,10 @@ DEF_HELPER_2(raise_exception_err, void, i32, i32) DEF_HELPER_0(raise_debug, void) +DEF_HELPER_3(tw, void, tl, tl, i32) +#if defined(TARGET_PPC64) +DEF_HELPER_3(td, void, tl, tl, i32) +#endif DEF_HELPER_2(fcmpo, i32, i64, i64) DEF_HELPER_2(fcmpu, i32, i64, i64) Modified: trunk/target-ppc/op.c =================================================================== --- trunk/target-ppc/op.c 2008-11-24 08:47:21 UTC (rev 5787) +++ trunk/target-ppc/op.c 2008-11-24 11:28:19 UTC (rev 5788) @@ -334,21 +334,6 @@ } #endif -/* Trap word */ -void OPPROTO op_tw (void) -{ - do_tw(PARAM1); - RETURN(); -} - -#if defined(TARGET_PPC64) -void OPPROTO op_td (void) -{ - do_td(PARAM1); - RETURN(); -} -#endif - #if !defined(CONFIG_USER_ONLY) /* tlbia */ void OPPROTO op_tlbia (void) Modified: trunk/target-ppc/op_helper.c =================================================================== --- trunk/target-ppc/op_helper.c 2008-11-24 08:47:21 UTC (rev 5787) +++ trunk/target-ppc/op_helper.c 2008-11-24 11:28:19 UTC (rev 5788) @@ -1424,25 +1424,25 @@ #endif #endif -void do_tw (int flags) +void helper_tw (target_ulong arg1, target_ulong arg2, uint32_t flags) { - if (!likely(!(((int32_t)T0 < (int32_t)T1 && (flags & 0x10)) || - ((int32_t)T0 > (int32_t)T1 && (flags & 0x08)) || - ((int32_t)T0 == (int32_t)T1 && (flags & 0x04)) || - ((uint32_t)T0 < (uint32_t)T1 && (flags & 0x02)) || - ((uint32_t)T0 > (uint32_t)T1 && (flags & 0x01))))) { + if (!likely(!(((int32_t)arg1 < (int32_t)arg2 && (flags & 0x10)) || + ((int32_t)arg1 > (int32_t)arg2 && (flags & 0x08)) || + ((int32_t)arg1 == (int32_t)arg2 && (flags & 0x04)) || + ((uint32_t)arg1 < (uint32_t)arg2 && (flags & 0x02)) || + ((uint32_t)arg1 > (uint32_t)arg2 && (flags & 0x01))))) { raise_exception_err(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_TRAP); } } #if defined(TARGET_PPC64) -void do_td (int flags) +void helper_td (target_ulong arg1, target_ulong arg2, uint32_t flags) { - if (!likely(!(((int64_t)T0 < (int64_t)T1 && (flags & 0x10)) || - ((int64_t)T0 > (int64_t)T1 && (flags & 0x08)) || - ((int64_t)T0 == (int64_t)T1 && (flags & 0x04)) || - ((uint64_t)T0 < (uint64_t)T1 && (flags & 0x02)) || - ((uint64_t)T0 > (uint64_t)T1 && (flags & 0x01))))) + if (!likely(!(((int64_t)arg1 < (int64_t)arg2 && (flags & 0x10)) || + ((int64_t)arg1 > (int64_t)arg2 && (flags & 0x08)) || + ((int64_t)arg1 == (int64_t)arg2 && (flags & 0x04)) || + ((uint64_t)arg1 < (uint64_t)arg2 && (flags & 0x02)) || + ((uint64_t)arg1 > (uint64_t)arg2 && (flags & 0x01))))) raise_exception_err(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_TRAP); } #endif Modified: trunk/target-ppc/op_helper.h =================================================================== --- trunk/target-ppc/op_helper.h 2008-11-24 08:47:21 UTC (rev 5787) +++ trunk/target-ppc/op_helper.h 2008-11-24 11:28:19 UTC (rev 5788) @@ -60,10 +60,6 @@ void ppc_store_dump_spr (int sprn, target_ulong val); /* Misc */ -void do_tw (int flags); -#if defined(TARGET_PPC64) -void do_td (int flags); -#endif #if !defined(CONFIG_USER_ONLY) void do_store_msr (void); void do_rfi (void); Modified: trunk/target-ppc/translate.c =================================================================== --- trunk/target-ppc/translate.c 2008-11-24 08:47:21 UTC (rev 5787) +++ trunk/target-ppc/translate.c 2008-11-24 11:28:19 UTC (rev 5788) @@ -3819,42 +3819,46 @@ /* tw */ GEN_HANDLER(tw, 0x1F, 0x04, 0x00, 0x00000001, PPC_FLOW) { - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); - tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); + TCGv_i32 t0 = tcg_const_i32(TO(ctx->opcode)); /* Update the nip since this might generate a trap exception */ gen_update_nip(ctx, ctx->nip); - gen_op_tw(TO(ctx->opcode)); + gen_helper_tw(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], t0); + tcg_temp_free_i32(t0); } /* twi */ GEN_HANDLER(twi, 0x03, 0xFF, 0xFF, 0x00000000, PPC_FLOW) { - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); - tcg_gen_movi_tl(cpu_T[1], SIMM(ctx->opcode)); + TCGv t0 = tcg_const_tl(SIMM(ctx->opcode)); + TCGv_i32 t1 = tcg_const_i32(TO(ctx->opcode)); /* Update the nip since this might generate a trap exception */ gen_update_nip(ctx, ctx->nip); - gen_op_tw(TO(ctx->opcode)); + gen_helper_tw(cpu_gpr[rA(ctx->opcode)], t0, t1); + tcg_temp_free(t0); + tcg_temp_free_i32(t1); } #if defined(TARGET_PPC64) /* td */ GEN_HANDLER(td, 0x1F, 0x04, 0x02, 0x00000001, PPC_64B) { - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); - tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); + TCGv_i32 t0 = tcg_const_i32(TO(ctx->opcode)); /* Update the nip since this might generate a trap exception */ gen_update_nip(ctx, ctx->nip); - gen_op_td(TO(ctx->opcode)); + gen_helper_td(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], t0); + tcg_temp_free_i32(t0); } /* tdi */ GEN_HANDLER(tdi, 0x02, 0xFF, 0xFF, 0x00000000, PPC_64B) { - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); - tcg_gen_movi_tl(cpu_T[1], SIMM(ctx->opcode)); + TCGv t0 = tcg_const_tl(SIMM(ctx->opcode)); + TCGv_i32 t1 = tcg_const_i32(TO(ctx->opcode)); /* Update the nip since this might generate a trap exception */ gen_update_nip(ctx, ctx->nip); - gen_op_td(TO(ctx->opcode)); + gen_helper_td(cpu_gpr[rA(ctx->opcode)], t0, t1); + tcg_temp_free(t0); + tcg_temp_free_i32(t1); } #endif