summaryrefslogtreecommitdiff
path: root/target-mips
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2008-02-12 21:01:26 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2008-02-12 21:01:26 +0000
commitd0dc7dc3274a88db1c9941614454ed842d62cf91 (patch)
tree46e369f2d52daecef62ef93665fdc6dbb21c3b82 /target-mips
parent577d8dd43779f6ae75cb1b49606443ddab870bda (diff)
downloadqemu-d0dc7dc3274a88db1c9941614454ed842d62cf91.zip
Make MIPS MT implementation more cache friendly.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3981 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-mips')
-rw-r--r--target-mips/cpu.h8
-rw-r--r--target-mips/op.c44
-rw-r--r--target-mips/op_helper.c40
-rw-r--r--target-mips/op_template.c10
-rw-r--r--target-mips/translate.c16
5 files changed, 59 insertions, 59 deletions
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 8b6b8bdb0e..4e0a09d761 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -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;
diff --git a/target-mips/op.c b/target-mips/op.c
index cece7f1f23..c5187fe9a3 100644
--- a/target-mips/op.c
+++ b/target-mips/op.c
@@ -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();
}
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index 07353567de..26420aa3cb 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -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;
diff --git a/target-mips/op_template.c b/target-mips/op_template.c
index 48b91e1be3..c683330024 100644
--- a/target-mips/op_template.c
+++ b/target-mips/op_template.c
@@ -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();
}
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 1231c00cd3..65f0ba9041 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -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");
}