Skip to contentSkip to conversation

[5100] SH4: Convert register moves to TCG

Qemu-devel Aurelien Jarno 3 participants 5 messages Aug 28, 2008 – Aug 29, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5100

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5100
Author:   aurel32
Date:     2008-08-28 21:02:38 +0000 (Thu, 28 Aug 2008)

Log Message:
-----------
SH4: Convert register moves to TCG

Modified Paths:
--------------
trunk/target-sh4/op.c
trunk/target-sh4/translate.c

Modified: trunk/target-sh4/op.c
===================================================================

target-sh4/op.c +0 -84
@@ -401,12 +401,6 @@
     RETURN();
 }
 
-void OPPROTO op_movl_rN_rN(void)
-{
-    env->gregs[PARAM2] = env->gregs[PARAM1];
-    RETURN();
-}
-
 void OPPROTO op_ldcl_rMplus_rN_bank(void)
 {
     env->gregs[PARAM2] = env->gregs[PARAM1];
@@ -550,84 +544,6 @@
     RETURN();
 }
 
-void OPPROTO op_movl_T0_rN(void)
-{
-    env->gregs[PARAM1] = T0;
-    RETURN();
-}
-
-void OPPROTO op_movl_T1_rN(void)
-{
-    env->gregs[PARAM1] = T1;
-    RETURN();
-}
-
-void OPPROTO op_movb_rN_T0(void)
-{
-    T0 = (int32_t) (int8_t) (env->gregs[PARAM1] & 0xff);
-    RETURN();
-}
-
-void OPPROTO op_movub_rN_T0(void)
-{
-    T0 = env->gregs[PARAM1] & 0xff;
-    RETURN();
-}
-
-void OPPROTO op_movw_rN_T0(void)
-{
-    T0 = (int32_t) (int16_t) (env->gregs[PARAM1] & 0xffff);
-    RETURN();
-}
-
-void OPPROTO op_movuw_rN_T0(void)
-{
-    T0 = env->gregs[PARAM1] & 0xffff;
-    RETURN();
-}
-
-void OPPROTO op_movl_rN_T0(void)
-{
-    T0 = env->gregs[PARAM1];
-    RETURN();
-}
-
-void OPPROTO op_movb_rN_T1(void)
-{
-    T1 = (int32_t) (int8_t) (env->gregs[PARAM1] & 0xff);
-    RETURN();
-}
-
-void OPPROTO op_movub_rN_T1(void)
-{
-    T1 = env->gregs[PARAM1] & 0xff;
-    RETURN();
-}
-
-void OPPROTO op_movw_rN_T1(void)
-{
-    T1 = (int32_t) (int16_t) (env->gregs[PARAM1] & 0xffff);
-    RETURN();
-}
-
-void OPPROTO op_movuw_rN_T1(void)
-{
-    T1 = env->gregs[PARAM1] & 0xffff;
-    RETURN();
-}
-
-void OPPROTO op_movl_rN_T1(void)
-{
-    T1 = env->gregs[PARAM1];
-    RETURN();
-}
-
-void OPPROTO op_movl_imm_rN(void)
-{
-    env->gregs[PARAM2] = PARAM1;
-    RETURN();
-}
-
 void OPPROTO op_fmov_frN_FT0(void)
 {
     FT0 = env->fregs[PARAM1];

Modified: trunk/target-sh4/translate.c
===================================================================

target-sh4/translate.c +209 -177

841 lines not on this page · raw message

#1 lore raw

target-sh4/translate.c line 91

Quoted 3 lines · Aurelien Jarno
target-sh4/translate.c +3 -0
+static always_inline void gen_movl_T_rN (TCGv t, int reg)
+{
+    tcg_gen_st_tl(t, cpu_env, offsetof(CPUState, gregs[reg]));

The preferred way of doing this is to have TCG variables for common (possibly all?) registers. See e.g. m68k or sparc.

Paul

#2 lore raw
Quoted 8 lines · Paul Brook

target-sh4/translate.c line 91

Quoted 3 lines · Aurelien Jarno
target-sh4/translate.c +3 -0
+static always_inline void gen_movl_T_rN (TCGv t, int reg)
+{
+    tcg_gen_st_tl(t, cpu_env, offsetof(CPUState, gregs[reg]));

The preferred way of doing this is to have TCG variables for common (possibly all?) registers. See e.g. m68k or sparc.

Until now I have used MIPS as an example, it copies CPU registers to TCG variables. As you pointed, m68k and sparc use direct access to CPU registers through TCG variables.

I wonder in which way what your propose is better? It seems easier to write, but what about the runtime speed?

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#3 lore raw
Quoted 9 lines · Aurelien Jarno
Quoted 7 lines · Paul Brook

target-sh4/translate.c line 91

Quoted 3 lines · Aurelien Jarno
target-sh4/translate.c +3 -0
+static always_inline void gen_movl_T_rN (TCGv t, int reg)
+{
+    tcg_gen_st_tl(t, cpu_env, offsetof(CPUState, gregs[reg]));

The preferred way of doing this is to have TCG variables for common (possibly all?) registers. See e.g. m68k or sparc.

Quoted 6 lines

Until now I have used MIPS as an example, it copies CPU registers to TCG variables. As you pointed, m68k and sparc use direct access to CPU registers through TCG variables.

I wonder in which way what your propose is better? It seems easier to write, but what about the runtime speed?

I'm guessing that with current tcg there's not a lot of difference. Using variables (like sparc/m68k) gives scope for better/easier code generation in the future, and makes debug dumps look prettier.

Paul

#4 lore raw
In reply to Aurelien Jarno
Quoted 10 lines · Aurelien Jarno
Quoted 8 lines · Paul Brook

target-sh4/translate.c line 91

Quoted 3 lines · Aurelien Jarno
target-sh4/translate.c +3 -0
+static always_inline void gen_movl_T_rN (TCGv t, int reg)
+{
+    tcg_gen_st_tl(t, cpu_env, offsetof(CPUState, gregs[reg]));

The preferred way of doing this is to have TCG variables for common (possibly all?) registers. See e.g. m68k or sparc.

Quoted 3 lines

Until now I have used MIPS as an example, it copies CPU registers to TCG variables. As you pointed, m68k and sparc use direct access to CPU registers through TCG variables.

For MIPS I tried to keep thing similiar to dyngen when both TCG and dyngen were used. Then I converted a few places to use TCG variables but had no time to finish the job.

Quoted 2 lines

I wonder in which way what your propose is better? It seems easier to write, but what about the runtime speed?

TCG variables are (potentially) better.

Thiemo