From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L6q40-000208-GS for qemu-devel@nongnu.org; Sun, 30 Nov 2008 12:26:32 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L6q3z-0001zg-R2 for qemu-devel@nongnu.org; Sun, 30 Nov 2008 12:26:32 -0500 Received: from [199.232.76.173] (port=60776 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L6q3z-0001zZ-Ku for qemu-devel@nongnu.org; Sun, 30 Nov 2008 12:26:31 -0500 Received: from savannah.gnu.org ([199.232.41.3]:36824 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 1L6q3z-0001PW-Bn for qemu-devel@nongnu.org; Sun, 30 Nov 2008 12:26:31 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1L6q3y-00014S-Pb for qemu-devel@nongnu.org; Sun, 30 Nov 2008 17:26:30 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1L6q3y-00014M-1D for qemu-devel@nongnu.org; Sun, 30 Nov 2008 17:26:30 +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 17:26:30 +0000 Subject: [Qemu-devel] [5836] target-ppc: convert PPC 440 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: 5836 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5836 Author: aurel32 Date: 2008-11-30 17:26:29 +0000 (Sun, 30 Nov 2008) Log Message: ----------- target-ppc: convert PPC 440 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-30 16:25:37 UTC (rev 5835) +++ trunk/target-ppc/helper.h 2008-11-30 17:26:29 UTC (rev 5836) @@ -170,4 +170,6 @@ DEF_HELPER_1(602_mfrom, tl, tl) #endif +DEF_HELPER_3(dlmzb, tl, tl, tl, i32) + #include "def-helper.h" Modified: trunk/target-ppc/op.c =================================================================== --- trunk/target-ppc/op.c 2008-11-30 16:25:37 UTC (rev 5835) +++ trunk/target-ppc/op.c 2008-11-30 17:26:29 UTC (rev 5836) @@ -706,23 +706,6 @@ /* SPR micro-ops */ /* 440 specific */ -void OPPROTO op_440_dlmzb (void) -{ - do_440_dlmzb(); - RETURN(); -} - -void OPPROTO op_440_dlmzb_update_Rc (void) -{ - if (T0 == 8) - T0 = 0x2; - else if (T0 < 4) - T0 = 0x4; - else - T0 = 0x8; - RETURN(); -} - #if !defined(CONFIG_USER_ONLY) void OPPROTO op_store_pir (void) { Modified: trunk/target-ppc/op_helper.c =================================================================== --- trunk/target-ppc/op_helper.c 2008-11-30 16:25:37 UTC (rev 5835) +++ trunk/target-ppc/op_helper.c 2008-11-30 17:26:29 UTC (rev 5836) @@ -1999,24 +1999,39 @@ #endif /* 440 specific */ -void do_440_dlmzb (void) +target_ulong helper_dlmzb (target_ulong high, target_ulong low, uint32_t update_Rc) { target_ulong mask; int i; i = 1; for (mask = 0xFF000000; mask != 0; mask = mask >> 8) { - if ((T0 & mask) == 0) + if ((high & mask) == 0) { + if (update_Rc) { + env->crf[0] = 0x4; + } goto done; + } i++; } for (mask = 0xFF000000; mask != 0; mask = mask >> 8) { - if ((T1 & mask) == 0) - break; + if ((low & mask) == 0) { + if (update_Rc) { + env->crf[0] = 0x8; + } + goto done; + } i++; } + if (update_Rc) { + env->crf[0] = 0x2; + } done: - T0 = i; + env->xer = (env->xer & ~0x7F) | i; + if (update_Rc) { + env->crf[0] |= xer_so; + } + return i; } /*****************************************************************************/ Modified: trunk/target-ppc/op_helper.h =================================================================== --- trunk/target-ppc/op_helper.h 2008-11-30 16:25:37 UTC (rev 5835) +++ trunk/target-ppc/op_helper.h 2008-11-30 17:26:29 UTC (rev 5836) @@ -63,9 +63,6 @@ void do_4xx_tlbwe_hi (void); #endif -/* PowerPC 440 specific helpers */ -void do_440_dlmzb (void); - /* PowerPC 403 specific helpers */ #if !defined(CONFIG_USER_ONLY) void do_load_403_pb (int num); Modified: trunk/target-ppc/translate.c =================================================================== --- trunk/target-ppc/translate.c 2008-11-30 16:25:37 UTC (rev 5835) +++ trunk/target-ppc/translate.c 2008-11-30 17:26:29 UTC (rev 5836) @@ -5747,17 +5747,10 @@ /* dlmzb */ GEN_HANDLER(dlmzb, 0x1F, 0x0E, 0x02, 0x00000000, PPC_440_SPEC) { - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]); - tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); - gen_op_440_dlmzb(); - tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); - tcg_gen_andi_tl(cpu_xer, cpu_xer, ~0x7F); - tcg_gen_or_tl(cpu_xer, cpu_xer, cpu_T[0]); - if (Rc(ctx->opcode)) { - gen_op_440_dlmzb_update_Rc(); - tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_T[0]); - tcg_gen_andi_i32(cpu_crf[0], cpu_crf[0], 0xf); - } + TCGv_i32 t0 = tcg_const_i32(Rc(ctx->opcode)); + gen_helper_dlmzb(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], + cpu_gpr[rB(ctx->opcode)], t0); + tcg_temp_free_i32(t0); } /* mbar replaces eieio on 440 */