[5120] SH4: Convert remaining non-fp ops to TCG
Revision: 5120
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5120 Author: aurel32 Date: 2008-09-01 13:09:06 +0000 (Mon, 01 Sep 2008)
Log Message:
-----------
SH4: Convert remaining non-fp ops to TCG
Modified Paths:
--------------
trunk/target-sh4/exec.h
trunk/target-sh4/helper.h
trunk/target-sh4/op.c
trunk/target-sh4/op_helper.c
trunk/target-sh4/translate.c
Modified: trunk/target-sh4/exec.h
===================================================================
target-sh4/exec.h +0 -4
@@ -71,10 +71,6 @@ int use_asid, int update);int find_utlb_entry (CPUState * env,target_ulong address,int use_asid); -void helper_div1_T0_T1 (void ); -void helper_rotcl (uint32_t * addr); -void helper_rotcr (uint32_t * addr); -void do_interrupt (CPUState * env);void cpu_loop_exit (void );
Modified: trunk/target-sh4/helper.h
===================================================================
target-sh4/helper.h +1 -0
@@ -14,6 +14,7 @@ DEF_HELPER(uint32_t, helper_subv, (uint32_t, uint32_t)) DEF_HELPER(uint32_t, helper_subc, (uint32_t, uint32_t)) DEF_HELPER(uint32_t, helper_negc, (uint32_t)) +DEF_HELPER(uint32_t, helper_div1, (uint32_t, uint32_t)) DEF_HELPER(void, helper_macl, (uint32_t, uint32_t)) DEF_HELPER(void, helper_macw, (uint32_t, uint32_t))
Modified: trunk/target-sh4/op.c
===================================================================
target-sh4/op.c +0 -78
84 lines not on this page · raw message
Modified: trunk/target-sh4/op_helper.c
===================================================================
target-sh4/op_helper.c +20 -43
111 lines not on this page · raw message
Modified: trunk/target-sh4/translate.c
===================================================================
target-sh4/translate.c +109 -28
182 lines not on this page · raw message
Quoted 8 lines · Aurelien Jarno
-void OPPROTO
op_cmp_str_T0_T1(void)
-{- cond_t((T0 & 0x000000ff) == (T1 & 0x000000ff) || - (T0 & 0x0000ff00) == (T1 & 0x0000ff00) || - (T0 & 0x00ff0000) == (T1 & 0x00ff0000) ||- (T0 &
0xff000000) == (T1 &0xff000000));
-RETURN();
-}
The above version uses both T0 and T1, but the version below only cpu_T[0].
Quoted 16 lines
+ int label1 = gen_new_label(); + int label2 = gen_new_label(); + tcg_gen_xor_i32(cpu_T[0], cpu_gregs[REG(B7_4)], cpu_gregs[REG(B11_8)]); + tcg_gen_andi_i32(cpu_T[0], cpu_T[0], 0xff000000); + tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_T[0], 0, label1); + tcg_gen_andi_i32(cpu_T[0], cpu_T[0], 0x00ff0000); + tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_T[0], 0, label1); + tcg_gen_andi_i32(cpu_T[0], cpu_T[0], 0x0000ff00); + tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_T[0], 0, label1); + tcg_gen_andi_i32(cpu_T[0], cpu_T[0], 0x000000ff); + tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_T[0], 0, label1); + tcg_gen_andi_i32(cpu_sr, cpu_sr, ~SR_T); + tcg_gen_br(label2); + gen_set_label(label1); + tcg_gen_ori_i32(cpu_sr, cpu_sr, SR_T); + gen_set_label(label2);
Quoted 11 lines · Blue Swirl
Quoted 8 lines · Aurelien Jarno
-void OPPROTO
op_cmp_str_T0_T1(void)
-{- cond_t((T0 & 0x000000ff) == (T1 & 0x000000ff) || - (T0 & 0x0000ff00) == (T1 & 0x0000ff00) || - (T0 & 0x00ff0000) == (T1 & 0x00ff0000) ||- (T0 &
0xff000000) == (T1 &0xff000000));
-RETURN();
-}The above version uses both T0 and T1, but the version below only cpu_T[0].
Yes, I have found my mistake when doing the cpu_T[] removal pass (r5122) and noted that I have to fix that in this patch, but then I forget and committed the patch as is.
Anyway the implementation in r5122 is correct.
Quoted 17 lines
Quoted 16 lines
+ int label1 = gen_new_label(); + int label2 = gen_new_label(); + tcg_gen_xor_i32(cpu_T[0], cpu_gregs[REG(B7_4)], cpu_gregs[REG(B11_8)]); + tcg_gen_andi_i32(cpu_T[0], cpu_T[0], 0xff000000); + tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_T[0], 0, label1); + tcg_gen_andi_i32(cpu_T[0], cpu_T[0], 0x00ff0000); + tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_T[0], 0, label1); + tcg_gen_andi_i32(cpu_T[0], cpu_T[0], 0x0000ff00); + tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_T[0], 0, label1); + tcg_gen_andi_i32(cpu_T[0], cpu_T[0], 0x000000ff); + tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_T[0], 0, label1); + tcg_gen_andi_i32(cpu_sr, cpu_sr, ~SR_T); + tcg_gen_br(label2); + gen_set_label(label1); + tcg_gen_ori_i32(cpu_sr, cpu_sr, SR_T); + gen_set_label(label2);
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net