Skip to content

Commit

Permalink
target-tricore: Several translator and cpu model fixes
Browse files Browse the repository at this point in the history
Fix tc1796 cpu model using wrong ISA version.
Fix cond_add sometimes writing back wrong result.
Fix RCR_SEL and RCR_SELN using wrong registers for result and cond.

Signed-off-by: Bastian Koppelmann <[email protected]>
  • Loading branch information
bkoppelmann committed Jan 26, 2015
1 parent 452e3d4 commit 5f30046
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion target-tricore/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static void tc1796_initfn(Object *obj)
{
TriCoreCPU *cpu = TRICORE_CPU(obj);

set_feature(&cpu->env, TRICORE_FEATURE_13);
set_feature(&cpu->env, TRICORE_FEATURE_131);
}

static void aurix_initfn(Object *obj)
Expand Down
1 change: 1 addition & 0 deletions target-tricore/op_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ target_ulong helper_mul_suov(CPUTriCoreState *env, target_ulong r1,
int64_t t1 = extract64(r1, 0, 32);
int64_t t2 = extract64(r2, 0, 32);
int64_t result = t1 * t2;

return suov32(env, result);
}

Expand Down
6 changes: 3 additions & 3 deletions target-tricore/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ static inline void gen_cond_add(TCGCond cond, TCGv r1, TCGv r2, TCGv r3,
tcg_gen_and_tl(temp, temp, mask);
tcg_gen_or_tl(cpu_PSW_SAV, temp, cpu_PSW_SAV);
/* write back result */
tcg_gen_movcond_tl(cond, r3, r4, t0, result, r3);
tcg_gen_movcond_tl(cond, r3, r4, t0, result, r1);

tcg_temp_free(t0);
tcg_temp_free(temp);
Expand Down Expand Up @@ -3898,15 +3898,15 @@ static void decode_rcr_cond_select(CPUTriCoreState *env, DisasContext *ctx)
case OPC2_32_RCR_SEL:
temp = tcg_const_i32(0);
temp2 = tcg_const_i32(const9);
tcg_gen_movcond_tl(TCG_COND_NE, cpu_gpr_d[r3], cpu_gpr_d[r4], temp,
tcg_gen_movcond_tl(TCG_COND_NE, cpu_gpr_d[r4], cpu_gpr_d[r3], temp,
cpu_gpr_d[r1], temp2);
tcg_temp_free(temp);
tcg_temp_free(temp2);
break;
case OPC2_32_RCR_SELN:
temp = tcg_const_i32(0);
temp2 = tcg_const_i32(const9);
tcg_gen_movcond_tl(TCG_COND_EQ, cpu_gpr_d[r3], cpu_gpr_d[r4], temp,
tcg_gen_movcond_tl(TCG_COND_EQ, cpu_gpr_d[r4], cpu_gpr_d[r3], temp,
cpu_gpr_d[r1], temp2);
tcg_temp_free(temp);
tcg_temp_free(temp2);
Expand Down

0 comments on commit 5f30046

Please sign in to comment.