Make MIPS MT implementation more cache friendly.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3981 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
ths 2008-02-12 21:01:26 +00:00
parent 577d8dd437
commit d0dc7dc327
12 changed files with 96 additions and 96 deletions

View file

@ -142,7 +142,7 @@ typedef struct mips_def_t mips_def_t;
typedef struct CPUMIPSState CPUMIPSState;
struct CPUMIPSState {
/* General integer registers */
target_ulong gpr[32][MIPS_SHADOW_SET_MAX];
target_ulong gpr[MIPS_SHADOW_SET_MAX][32];
/* Special registers */
target_ulong PC[MIPS_TC_MAX];
#if TARGET_LONG_BITS > HOST_LONG_BITS
@ -150,9 +150,9 @@ struct CPUMIPSState {
target_ulong t1;
target_ulong t2;
#endif
target_ulong HI[MIPS_DSP_ACC][MIPS_TC_MAX];
target_ulong LO[MIPS_DSP_ACC][MIPS_TC_MAX];
target_ulong ACX[MIPS_DSP_ACC][MIPS_TC_MAX];
target_ulong HI[MIPS_TC_MAX][MIPS_DSP_ACC];
target_ulong LO[MIPS_TC_MAX][MIPS_DSP_ACC];
target_ulong ACX[MIPS_TC_MAX][MIPS_DSP_ACC];
target_ulong DSPControl[MIPS_TC_MAX];
CPUMIPSMVPContext *mvp;

View file

@ -255,25 +255,25 @@ void op_dup_T0 (void)
void op_load_HI (void)
{
T0 = env->HI[PARAM1][env->current_tc];
T0 = env->HI[env->current_tc][PARAM1];
FORCE_RET();
}
void op_store_HI (void)
{
env->HI[PARAM1][env->current_tc] = T0;
env->HI[env->current_tc][PARAM1] = T0;
FORCE_RET();
}
void op_load_LO (void)
{
T0 = env->LO[PARAM1][env->current_tc];
T0 = env->LO[env->current_tc][PARAM1];
FORCE_RET();
}
void op_store_LO (void)
{
env->LO[PARAM1][env->current_tc] = T0;
env->LO[env->current_tc][PARAM1] = T0;
FORCE_RET();
}
@ -368,8 +368,8 @@ void op_div (void)
void op_div (void)
{
if (T1 != 0) {
env->LO[0][env->current_tc] = (int32_t)((int64_t)(int32_t)T0 / (int32_t)T1);
env->HI[0][env->current_tc] = (int32_t)((int64_t)(int32_t)T0 % (int32_t)T1);
env->LO[env->current_tc][0] = (int32_t)((int64_t)(int32_t)T0 / (int32_t)T1);
env->HI[env->current_tc][0] = (int32_t)((int64_t)(int32_t)T0 % (int32_t)T1);
}
FORCE_RET();
}
@ -378,8 +378,8 @@ void op_div (void)
void op_divu (void)
{
if (T1 != 0) {
env->LO[0][env->current_tc] = (int32_t)((uint32_t)T0 / (uint32_t)T1);
env->HI[0][env->current_tc] = (int32_t)((uint32_t)T0 % (uint32_t)T1);
env->LO[env->current_tc][0] = (int32_t)((uint32_t)T0 / (uint32_t)T1);
env->HI[env->current_tc][0] = (int32_t)((uint32_t)T0 % (uint32_t)T1);
}
FORCE_RET();
}
@ -447,8 +447,8 @@ void op_ddivu (void)
void op_ddivu (void)
{
if (T1 != 0) {
env->LO[0][env->current_tc] = T0 / T1;
env->HI[0][env->current_tc] = T0 % T1;
env->LO[env->current_tc][0] = T0 / T1;
env->HI[env->current_tc][0] = T0 % T1;
}
FORCE_RET();
}
@ -869,26 +869,26 @@ void op_mulshiu (void)
static always_inline uint64_t get_HILO (void)
{
return ((uint64_t)env->HI[0][env->current_tc] << 32) |
((uint64_t)(uint32_t)env->LO[0][env->current_tc]);
return ((uint64_t)env->HI[env->current_tc][0] << 32) |
((uint64_t)(uint32_t)env->LO[env->current_tc][0]);
}
static always_inline void set_HILO (uint64_t HILO)
{
env->LO[0][env->current_tc] = (int32_t)(HILO & 0xFFFFFFFF);
env->HI[0][env->current_tc] = (int32_t)(HILO >> 32);
env->LO[env->current_tc][0] = (int32_t)(HILO & 0xFFFFFFFF);
env->HI[env->current_tc][0] = (int32_t)(HILO >> 32);
}
static always_inline void set_HIT0_LO (uint64_t HILO)
{
env->LO[0][env->current_tc] = (int32_t)(HILO & 0xFFFFFFFF);
T0 = env->HI[0][env->current_tc] = (int32_t)(HILO >> 32);
env->LO[env->current_tc][0] = (int32_t)(HILO & 0xFFFFFFFF);
T0 = env->HI[env->current_tc][0] = (int32_t)(HILO >> 32);
}
static always_inline void set_HI_LOT0 (uint64_t HILO)
{
T0 = env->LO[0][env->current_tc] = (int32_t)(HILO & 0xFFFFFFFF);
env->HI[0][env->current_tc] = (int32_t)(HILO >> 32);
T0 = env->LO[env->current_tc][0] = (int32_t)(HILO & 0xFFFFFFFF);
env->HI[env->current_tc][0] = (int32_t)(HILO >> 32);
}
void op_mult (void)
@ -1029,13 +1029,13 @@ void op_mulshiu (void)
#if defined(TARGET_MIPS64)
void op_dmult (void)
{
CALL_FROM_TB4(muls64, &(env->LO[0][env->current_tc]), &(env->HI[0][env->current_tc]), T0, T1);
CALL_FROM_TB4(muls64, &(env->LO[env->current_tc][0]), &(env->HI[env->current_tc][0]), T0, T1);
FORCE_RET();
}
void op_dmultu (void)
{
CALL_FROM_TB4(mulu64, &(env->LO[0][env->current_tc]), &(env->HI[0][env->current_tc]), T0, T1);
CALL_FROM_TB4(mulu64, &(env->LO[env->current_tc][0]), &(env->HI[env->current_tc][0]), T0, T1);
FORCE_RET();
}
#endif
@ -1044,14 +1044,14 @@ void op_dmultu (void)
void op_movn (void)
{
if (T1 != 0)
env->gpr[PARAM1][env->current_tc] = T0;
env->gpr[env->current_tc][PARAM1] = T0;
FORCE_RET();
}
void op_movz (void)
{
if (T1 == 0)
env->gpr[PARAM1][env->current_tc] = T0;
env->gpr[env->current_tc][PARAM1] = T0;
FORCE_RET();
}

View file

@ -163,25 +163,25 @@ void do_dclz (void)
#if TARGET_LONG_BITS > HOST_LONG_BITS
static always_inline uint64_t get_HILO (void)
{
return (env->HI[0][env->current_tc] << 32) | (uint32_t)env->LO[0][env->current_tc];
return (env->HI[env->current_tc][0] << 32) | (uint32_t)env->LO[env->current_tc][0];
}
static always_inline void set_HILO (uint64_t HILO)
{
env->LO[0][env->current_tc] = (int32_t)HILO;
env->HI[0][env->current_tc] = (int32_t)(HILO >> 32);
env->LO[env->current_tc][0] = (int32_t)HILO;
env->HI[env->current_tc][0] = (int32_t)(HILO >> 32);
}
static always_inline void set_HIT0_LO (uint64_t HILO)
{
env->LO[0][env->current_tc] = (int32_t)(HILO & 0xFFFFFFFF);
T0 = env->HI[0][env->current_tc] = (int32_t)(HILO >> 32);
env->LO[env->current_tc][0] = (int32_t)(HILO & 0xFFFFFFFF);
T0 = env->HI[env->current_tc][0] = (int32_t)(HILO >> 32);
}
static always_inline void set_HI_LOT0 (uint64_t HILO)
{
T0 = env->LO[0][env->current_tc] = (int32_t)(HILO & 0xFFFFFFFF);
env->HI[0][env->current_tc] = (int32_t)(HILO >> 32);
T0 = env->LO[env->current_tc][0] = (int32_t)(HILO & 0xFFFFFFFF);
env->HI[env->current_tc][0] = (int32_t)(HILO >> 32);
}
void do_mult (void)
@ -303,8 +303,8 @@ void do_div (void)
{
/* 64bit datatypes because we may see overflow/underflow. */
if (T1 != 0) {
env->LO[0][env->current_tc] = (int32_t)((int64_t)(int32_t)T0 / (int32_t)T1);
env->HI[0][env->current_tc] = (int32_t)((int64_t)(int32_t)T0 % (int32_t)T1);
env->LO[env->current_tc][0] = (int32_t)((int64_t)(int32_t)T0 / (int32_t)T1);
env->HI[env->current_tc][0] = (int32_t)((int64_t)(int32_t)T0 % (int32_t)T1);
}
}
#endif
@ -316,12 +316,12 @@ void do_ddiv (void)
int64_t arg0 = (int64_t)T0;
int64_t arg1 = (int64_t)T1;
if (arg0 == ((int64_t)-1 << 63) && arg1 == (int64_t)-1) {
env->LO[0][env->current_tc] = arg0;
env->HI[0][env->current_tc] = 0;
env->LO[env->current_tc][0] = arg0;
env->HI[env->current_tc][0] = 0;
} else {
lldiv_t res = lldiv(arg0, arg1);
env->LO[0][env->current_tc] = res.quot;
env->HI[0][env->current_tc] = res.rem;
env->LO[env->current_tc][0] = res.quot;
env->HI[env->current_tc][0] = res.rem;
}
}
}
@ -330,8 +330,8 @@ void do_ddiv (void)
void do_ddivu (void)
{
if (T1 != 0) {
env->LO[0][env->current_tc] = T0 / T1;
env->HI[0][env->current_tc] = T0 % T1;
env->LO[env->current_tc][0] = T0 / T1;
env->HI[env->current_tc][0] = T0 % T1;
}
}
#endif
@ -627,21 +627,21 @@ void do_pmon (int function)
function /= 2;
switch (function) {
case 2: /* TODO: char inbyte(int waitflag); */
if (env->gpr[4][env->current_tc] == 0)
env->gpr[2][env->current_tc] = -1;
if (env->gpr[env->current_tc][4] == 0)
env->gpr[env->current_tc][2] = -1;
/* Fall through */
case 11: /* TODO: char inbyte (void); */
env->gpr[2][env->current_tc] = -1;
env->gpr[env->current_tc][2] = -1;
break;
case 3:
case 12:
printf("%c", (char)(env->gpr[4][env->current_tc] & 0xFF));
printf("%c", (char)(env->gpr[env->current_tc][4] & 0xFF));
break;
case 17:
break;
case 158:
{
unsigned char *fmt = (void *)(unsigned long)env->gpr[4][env->current_tc];
unsigned char *fmt = (void *)(unsigned long)env->gpr[env->current_tc][4];
printf("%s", fmt);
}
break;

View file

@ -21,31 +21,31 @@
#if defined(REG)
void glue(op_load_gpr_T0_gpr, REG) (void)
{
T0 = env->gpr[REG][env->current_tc];
T0 = env->gpr[env->current_tc][REG];
FORCE_RET();
}
void glue(op_store_T0_gpr_gpr, REG) (void)
{
env->gpr[REG][env->current_tc] = T0;
env->gpr[env->current_tc][REG] = T0;
FORCE_RET();
}
void glue(op_load_gpr_T1_gpr, REG) (void)
{
T1 = env->gpr[REG][env->current_tc];
T1 = env->gpr[env->current_tc][REG];
FORCE_RET();
}
void glue(op_store_T1_gpr_gpr, REG) (void)
{
env->gpr[REG][env->current_tc] = T1;
env->gpr[env->current_tc][REG] = T1;
FORCE_RET();
}
void glue(op_load_gpr_T2_gpr, REG) (void)
{
T2 = env->gpr[REG][env->current_tc];
T2 = env->gpr[env->current_tc][REG];
FORCE_RET();
}

View file

@ -6811,7 +6811,7 @@ void dump_fpu (CPUState *env)
{
if (loglevel) {
fprintf(logfile, "pc=0x" TARGET_FMT_lx " HI=0x" TARGET_FMT_lx " LO=0x" TARGET_FMT_lx " ds %04x " TARGET_FMT_lx " %d\n",
env->PC[env->current_tc], env->HI[0][env->current_tc], env->LO[0][env->current_tc], env->hflags, env->btarget, env->bcond);
env->PC[env->current_tc], env->HI[env->current_tc][0], env->LO[env->current_tc][0], env->hflags, env->btarget, env->bcond);
fpu_dump_state(env, logfile, fprintf, 0);
}
}
@ -6830,16 +6830,16 @@ void cpu_mips_check_sign_extensions (CPUState *env, FILE *f,
if (!SIGN_EXT_P(env->PC[env->current_tc]))
cpu_fprintf(f, "BROKEN: pc=0x" TARGET_FMT_lx "\n", env->PC[env->current_tc]);
if (!SIGN_EXT_P(env->HI[0][env->current_tc]))
cpu_fprintf(f, "BROKEN: HI=0x" TARGET_FMT_lx "\n", env->HI[0][env->current_tc]);
if (!SIGN_EXT_P(env->LO[0][env->current_tc]))
cpu_fprintf(f, "BROKEN: LO=0x" TARGET_FMT_lx "\n", env->LO[0][env->current_tc]);
if (!SIGN_EXT_P(env->HI[env->current_tc][0]))
cpu_fprintf(f, "BROKEN: HI=0x" TARGET_FMT_lx "\n", env->HI[env->current_tc][0]);
if (!SIGN_EXT_P(env->LO[env->current_tc][0]))
cpu_fprintf(f, "BROKEN: LO=0x" TARGET_FMT_lx "\n", env->LO[env->current_tc][0]);
if (!SIGN_EXT_P(env->btarget))
cpu_fprintf(f, "BROKEN: btarget=0x" TARGET_FMT_lx "\n", env->btarget);
for (i = 0; i < 32; i++) {
if (!SIGN_EXT_P(env->gpr[i][env->current_tc]))
cpu_fprintf(f, "BROKEN: %s=0x" TARGET_FMT_lx "\n", regnames[i], env->gpr[i][env->current_tc]);
if (!SIGN_EXT_P(env->gpr[env->current_tc][i]))
cpu_fprintf(f, "BROKEN: %s=0x" TARGET_FMT_lx "\n", regnames[i], env->gpr[env->current_tc][i]);
}
if (!SIGN_EXT_P(env->CP0_EPC))
@ -6860,7 +6860,7 @@ void cpu_dump_state (CPUState *env, FILE *f,
for (i = 0; i < 32; i++) {
if ((i & 3) == 0)
cpu_fprintf(f, "GPR%02d:", i);
cpu_fprintf(f, " %s " TARGET_FMT_lx, regnames[i], env->gpr[i][env->current_tc]);
cpu_fprintf(f, " %s " TARGET_FMT_lx, regnames[i], env->gpr[env->current_tc][i]);
if ((i & 3) == 3)
cpu_fprintf(f, "\n");
}