target-sparc: Avoid cpu_tmp32 in Write Priv Register

No need to copy to a temporary to store 32 bits.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Richard Henderson 2012-10-16 19:32:23 +10:00 committed by Blue Swirl
parent 45778f99f0
commit 7b9e066b67

View file

@ -3801,8 +3801,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
r_tsptr = tcg_temp_new_ptr(); r_tsptr = tcg_temp_new_ptr();
gen_load_trap_state_at_tl(r_tsptr, cpu_env); gen_load_trap_state_at_tl(r_tsptr, cpu_env);
tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0); tcg_gen_st32_tl(cpu_tmp0, r_tsptr,
tcg_gen_st_i32(cpu_tmp32, r_tsptr,
offsetof(trap_state, tt)); offsetof(trap_state, tt));
tcg_temp_free_ptr(r_tsptr); tcg_temp_free_ptr(r_tsptr);
} }
@ -3829,8 +3828,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
break; break;
case 7: // tl case 7: // tl
save_state(dc); save_state(dc);
tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0); tcg_gen_st32_tl(cpu_tmp0, cpu_env,
tcg_gen_st_i32(cpu_tmp32, cpu_env,
offsetof(CPUSPARCState, tl)); offsetof(CPUSPARCState, tl));
dc->npc = DYNAMIC_PC; dc->npc = DYNAMIC_PC;
break; break;
@ -3841,39 +3839,33 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
gen_helper_wrcwp(cpu_env, cpu_tmp0); gen_helper_wrcwp(cpu_env, cpu_tmp0);
break; break;
case 10: // cansave case 10: // cansave
tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0); tcg_gen_st32_tl(cpu_tmp0, cpu_env,
tcg_gen_st_i32(cpu_tmp32, cpu_env,
offsetof(CPUSPARCState, offsetof(CPUSPARCState,
cansave)); cansave));
break; break;
case 11: // canrestore case 11: // canrestore
tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0); tcg_gen_st32_tl(cpu_tmp0, cpu_env,
tcg_gen_st_i32(cpu_tmp32, cpu_env,
offsetof(CPUSPARCState, offsetof(CPUSPARCState,
canrestore)); canrestore));
break; break;
case 12: // cleanwin case 12: // cleanwin
tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0); tcg_gen_st32_tl(cpu_tmp0, cpu_env,
tcg_gen_st_i32(cpu_tmp32, cpu_env,
offsetof(CPUSPARCState, offsetof(CPUSPARCState,
cleanwin)); cleanwin));
break; break;
case 13: // otherwin case 13: // otherwin
tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0); tcg_gen_st32_tl(cpu_tmp0, cpu_env,
tcg_gen_st_i32(cpu_tmp32, cpu_env,
offsetof(CPUSPARCState, offsetof(CPUSPARCState,
otherwin)); otherwin));
break; break;
case 14: // wstate case 14: // wstate
tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0); tcg_gen_st32_tl(cpu_tmp0, cpu_env,
tcg_gen_st_i32(cpu_tmp32, cpu_env,
offsetof(CPUSPARCState, offsetof(CPUSPARCState,
wstate)); wstate));
break; break;
case 16: // UA2005 gl case 16: // UA2005 gl
CHECK_IU_FEATURE(dc, GL); CHECK_IU_FEATURE(dc, GL);
tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0); tcg_gen_st32_tl(cpu_tmp0, cpu_env,
tcg_gen_st_i32(cpu_tmp32, cpu_env,
offsetof(CPUSPARCState, gl)); offsetof(CPUSPARCState, gl));
break; break;
case 26: // UA2005 strand status case 26: // UA2005 strand status
@ -3886,11 +3878,11 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
goto illegal_insn; goto illegal_insn;
} }
#else #else
tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0); tcg_gen_trunc_tl_i32(cpu_wim, cpu_tmp0);
if (dc->def->nwindows != 32) if (dc->def->nwindows != 32) {
tcg_gen_andi_tl(cpu_tmp32, cpu_tmp32, tcg_gen_andi_tl(cpu_wim, cpu_wim,
(1 << dc->def->nwindows) - 1); (1 << dc->def->nwindows) - 1);
tcg_gen_mov_i32(cpu_wim, cpu_tmp32); }
#endif #endif
} }
break; break;