Skip to contentSkip to conversation

SH4 : convert branch/jump instructions to TCG

PATCH In review Shin-ichiro KAWASAKI 2 participants 2 messages Aug 29, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SH4 : convert branch/jump instructions to TCG

This patch is another contributes to TCG work on SH4.

All branch/jump instructions are converted into TCG implementation. The fields 'flags' and 'delayed_pc' of CPUState structure are mapped as TCG global memory variables. These fields are not real registers but accessed so often. I guess they worth TCG vars.

This patch is for rev.5107, and will cause a small patch failure when you patch it after merging the patch I send two hours before.
I merge these patches if necessery.

Regards,
Shin-ichiro KAWASAKI

target-sh4/op.c +0 -99
Index: trunk/target-sh4/op.c
===================================================================
@@ -43,70 +43,6 @@
     RETURN();
 }
 
-void OPPROTO op_bf_s(void)
-{
-    env->delayed_pc = PARAM1;
-    if (!(env->sr & SR_T)) {
-        env->flags |= DELAY_SLOT_TRUE;
-    }
-    RETURN();
-}
-
-void OPPROTO op_bt_s(void)
-{
-    env->delayed_pc = PARAM1;
-    if (env->sr & SR_T) {
-        env->flags |= DELAY_SLOT_TRUE;
-    }
-    RETURN();
-}
-
-void OPPROTO op_store_flags(void)
-{
-    env->flags &= DELAY_SLOT_TRUE;
-    env->flags |= PARAM1;
-    RETURN();
-}
-
-void OPPROTO op_bra(void)
-{
-    env->delayed_pc = PARAM1;
-    RETURN();
-}
-
-void OPPROTO op_braf_T0(void)
-{
-    env->delayed_pc = PARAM1 + T0;
-    RETURN();
-}
-
-void OPPROTO op_bsr(void)
-{
-    env->pr = PARAM1;
-    env->delayed_pc = PARAM2;
-    RETURN();
-}
-
-void OPPROTO op_bsrf_T0(void)
-{
-    env->pr = PARAM1;
-    env->delayed_pc = PARAM1 + T0;
-    RETURN();
-}
-
-void OPPROTO op_jsr_T0(void)
-{
-    env->pr = PARAM1;
-    env->delayed_pc = T0;
-    RETURN();
-}
-
-void OPPROTO op_rts(void)
-{
-    env->delayed_pc = env->pr;
-    RETURN();
-}
-
 void OPPROTO op_ldtlb(void)
 {
     helper_ldtlb();
@@ -125,13 +61,6 @@
     RETURN();
 }
 
-void OPPROTO op_rte(void)
-{
-    env->sr = env->ssr;
-    env->delayed_pc = env->spc;
-    RETURN();
-}
-
 void OPPROTO op_addc_T0_T1(void)
 {
     helper_addc_T0_T1();
@@ -311,12 +240,6 @@
     RETURN();
 }
 
-void OPPROTO op_jmp_T0(void)
-{
-    env->delayed_pc = T0;
-    RETURN();
-}
-
 void OPPROTO op_ldcl_rMplus_rN_bank(void)
 {
     env->gregs[PARAM2] = env->gregs[PARAM1];
@@ -634,28 +557,6 @@
     RETURN();
 }
 
-void OPPROTO op_jT(void)
-{
-    if (env->sr & SR_T)
-	GOTO_LABEL_PARAM(1);
-    RETURN();
-}
-
-void OPPROTO op_jdelayed(void)
-{
-    if (env->flags & DELAY_SLOT_TRUE) {
-        env->flags &= ~DELAY_SLOT_TRUE;
-        GOTO_LABEL_PARAM(1);
-    }
-    RETURN();
-}
-
-void OPPROTO op_movl_delayed_pc_PC(void)
-{
-    env->pc = env->delayed_pc;
-    RETURN();
-}
-
 void OPPROTO op_tst_imm_T0(void)
 {
     cond_t((T0 & PARAM1) == 0);
target-sh4/translate.c +51 -20

189 lines not on this page · raw message

#1 lore raw
Quoted 6 lines · Shin-ichiro KAWASAKI

This patch is another contributes to TCG work on SH4.

All branch/jump instructions are converted into TCG implementation. The fields 'flags' and 'delayed_pc' of CPUState structure are mapped as TCG global memory variables. These fields are not real registers but accessed so often. I guess they worth TCG vars.

I also agree that we should map them using TCG vars. However, I have changed their name, so that they appear differently in debugging outputs.

Quoted 3 lines

This patch is for rev.5107, and will cause a small patch failure when you patch it after merging the patch I send two hours before.
I merge these patches if necessery.

I have done the merge manually and applied the patch, thanks.

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net