diff options
Diffstat (limited to 'target-mips/fop_template.c')
-rw-r--r-- | target-mips/fop_template.c | 123 |
1 files changed, 77 insertions, 46 deletions
diff --git a/target-mips/fop_template.c b/target-mips/fop_template.c index 4ebb46bff5..bb288f11ee 100644 --- a/target-mips/fop_template.c +++ b/target-mips/fop_template.c @@ -19,75 +19,103 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#if defined(SFREG) +#if defined(FREG) -#define OP_WLOAD_FREG(treg, tregname, SFREG) \ - void glue(glue(op_load_fpr_,tregname), SFREG) (void) \ - { \ - treg = FPR_W(env, SFREG); \ - RETURN(); \ +#define OP_WLOAD_FREG(treg, tregname, FREG) \ + void glue(glue(op_load_fpr_,tregname), FREG) (void) \ + { \ + treg = env->fpr[FREG].fs[FP_ENDIAN_IDX]; \ + RETURN(); \ } -#define OP_WSTORE_FREG(treg, tregname, SFREG) \ - void glue(glue(op_store_fpr_,tregname), SFREG) (void)\ - { \ - FPR_W(env, SFREG) = treg; \ - RETURN(); \ +#define OP_WSTORE_FREG(treg, tregname, FREG) \ + void glue(glue(op_store_fpr_,tregname), FREG) (void) \ + { \ + env->fpr[FREG].fs[FP_ENDIAN_IDX] = treg; \ + RETURN(); \ } -/* WT0 = SFREG.w: op_load_fpr_WT0_fprSFREG */ -OP_WLOAD_FREG(WT0, WT0_fpr, SFREG) -/* SFREG.w = WT0: op_store_fpr_WT0_fprSFREG */ -OP_WSTORE_FREG(WT0, WT0_fpr, SFREG) +/* WT0 = FREG.w: op_load_fpr_WT0_fprFREG */ +OP_WLOAD_FREG(WT0, WT0_fpr, FREG) +/* FREG.w = WT0: op_store_fpr_WT0_fprFREG */ +OP_WSTORE_FREG(WT0, WT0_fpr, FREG) + +OP_WLOAD_FREG(WT1, WT1_fpr, FREG) +OP_WSTORE_FREG(WT1, WT1_fpr, FREG) + +OP_WLOAD_FREG(WT2, WT2_fpr, FREG) +OP_WSTORE_FREG(WT2, WT2_fpr, FREG) + +#define OP_DLOAD_FREG(treg, tregname, FREG) \ + void glue(glue(op_load_fpr_,tregname), FREG) (void) \ + { \ + if (env->CP0_Status & (1 << CP0St_FR)) \ + treg = env->fpr[FREG].fd; \ + else \ + treg = (uint64_t)(env->fpr[FREG | 1].fs[FP_ENDIAN_IDX]) << 32 | \ + env->fpr[FREG & ~1].fs[FP_ENDIAN_IDX]; \ + RETURN(); \ + } -OP_WLOAD_FREG(WT1, WT1_fpr, SFREG) -OP_WSTORE_FREG(WT1, WT1_fpr, SFREG) +#define OP_DSTORE_FREG(treg, tregname, FREG) \ + void glue(glue(op_store_fpr_,tregname), FREG) (void) \ + { \ + if (env->CP0_Status & (1 << CP0St_FR)) \ + env->fpr[FREG].fd = treg; \ + else { \ + env->fpr[FREG | 1].fs[FP_ENDIAN_IDX] = treg >> 32; \ + env->fpr[FREG & ~1].fs[FP_ENDIAN_IDX] = treg; \ + } \ + RETURN(); \ + } -OP_WLOAD_FREG(WT2, WT2_fpr, SFREG) -OP_WSTORE_FREG(WT2, WT2_fpr, SFREG) +OP_DLOAD_FREG(DT0, DT0_fpr, FREG) +OP_DSTORE_FREG(DT0, DT0_fpr, FREG) -#endif +OP_DLOAD_FREG(DT1, DT1_fpr, FREG) +OP_DSTORE_FREG(DT1, DT1_fpr, FREG) -#if defined(DFREG) +OP_DLOAD_FREG(DT2, DT2_fpr, FREG) +OP_DSTORE_FREG(DT2, DT2_fpr, FREG) -#define OP_DLOAD_FREG(treg, tregname, DFREG) \ - void glue(glue(op_load_fpr_,tregname), DFREG) (void) \ - { \ - treg = FPR_D(env, DFREG); \ - RETURN(); \ +#define OP_PSLOAD_FREG(treg, tregname, FREG) \ + void glue(glue(op_load_fpr_,tregname), FREG) (void) \ + { \ + treg = env->fpr[FREG].fs[!FP_ENDIAN_IDX]; \ + RETURN(); \ } -#define OP_DSTORE_FREG(treg, tregname, DFREG) \ - void glue(glue(op_store_fpr_,tregname), DFREG) (void)\ - { \ - FPR_D(env, DFREG) = treg; \ - RETURN(); \ +#define OP_PSSTORE_FREG(treg, tregname, FREG) \ + void glue(glue(op_store_fpr_,tregname), FREG) (void) \ + { \ + env->fpr[FREG].fs[!FP_ENDIAN_IDX] = treg; \ + RETURN(); \ } -OP_DLOAD_FREG(DT0, DT0_fpr, DFREG) -OP_DSTORE_FREG(DT0, DT0_fpr, DFREG) +OP_PSLOAD_FREG(WTH0, WTH0_fpr, FREG) +OP_PSSTORE_FREG(WTH0, WTH0_fpr, FREG) -OP_DLOAD_FREG(DT1, DT1_fpr, DFREG) -OP_DSTORE_FREG(DT1, DT1_fpr, DFREG) +OP_PSLOAD_FREG(WTH1, WTH1_fpr, FREG) +OP_PSSTORE_FREG(WTH1, WTH1_fpr, FREG) -OP_DLOAD_FREG(DT2, DT2_fpr, DFREG) -OP_DSTORE_FREG(DT2, DT2_fpr, DFREG) +OP_PSLOAD_FREG(WTH2, WTH2_fpr, FREG) +OP_PSSTORE_FREG(WTH2, WTH2_fpr, FREG) #endif #if defined (FTN) -#define SET_RESET(treg, tregname) \ +#define SET_RESET(treg, tregname) \ void glue(op_set, tregname)(void) \ - { \ - treg = PARAM1; \ - RETURN(); \ - } \ + { \ + treg = PARAM1; \ + RETURN(); \ + } \ void glue(op_reset, tregname)(void) \ - { \ - treg = 0; \ - RETURN(); \ - } \ + { \ + treg = 0; \ + RETURN(); \ + } SET_RESET(WT0, _WT0) SET_RESET(WT1, _WT1) @@ -95,6 +123,9 @@ SET_RESET(WT2, _WT2) SET_RESET(DT0, _DT0) SET_RESET(DT1, _DT1) SET_RESET(DT2, _DT2) +SET_RESET(WTH0, _WTH0) +SET_RESET(WTH1, _WTH1) +SET_RESET(WTH2, _WTH2) #undef SET_RESET #endif |