tcg_gen_add_ptr(r_ptr, cpu_env, r_tc_off_ptr);
tcg_gen_st_tl(r_tmp, r_ptr, offsetof(CPUState, PC));
tcg_temp_free(r_tc_off);
- tcg_temp_free(r_tc_off_tl);
+ tcg_temp_free(r_tc_off_ptr);
tcg_temp_free(r_ptr);
tcg_temp_free(r_tmp);
}
tcg_gen_add_ptr(r_ptr, cpu_env, r_tc_off_ptr);
tcg_gen_st_tl(r_tmp, r_ptr, offsetof(CPUState, PC));
tcg_temp_free(r_tc_off);
- tcg_temp_free(r_tc_off_tl);
+ tcg_temp_free(r_tc_off_ptr);
tcg_temp_free(r_ptr);
tcg_temp_free(r_tmp);
}
tcg_gen_movi_tl(r_tmp, btarget);
tcg_gen_st_tl(r_tmp, cpu_env, offsetof(CPUState, btarget));
+ tcg_temp_free(r_tmp);
}
static always_inline void gen_save_breg_target(int reg)
gen_load_gpr(r_tmp, reg);
tcg_gen_st_tl(r_tmp, cpu_env, offsetof(CPUState, btarget));
+ tcg_temp_free(r_tmp);
}
static always_inline void save_cpu_state (DisasContext *ctx, int do_save_pc)
#define OP_ST_ATOMIC(insn,fname,almask) \
void inline op_ldst_##insn(DisasContext *ctx) \
{ \
- TCGv r_tmp = tcg_temp_new(TCG_TYPE_TL); \
+ TCGv r_tmp = tcg_temp_local_new(TCG_TYPE_TL); \
int l1 = gen_new_label(); \
int l2 = gen_new_label(); \
int l3 = gen_new_label(); \
gen_set_label(l1); \
tcg_gen_ld_tl(r_tmp, cpu_env, offsetof(CPUState, CP0_LLAddr)); \
tcg_gen_brcond_tl(TCG_COND_NE, cpu_T[0], r_tmp, l2); \
+ tcg_temp_free(r_tmp); \
tcg_gen_qemu_##fname(cpu_T[1], cpu_T[0], ctx->mem_idx); \
tcg_gen_movi_tl(cpu_T[0], 1); \
tcg_gen_br(l3); \
switch (opc) {
case OPC_ADDI:
{
- TCGv r_tmp1 = tcg_temp_new(TCG_TYPE_TL);
+ TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_TL);
TCGv r_tmp2 = tcg_temp_new(TCG_TYPE_TL);
int l1 = gen_new_label();
tcg_gen_xori_tl(r_tmp1, r_tmp1, -1);
tcg_gen_xori_tl(r_tmp2, cpu_T[0], uimm);
tcg_gen_and_tl(r_tmp1, r_tmp1, r_tmp2);
+ tcg_temp_free(r_tmp2);
tcg_gen_shri_tl(r_tmp1, r_tmp1, 31);
tcg_gen_brcondi_tl(TCG_COND_EQ, r_tmp1, 0, l1);
+ tcg_temp_free(r_tmp1);
/* operands of same sign, result different sign */
generate_exception(ctx, EXCP_OVERFLOW);
gen_set_label(l1);
#if defined(TARGET_MIPS64)
case OPC_DADDI:
{
- TCGv r_tmp1 = tcg_temp_new(TCG_TYPE_TL);
+ TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_TL);
TCGv r_tmp2 = tcg_temp_new(TCG_TYPE_TL);
int l1 = gen_new_label();
tcg_gen_xori_tl(r_tmp1, r_tmp1, -1);
tcg_gen_xori_tl(r_tmp2, cpu_T[0], uimm);
tcg_gen_and_tl(r_tmp1, r_tmp1, r_tmp2);
+ tcg_temp_free(r_tmp2);
tcg_gen_shri_tl(r_tmp1, r_tmp1, 63);
tcg_gen_brcondi_tl(TCG_COND_EQ, r_tmp1, 0, l1);
+ tcg_temp_free(r_tmp1);
/* operands of same sign, result different sign */
generate_exception(ctx, EXCP_OVERFLOW);
gen_set_label(l1);
tcg_gen_shl_tl(r_tmp1, cpu_T[0], r_tmp1);
tcg_gen_shri_tl(cpu_T[0], cpu_T[0], uimm);
tcg_gen_or_tl(cpu_T[0], cpu_T[0], r_tmp1);
+ tcg_temp_free(r_tmp1);
}
opn = "drotr";
} else {
tcg_gen_shl_tl(r_tmp1, cpu_T[0], r_tmp1);
tcg_gen_shr_tl(cpu_T[0], cpu_T[0], r_tmp2);
tcg_gen_or_tl(cpu_T[0], cpu_T[0], r_tmp1);
+ tcg_temp_free(r_tmp1);
+ tcg_temp_free(r_tmp2);
opn = "drotr32";
} else {
tcg_gen_shri_tl(cpu_T[0], cpu_T[0], uimm + 32);
switch (opc) {
case OPC_ADD:
{
- TCGv r_tmp1 = tcg_temp_new(TCG_TYPE_TL);
+ TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_TL);
TCGv r_tmp2 = tcg_temp_new(TCG_TYPE_TL);
int l1 = gen_new_label();
tcg_gen_xori_tl(r_tmp1, r_tmp1, -1);
tcg_gen_xor_tl(r_tmp2, cpu_T[0], cpu_T[1]);
tcg_gen_and_tl(r_tmp1, r_tmp1, r_tmp2);
+ tcg_temp_free(r_tmp2);
tcg_gen_shri_tl(r_tmp1, r_tmp1, 31);
tcg_gen_brcondi_tl(TCG_COND_EQ, r_tmp1, 0, l1);
+ tcg_temp_free(r_tmp1);
/* operands of same sign, result different sign */
generate_exception(ctx, EXCP_OVERFLOW);
gen_set_label(l1);
break;
case OPC_SUB:
{
- TCGv r_tmp1 = tcg_temp_new(TCG_TYPE_TL);
+ TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_TL);
TCGv r_tmp2 = tcg_temp_new(TCG_TYPE_TL);
int l1 = gen_new_label();
tcg_gen_xor_tl(r_tmp2, r_tmp1, cpu_T[1]);
tcg_gen_xor_tl(r_tmp1, r_tmp1, cpu_T[0]);
tcg_gen_and_tl(r_tmp1, r_tmp1, r_tmp2);
+ tcg_temp_free(r_tmp2);
tcg_gen_shri_tl(r_tmp1, r_tmp1, 31);
tcg_gen_brcondi_tl(TCG_COND_EQ, r_tmp1, 0, l1);
+ tcg_temp_free(r_tmp1);
/* operands of different sign, first operand and result different sign */
generate_exception(ctx, EXCP_OVERFLOW);
gen_set_label(l1);
#if defined(TARGET_MIPS64)
case OPC_DADD:
{
- TCGv r_tmp1 = tcg_temp_new(TCG_TYPE_TL);
+ TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_TL);
TCGv r_tmp2 = tcg_temp_new(TCG_TYPE_TL);
int l1 = gen_new_label();
tcg_gen_xori_tl(r_tmp1, r_tmp1, -1);
tcg_gen_xor_tl(r_tmp2, cpu_T[0], cpu_T[1]);
tcg_gen_and_tl(r_tmp1, r_tmp1, r_tmp2);
+ tcg_temp_free(r_tmp2);
tcg_gen_shri_tl(r_tmp1, r_tmp1, 63);
tcg_gen_brcondi_tl(TCG_COND_EQ, r_tmp1, 0, l1);
+ tcg_temp_free(r_tmp1);
/* operands of same sign, result different sign */
generate_exception(ctx, EXCP_OVERFLOW);
gen_set_label(l1);
break;
case OPC_DSUB:
{
- TCGv r_tmp1 = tcg_temp_new(TCG_TYPE_TL);
+ TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_TL);
TCGv r_tmp2 = tcg_temp_new(TCG_TYPE_TL);
int l1 = gen_new_label();
tcg_gen_xor_tl(r_tmp2, r_tmp1, cpu_T[1]);
tcg_gen_xor_tl(r_tmp1, r_tmp1, cpu_T[0]);
tcg_gen_and_tl(r_tmp1, r_tmp1, r_tmp2);
+ tcg_temp_free(r_tmp2);
tcg_gen_shri_tl(r_tmp1, r_tmp1, 63);
tcg_gen_brcondi_tl(TCG_COND_EQ, r_tmp1, 0, l1);
+ tcg_temp_free(r_tmp1);
/* operands of different sign, first operand and result different sign */
generate_exception(ctx, EXCP_OVERFLOW);
gen_set_label(l1);
tcg_gen_shl_tl(r_tmp1, cpu_T[1], r_tmp1);
tcg_gen_shr_tl(cpu_T[0], cpu_T[1], cpu_T[0]);
tcg_gen_or_tl(cpu_T[0], cpu_T[0], r_tmp1);
+ tcg_temp_free(r_tmp1);
tcg_gen_br(l2);
}
gen_set_label(l1);
tcg_gen_rem_i64(r_tmp2, r_tmp1, r_tmp2);
tcg_gen_trunc_i64_tl(cpu_T[0], r_tmp3);
tcg_gen_trunc_i64_tl(cpu_T[1], r_tmp2);
+ tcg_temp_free(r_tmp1);
+ tcg_temp_free(r_tmp2);
+ tcg_temp_free(r_tmp3);
tcg_gen_ext32s_tl(cpu_T[0], cpu_T[0]);
tcg_gen_ext32s_tl(cpu_T[1], cpu_T[1]);
gen_store_LO(cpu_T[0], 0);
tcg_gen_rem_i64(r_tmp2, cpu_T[0], cpu_T[1]);
gen_store_LO(r_tmp1, 0);
gen_store_HI(r_tmp2, 0);
+ tcg_temp_free(r_tmp1);
+ tcg_temp_free(r_tmp2);
}
}
gen_set_label(l1);
tcg_gen_divu_i64(r_tmp1, cpu_T[0], cpu_T[1]);
tcg_gen_remu_i64(r_tmp2, cpu_T[0], cpu_T[1]);
+ tcg_temp_free(r_tmp1);
+ tcg_temp_free(r_tmp2);
gen_store_LO(r_tmp1, 0);
gen_store_HI(r_tmp2, 0);
}
}
/* CP0 (MMU and control) */
+static inline void gen_mfc0_load32 (TCGv t, target_ulong off)
+{
+ TCGv r_tmp = tcg_temp_new(TCG_TYPE_I32);
+
+ tcg_gen_ld_i32(r_tmp, cpu_env, off);
+ tcg_gen_ext_i32_tl(t, r_tmp);
+ tcg_temp_free(r_tmp);
+}
+
+static inline void gen_mfc0_load64 (TCGv t, target_ulong off)
+{
+ TCGv r_tmp = tcg_temp_new(TCG_TYPE_I64);
+
+ tcg_gen_ld_i64(r_tmp, cpu_env, off);
+ tcg_gen_trunc_i64_tl(t, r_tmp);
+ tcg_temp_free(r_tmp);
+}
+
static void gen_mfc0 (CPUState *env, DisasContext *ctx, int reg, int sel)
{
const char *rn = "invalid";
- TCGv r_tmp = tcg_temp_new(TCG_TYPE_I32);
- TCGv r_tmp64 = tcg_temp_new(TCG_TYPE_I64);
if (sel != 0)
check_insn(env, ctx, ISA_MIPS32);
case 0:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Index));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Index));
rn = "Index";
break;
case 1:
break;
case 1:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_VPEControl));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_VPEControl));
rn = "VPEControl";
break;
case 2:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_VPEConf0));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_VPEConf0));
rn = "VPEConf0";
break;
case 3:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_VPEConf1));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_VPEConf1));
rn = "VPEConf1";
break;
case 4:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_i64(r_tmp64, cpu_env, offsetof(CPUState, CP0_YQMask));
- tcg_gen_trunc_i64_tl(cpu_T[0], r_tmp64);
+ gen_mfc0_load64(cpu_T[0], offsetof(CPUState, CP0_YQMask));
rn = "YQMask";
break;
case 5:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_tl(r_tmp64, cpu_env, offsetof(CPUState, CP0_VPESchedule));
- tcg_gen_trunc_i64_tl(cpu_T[0], r_tmp64);
+ gen_mfc0_load64(cpu_T[0], offsetof(CPUState, CP0_VPESchedule));
rn = "VPESchedule";
break;
case 6:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_tl(r_tmp64, cpu_env, offsetof(CPUState, CP0_VPEScheFBack));
- tcg_gen_trunc_i64_tl(cpu_T[0], r_tmp64);
+ gen_mfc0_load64(cpu_T[0], offsetof(CPUState, CP0_VPEScheFBack));
rn = "VPEScheFBack";
break;
case 7:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_VPEOpt));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_VPEOpt));
rn = "VPEOpt";
break;
default:
case 5:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_PageMask));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_PageMask));
rn = "PageMask";
break;
case 1:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_PageGrain));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_PageGrain));
rn = "PageGrain";
break;
default:
case 6:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Wired));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Wired));
rn = "Wired";
break;
case 1:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSConf0));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSConf0));
rn = "SRSConf0";
break;
case 2:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSConf1));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSConf1));
rn = "SRSConf1";
break;
case 3:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSConf2));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSConf2));
rn = "SRSConf2";
break;
case 4:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSConf3));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSConf3));
rn = "SRSConf3";
break;
case 5:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSConf4));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSConf4));
rn = "SRSConf4";
break;
default:
switch (sel) {
case 0:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_HWREna));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_HWREna));
rn = "HWREna";
break;
default:
case 11:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Compare));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Compare));
rn = "Compare";
break;
/* 6,7 are implementation dependent */
case 12:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Status));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Status));
rn = "Status";
break;
case 1:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_IntCtl));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_IntCtl));
rn = "IntCtl";
break;
case 2:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSCtl));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSCtl));
rn = "SRSCtl";
break;
case 3:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSMap));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSMap));
rn = "SRSMap";
break;
default:
case 13:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Cause));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Cause));
rn = "Cause";
break;
default:
case 15:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_PRid));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_PRid));
rn = "PRid";
break;
case 1:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_EBase));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_EBase));
rn = "EBase";
break;
default:
case 16:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config0));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config0));
rn = "Config";
break;
case 1:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config1));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config1));
rn = "Config1";
break;
case 2:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config2));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config2));
rn = "Config2";
break;
case 3:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config3));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config3));
rn = "Config3";
break;
/* 4,5 are reserved */
/* 6,7 are implementation dependent */
case 6:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config6));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config6));
rn = "Config6";
break;
case 7:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config7));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config7));
rn = "Config7";
break;
default:
/* Officially reserved, but sel 0 is used for R1x000 framemask */
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Framemask));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Framemask));
rn = "Framemask";
break;
default:
case 25:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Performance0));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Performance0));
rn = "Performance0";
break;
case 1:
case 2:
case 4:
case 6:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_TagLo));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_TagLo));
rn = "TagLo";
break;
case 1:
case 3:
case 5:
case 7:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_DataLo));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_DataLo));
rn = "DataLo";
break;
default:
case 2:
case 4:
case 6:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_TagHi));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_TagHi));
rn = "TagHi";
break;
case 1:
case 3:
case 5:
case 7:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_DataHi));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_DataHi));
rn = "DataHi";
break;
default:
switch (sel) {
case 0:
/* EJTAG support */
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_DESAVE));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_DESAVE));
rn = "DESAVE";
break;
default:
static void gen_dmfc0 (CPUState *env, DisasContext *ctx, int reg, int sel)
{
const char *rn = "invalid";
- TCGv r_tmp = tcg_temp_new(TCG_TYPE_I32);
if (sel != 0)
check_insn(env, ctx, ISA_MIPS64);
case 0:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Index));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Index));
rn = "Index";
break;
case 1:
break;
case 1:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_VPEControl));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_VPEControl));
rn = "VPEControl";
break;
case 2:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_VPEConf0));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_VPEConf0));
rn = "VPEConf0";
break;
case 3:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_VPEConf1));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_VPEConf1));
rn = "VPEConf1";
break;
case 4:
break;
case 7:
check_insn(env, ctx, ASE_MT);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_VPEOpt));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_VPEOpt));
rn = "VPEOpt";
break;
default:
case 5:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_PageMask));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_PageMask));
rn = "PageMask";
break;
case 1:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_PageGrain));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_PageGrain));
rn = "PageGrain";
break;
default:
case 6:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Wired));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Wired));
rn = "Wired";
break;
case 1:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSConf0));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSConf0));
rn = "SRSConf0";
break;
case 2:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSConf1));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSConf1));
rn = "SRSConf1";
break;
case 3:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSConf2));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSConf2));
rn = "SRSConf2";
break;
case 4:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSConf3));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSConf3));
rn = "SRSConf3";
break;
case 5:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSConf4));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSConf4));
rn = "SRSConf4";
break;
default:
switch (sel) {
case 0:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_HWREna));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_HWREna));
rn = "HWREna";
break;
default:
case 11:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Compare));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Compare));
rn = "Compare";
break;
/* 6,7 are implementation dependent */
case 12:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Status));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Status));
rn = "Status";
break;
case 1:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_IntCtl));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_IntCtl));
rn = "IntCtl";
break;
case 2:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSCtl));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSCtl));
rn = "SRSCtl";
break;
case 3:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_SRSMap));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_SRSMap));
rn = "SRSMap";
break;
default:
case 13:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Cause));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Cause));
rn = "Cause";
break;
default:
case 15:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_PRid));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_PRid));
rn = "PRid";
break;
case 1:
check_insn(env, ctx, ISA_MIPS32R2);
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_EBase));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_EBase));
rn = "EBase";
break;
default:
case 16:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config0));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config0));
rn = "Config";
break;
case 1:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config1));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config1));
rn = "Config1";
break;
case 2:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config2));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config2));
rn = "Config2";
break;
case 3:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config3));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config3));
rn = "Config3";
break;
/* 6,7 are implementation dependent */
case 6:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config6));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config6));
rn = "Config6";
break;
case 7:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Config7));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Config7));
rn = "Config7";
break;
default:
/* Officially reserved, but sel 0 is used for R1x000 framemask */
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Framemask));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Framemask));
rn = "Framemask";
break;
default:
case 25:
switch (sel) {
case 0:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_Performance0));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_Performance0));
rn = "Performance0";
break;
case 1:
case 2:
case 4:
case 6:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_TagLo));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_TagLo));
rn = "TagLo";
break;
case 1:
case 3:
case 5:
case 7:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_DataLo));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_DataLo));
rn = "DataLo";
break;
default:
case 2:
case 4:
case 6:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_TagHi));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_TagHi));
rn = "TagHi";
break;
case 1:
case 3:
case 5:
case 7:
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_DataHi));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_DataHi));
rn = "DataHi";
break;
default:
switch (sel) {
case 0:
/* EJTAG support */
- tcg_gen_ld_i32(r_tmp, cpu_env, offsetof(CPUState, CP0_DESAVE));
- tcg_gen_ext_i32_tl(cpu_T[0], r_tmp);
+ gen_mfc0_load32(cpu_T[0], offsetof(CPUState, CP0_DESAVE));
rn = "DESAVE";
break;
default:
/* Handle blikely not taken case */
if ((ctx->hflags & MIPS_HFLAG_BMASK) == MIPS_HFLAG_BL) {
- TCGv r_tmp = tcg_temp_new(TCG_TYPE_TL);
+ TCGv r_tmp = tcg_temp_local_new(TCG_TYPE_TL);
int l1 = gen_new_label();
MIPS_DEBUG("blikely condition (" TARGET_FMT_lx ")", ctx->pc + 4);
tcg_gen_ld_tl(r_tmp, cpu_env, offsetof(CPUState, bcond));
tcg_gen_brcondi_tl(TCG_COND_NE, r_tmp, 0, l1);
+ tcg_temp_free(r_tmp);
gen_op_save_state(ctx->hflags & ~MIPS_HFLAG_BMASK);
gen_goto_tb(ctx, 1, ctx->pc + 4);
gen_set_label(l1);
/* Conditional branch */
MIPS_DEBUG("conditional branch");
{
- TCGv r_tmp = tcg_temp_new(TCG_TYPE_TL);
+ TCGv r_tmp = tcg_temp_local_new(TCG_TYPE_TL);
int l1 = gen_new_label();
tcg_gen_ld_tl(r_tmp, cpu_env, offsetof(CPUState, bcond));
tcg_gen_brcondi_tl(TCG_COND_NE, r_tmp, 0, l1);
+ tcg_temp_free(r_tmp);
gen_goto_tb(ctx, 1, ctx->pc + 4);
gen_set_label(l1);
gen_goto_tb(ctx, 0, ctx->btarget);