target: e2k: Fix based preg.

This commit is contained in:
Denis Drakhnia 2020-12-05 21:35:55 +02:00 committed by Denis Drakhnia
parent a357666e69
commit 1ad7988e9a
5 changed files with 51 additions and 37 deletions

View File

@ -270,20 +270,10 @@ static inline target_ulong do_decode(DisasContext *ctx, CPUState *cs)
*/
static inline void do_execute(DisasContext *ctx)
{
unsigned int i;
e2k_plu_execute(ctx);
e2k_control_gen(ctx);
for (i = 0; i < 6; i++) {
ctx->al_results[i].type = AL_RESULT_NONE;
if (ctx->bundle.als_present[i]) {
e2k_alc_execute(ctx, i);
}
}
e2k_control_execute(ctx);
e2k_alc_execute(ctx);
e2k_aau_execute(ctx);
e2k_plu_execute(ctx);
}
/*
@ -299,7 +289,7 @@ static inline void do_commit(DisasContext *ctx)
e2k_alc_commit(ctx);
e2k_aau_commit(ctx);
e2k_plu_commit(ctx);
e2k_commit_stubs(ctx);
e2k_stubs_commit(ctx);
}
static inline void do_branch(DisasContext *ctx, target_ulong pc_next)

View File

@ -406,17 +406,15 @@ static inline void e2k_gen_cond_i64(DisasContext *ctx, TCGv_i64 ret,
tcg_temp_free_i32(t0);
}
void e2k_control_gen(DisasContext *dc);
void e2k_control_execute(DisasContext *ctx);
void e2k_stubs_commit(DisasContext *ctx);
void e2k_alc_execute(DisasContext *ctx, int index);
void e2k_alc_commit(DisasContext *dc);
void e2k_alc_execute(DisasContext *ctx);
void e2k_alc_commit(DisasContext *ctx);
void e2k_aau_execute(DisasContext *ctx);
void e2k_aau_commit(DisasContext *ctx);
void e2k_plu_execute(DisasContext *ctx);
void e2k_plu_commit(DisasContext *ctx);
void e2k_commit_stubs(DisasContext *dc);
#endif

View File

@ -2293,7 +2293,7 @@ static void execute_ext_0f(DisasContext *ctx, Instr *instr)
e2k_tr_gen_exception(ctx, E2K_EXCP_ILLOPC);
}
void e2k_alc_execute(DisasContext *ctx, int chan)
static void chan_execute(DisasContext *ctx, int chan)
{
const UnpackedBundle *bundle = &ctx->bundle;
uint16_t rlp = find_cond(ctx, chan);
@ -2354,6 +2354,19 @@ void e2k_alc_execute(DisasContext *ctx, int chan)
ctx->al_cond[chan].value = cond;
}
void e2k_alc_execute(DisasContext *ctx)
{
unsigned int i;
for (i = 0; i < 6; i++) {
ctx->al_results[i].type = AL_RESULT_NONE;
if (ctx->bundle.als_present[i]) {
chan_execute(ctx, i);
}
}
}
void e2k_alc_commit(DisasContext *ctx)
{
unsigned int i;

View File

@ -124,7 +124,7 @@ static inline void gen_cur_dec(DisasContext *ctx, TCGv_i32 ret, int cond,
tcg_temp_free_i32(t0);
}
void e2k_commit_stubs(DisasContext *ctx)
void e2k_stubs_commit(DisasContext *ctx)
{
uint32_t ss = ctx->bundle.ss;
// unsigned int vfdi = (ss & 0x04000000) >> 26;
@ -143,7 +143,10 @@ void e2k_commit_stubs(DisasContext *ctx)
}
if (abp) {
gen_cur_dec(ctx, e2k_cs.pcur, abp, e2k_cs.pcur, 1, e2k_cs.psize);
TCGv_i32 t0 = tcg_temp_local_new_i32();
tcg_gen_addi_i32(t0, e2k_cs.psize, 1);
gen_cur_dec(ctx, e2k_cs.pcur, abp, e2k_cs.pcur, 1, t0);
tcg_temp_free_i32(t0);
}
if (abn) {
@ -617,7 +620,7 @@ static void gen_jmp(DisasContext *dc)
}
}
void e2k_control_gen(DisasContext *dc)
void e2k_control_execute(DisasContext *dc)
{
dc->ct.type = CT_NONE;

View File

@ -3,30 +3,40 @@
#include "exec/log.h"
#include "translate.h"
static void gen_preg_offset(TCGv_i64 ret, int reg)
static inline void gen_preg_index(TCGv_i32 ret, int idx)
{
assert(reg < 32);
TCGv_i32 zero = tcg_const_i32(0);
TCGv_i32 pf_size = tcg_const_i32(E2K_PR_COUNT);
TCGv_i32 i = tcg_const_i32(idx);
TCGv_i32 t0 = tcg_temp_new_i32();
TCGv_i32 t1 = tcg_temp_new_i32();
TCGv_i32 t2 = tcg_temp_new_i32();
TCGv_i32 t3 = tcg_temp_new_i32();
tcg_gen_addi_i32(t0, e2k_cs.pcur, reg);
tcg_gen_movcond_i32(TCG_COND_NE, t1, e2k_cs.psize, zero,
e2k_cs.psize, pf_size);
tcg_gen_remu_i32(t2, t0, t1);
tcg_gen_muli_i32(t3, t2, 2);
tcg_gen_extu_i32_i64(ret, t3);
assert(idx < 32);
tcg_gen_addi_i32(t0, e2k_cs.psize, 1);
tcg_gen_addi_i32(t1, e2k_cs.pcur, idx);
tcg_gen_remu_i32(t2, t1, t0);
tcg_gen_movi_i32(t3, idx);
tcg_gen_movcond_i32(TCG_COND_LEU, ret, i, e2k_cs.psize, t2, t3);
tcg_temp_free_i32(t3);
tcg_temp_free_i32(t2);
tcg_temp_free_i32(t1);
tcg_temp_free_i32(t0);
tcg_temp_free_i32(pf_size);
tcg_temp_free_i32(zero);
tcg_temp_free_i32(i);
}
static void gen_preg_offset(TCGv_i64 ret, int idx)
{
TCGv_i32 t0 = tcg_temp_new_i32();
TCGv_i32 t1 = tcg_temp_new_i32();
gen_preg_index(t0, idx);
tcg_gen_muli_i32(t1, t0, 2);
tcg_gen_extu_i32_i64(ret, t1);
tcg_temp_free_i32(t1);
tcg_temp_free_i32(t0);
}
static void gen_preg_clear(TCGv_i64 ret, TCGv_i64 offset)