Commit 5e755519ac9d867f7da13f58a9d0c262db82e14c

Authored by ths
1 parent acf930aa

Don't check the FPU state for each FPU instruction, use hflags to

handle this per-tb.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2896 c046a42c-6fe2-441c-8c8c-71466251a162
target-mips/cpu.h
@@ -258,9 +258,11 @@ struct CPUMIPSState { @@ -258,9 +258,11 @@ struct CPUMIPSState {
258 #define MIPS_HFLAG_TMASK 0x007F 258 #define MIPS_HFLAG_TMASK 0x007F
259 #define MIPS_HFLAG_MODE 0x001F /* execution modes */ 259 #define MIPS_HFLAG_MODE 0x001F /* execution modes */
260 #define MIPS_HFLAG_UM 0x0001 /* user mode */ 260 #define MIPS_HFLAG_UM 0x0001 /* user mode */
261 -#define MIPS_HFLAG_DM 0x0008 /* Debug mode */  
262 -#define MIPS_HFLAG_SM 0x0010 /* Supervisor mode */  
263 -#define MIPS_HFLAG_64 0x0020 /* 64-bit instructions enabled */ 261 +#define MIPS_HFLAG_DM 0x0002 /* Debug mode */
  262 +#define MIPS_HFLAG_SM 0x0004 /* Supervisor mode */
  263 +#define MIPS_HFLAG_64 0x0008 /* 64-bit instructions enabled */
  264 +#define MIPS_HFLAG_FPU 0x0010 /* FPU enabled */
  265 +#define MIPS_HFLAG_F64 0x0020 /* 64-bit FPU enabled */
264 #define MIPS_HFLAG_RE 0x0040 /* Reversed endianness */ 266 #define MIPS_HFLAG_RE 0x0040 /* Reversed endianness */
265 /* If translation is interrupted between the branch instruction and 267 /* If translation is interrupted between the branch instruction and
266 * the delay slot, record what type of branch it is so that we can 268 * the delay slot, record what type of branch it is so that we can
target-mips/fop_template.c
@@ -49,7 +49,7 @@ OP_WSTORE_FREG(WT2, WT2_fpr, FREG) @@ -49,7 +49,7 @@ OP_WSTORE_FREG(WT2, WT2_fpr, FREG)
49 #define OP_DLOAD_FREG(treg, tregname, FREG) \ 49 #define OP_DLOAD_FREG(treg, tregname, FREG) \
50 void glue(glue(op_load_fpr_,tregname), FREG) (void) \ 50 void glue(glue(op_load_fpr_,tregname), FREG) (void) \
51 { \ 51 { \
52 - if (env->CP0_Status & (1 << CP0St_FR)) \ 52 + if (env->hflags & MIPS_HFLAG_F64) \
53 treg = env->fpr[FREG].fd; \ 53 treg = env->fpr[FREG].fd; \
54 else \ 54 else \
55 treg = (uint64_t)(env->fpr[FREG | 1].fs[FP_ENDIAN_IDX]) << 32 | \ 55 treg = (uint64_t)(env->fpr[FREG | 1].fs[FP_ENDIAN_IDX]) << 32 | \
@@ -60,7 +60,7 @@ OP_WSTORE_FREG(WT2, WT2_fpr, FREG) @@ -60,7 +60,7 @@ OP_WSTORE_FREG(WT2, WT2_fpr, FREG)
60 #define OP_DSTORE_FREG(treg, tregname, FREG) \ 60 #define OP_DSTORE_FREG(treg, tregname, FREG) \
61 void glue(glue(op_store_fpr_,tregname), FREG) (void) \ 61 void glue(glue(op_store_fpr_,tregname), FREG) (void) \
62 { \ 62 { \
63 - if (env->CP0_Status & (1 << CP0St_FR)) \ 63 + if (env->hflags & MIPS_HFLAG_F64) \
64 env->fpr[FREG].fd = treg; \ 64 env->fpr[FREG].fd = treg; \
65 else { \ 65 else { \
66 env->fpr[FREG | 1].fs[FP_ENDIAN_IDX] = treg >> 32; \ 66 env->fpr[FREG | 1].fs[FP_ENDIAN_IDX] = treg >> 32; \
target-mips/op.c
@@ -1349,8 +1349,7 @@ void op_mtc0_status (void) @@ -1349,8 +1349,7 @@ void op_mtc0_status (void)
1349 uint32_t val, old; 1349 uint32_t val, old;
1350 uint32_t mask = env->Status_rw_bitmask; 1350 uint32_t mask = env->Status_rw_bitmask;
1351 1351
1352 - /* No reverse endianness, no MDMX/DSP, no 64bit ops  
1353 - implemented. */ 1352 + /* No reverse endianness, no MDMX/DSP implemented. */
1354 val = T0 & mask; 1353 val = T0 & mask;
1355 old = env->CP0_Status; 1354 old = env->CP0_Status;
1356 if (!(val & (1 << CP0St_EXL)) && 1355 if (!(val & (1 << CP0St_EXL)) &&
@@ -1364,6 +1363,14 @@ void op_mtc0_status (void) @@ -1364,6 +1363,14 @@ void op_mtc0_status (void)
1364 !(val & (1 << CP0St_UX))) 1363 !(val & (1 << CP0St_UX)))
1365 env->hflags &= ~MIPS_HFLAG_64; 1364 env->hflags &= ~MIPS_HFLAG_64;
1366 #endif 1365 #endif
  1366 + if (val & (1 << CP0St_CU1))
  1367 + env->hflags |= MIPS_HFLAG_FPU;
  1368 + else
  1369 + env->hflags &= ~MIPS_HFLAG_FPU;
  1370 + if (val & (1 << CP0St_FR))
  1371 + env->hflags |= MIPS_HFLAG_F64;
  1372 + else
  1373 + env->hflags &= ~MIPS_HFLAG_F64;
1367 env->CP0_Status = (env->CP0_Status & ~mask) | val; 1374 env->CP0_Status = (env->CP0_Status & ~mask) | val;
1368 if (loglevel & CPU_LOG_EXEC) 1375 if (loglevel & CPU_LOG_EXEC)
1369 CALL_FROM_TB2(do_mtc0_status_debug, old, val); 1376 CALL_FROM_TB2(do_mtc0_status_debug, old, val);
@@ -1606,41 +1613,6 @@ void op_cp0_enabled(void) @@ -1606,41 +1613,6 @@ void op_cp0_enabled(void)
1606 RETURN(); 1613 RETURN();
1607 } 1614 }
1608 1615
1609 -void op_cp1_enabled(void)  
1610 -{  
1611 - if (!(env->CP0_Status & (1 << CP0St_CU1))) {  
1612 - CALL_FROM_TB2(do_raise_exception_err, EXCP_CpU, 1);  
1613 - }  
1614 - RETURN();  
1615 -}  
1616 -  
1617 -void op_cp1_64bitmode(void)  
1618 -{  
1619 - if (!(env->CP0_Status & (1 << CP0St_FR))) {  
1620 - CALL_FROM_TB1(do_raise_exception, EXCP_RI);  
1621 - }  
1622 - RETURN();  
1623 -}  
1624 -  
1625 -/*  
1626 - * Verify if floating point register is valid; an operation is not defined  
1627 - * if bit 0 of any register specification is set and the FR bit in the  
1628 - * Status register equals zero, since the register numbers specify an  
1629 - * even-odd pair of adjacent coprocessor general registers. When the FR bit  
1630 - * in the Status register equals one, both even and odd register numbers  
1631 - * are valid. This limitation exists only for 64 bit wide (d,l,ps) registers.  
1632 - *  
1633 - * Multiple 64 bit wide registers can be checked by calling  
1634 - * gen_op_cp1_registers(freg1 | freg2 | ... | fregN);  
1635 - */  
1636 -void op_cp1_registers(void)  
1637 -{  
1638 - if (!(env->CP0_Status & (1 << CP0St_FR)) && (PARAM1 & 1)) {  
1639 - CALL_FROM_TB1(do_raise_exception, EXCP_RI);  
1640 - }  
1641 - RETURN();  
1642 -}  
1643 -  
1644 void op_cfc1 (void) 1616 void op_cfc1 (void)
1645 { 1617 {
1646 switch (T1) { 1618 switch (T1) {
target-mips/translate.c
@@ -703,6 +703,35 @@ static inline void generate_exception (DisasContext *ctx, int excp) @@ -703,6 +703,35 @@ static inline void generate_exception (DisasContext *ctx, int excp)
703 generate_exception_err (ctx, excp, 0); 703 generate_exception_err (ctx, excp, 0);
704 } 704 }
705 705
  706 +static inline void check_cp1_enabled(DisasContext *ctx)
  707 +{
  708 + if (!(ctx->hflags & MIPS_HFLAG_FPU))
  709 + generate_exception_err(ctx, EXCP_CpU, 1);
  710 +}
  711 +
  712 +static inline void check_cp1_64bitmode(DisasContext *ctx)
  713 +{
  714 + if (!(ctx->hflags & MIPS_HFLAG_F64))
  715 + generate_exception(ctx, EXCP_RI);
  716 +}
  717 +
  718 +/*
  719 + * Verify if floating point register is valid; an operation is not defined
  720 + * if bit 0 of any register specification is set and the FR bit in the
  721 + * Status register equals zero, since the register numbers specify an
  722 + * even-odd pair of adjacent coprocessor general registers. When the FR bit
  723 + * in the Status register equals one, both even and odd register numbers
  724 + * are valid. This limitation exists only for 64 bit wide (d,l,ps) registers.
  725 + *
  726 + * Multiple 64 bit wide registers can be checked by calling
  727 + * gen_op_cp1_registers(freg1 | freg2 | ... | fregN);
  728 + */
  729 +void check_cp1_registers(DisasContext *ctx, int regs)
  730 +{
  731 + if (!(ctx->hflags & MIPS_HFLAG_F64) && (regs & 1))
  732 + generate_exception(ctx, EXCP_RI);
  733 +}
  734 +
706 #if defined(CONFIG_USER_ONLY) 735 #if defined(CONFIG_USER_ONLY)
707 #define op_ldst(name) gen_op_##name##_raw() 736 #define op_ldst(name) gen_op_##name##_raw()
708 #define OP_LD_TABLE(width) 737 #define OP_LD_TABLE(width)
@@ -4243,8 +4272,8 @@ GEN_MOVCF(s); @@ -4243,8 +4272,8 @@ GEN_MOVCF(s);
4243 GEN_MOVCF(ps); 4272 GEN_MOVCF(ps);
4244 #undef GEN_MOVCF 4273 #undef GEN_MOVCF
4245 4274
4246 -static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,  
4247 - int fs, int fd, int cc) 4275 +static void gen_farith (DisasContext *ctx, uint32_t op1,
  4276 + int ft, int fs, int fd, int cc)
4248 { 4277 {
4249 const char *opn = "farith"; 4278 const char *opn = "farith";
4250 const char *condnames[] = { 4279 const char *condnames[] = {
@@ -4344,28 +4373,28 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4344,28 +4373,28 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4344 opn = "neg.s"; 4373 opn = "neg.s";
4345 break; 4374 break;
4346 case FOP(8, 16): 4375 case FOP(8, 16):
4347 - gen_op_cp1_64bitmode(); 4376 + check_cp1_64bitmode(ctx);
4348 GEN_LOAD_FREG_FTN(WT0, fs); 4377 GEN_LOAD_FREG_FTN(WT0, fs);
4349 gen_op_float_roundl_s(); 4378 gen_op_float_roundl_s();
4350 GEN_STORE_FTN_FREG(fd, DT2); 4379 GEN_STORE_FTN_FREG(fd, DT2);
4351 opn = "round.l.s"; 4380 opn = "round.l.s";
4352 break; 4381 break;
4353 case FOP(9, 16): 4382 case FOP(9, 16):
4354 - gen_op_cp1_64bitmode(); 4383 + check_cp1_64bitmode(ctx);
4355 GEN_LOAD_FREG_FTN(WT0, fs); 4384 GEN_LOAD_FREG_FTN(WT0, fs);
4356 gen_op_float_truncl_s(); 4385 gen_op_float_truncl_s();
4357 GEN_STORE_FTN_FREG(fd, DT2); 4386 GEN_STORE_FTN_FREG(fd, DT2);
4358 opn = "trunc.l.s"; 4387 opn = "trunc.l.s";
4359 break; 4388 break;
4360 case FOP(10, 16): 4389 case FOP(10, 16):
4361 - gen_op_cp1_64bitmode(); 4390 + check_cp1_64bitmode(ctx);
4362 GEN_LOAD_FREG_FTN(WT0, fs); 4391 GEN_LOAD_FREG_FTN(WT0, fs);
4363 gen_op_float_ceill_s(); 4392 gen_op_float_ceill_s();
4364 GEN_STORE_FTN_FREG(fd, DT2); 4393 GEN_STORE_FTN_FREG(fd, DT2);
4365 opn = "ceil.l.s"; 4394 opn = "ceil.l.s";
4366 break; 4395 break;
4367 case FOP(11, 16): 4396 case FOP(11, 16):
4368 - gen_op_cp1_64bitmode(); 4397 + check_cp1_64bitmode(ctx);
4369 GEN_LOAD_FREG_FTN(WT0, fs); 4398 GEN_LOAD_FREG_FTN(WT0, fs);
4370 gen_op_float_floorl_s(); 4399 gen_op_float_floorl_s();
4371 GEN_STORE_FTN_FREG(fd, DT2); 4400 GEN_STORE_FTN_FREG(fd, DT2);
@@ -4432,7 +4461,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4432,7 +4461,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4432 opn = "rsqrt.s"; 4461 opn = "rsqrt.s";
4433 break; 4462 break;
4434 case FOP(28, 16): 4463 case FOP(28, 16):
4435 - gen_op_cp1_64bitmode(); 4464 + check_cp1_64bitmode(ctx);
4436 GEN_LOAD_FREG_FTN(WT0, fs); 4465 GEN_LOAD_FREG_FTN(WT0, fs);
4437 GEN_LOAD_FREG_FTN(WT2, fd); 4466 GEN_LOAD_FREG_FTN(WT2, fd);
4438 gen_op_float_recip2_s(); 4467 gen_op_float_recip2_s();
@@ -4440,21 +4469,21 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4440,21 +4469,21 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4440 opn = "recip2.s"; 4469 opn = "recip2.s";
4441 break; 4470 break;
4442 case FOP(29, 16): 4471 case FOP(29, 16):
4443 - gen_op_cp1_64bitmode(); 4472 + check_cp1_64bitmode(ctx);
4444 GEN_LOAD_FREG_FTN(WT0, fs); 4473 GEN_LOAD_FREG_FTN(WT0, fs);
4445 gen_op_float_recip1_s(); 4474 gen_op_float_recip1_s();
4446 GEN_STORE_FTN_FREG(fd, WT2); 4475 GEN_STORE_FTN_FREG(fd, WT2);
4447 opn = "recip1.s"; 4476 opn = "recip1.s";
4448 break; 4477 break;
4449 case FOP(30, 16): 4478 case FOP(30, 16):
4450 - gen_op_cp1_64bitmode(); 4479 + check_cp1_64bitmode(ctx);
4451 GEN_LOAD_FREG_FTN(WT0, fs); 4480 GEN_LOAD_FREG_FTN(WT0, fs);
4452 gen_op_float_rsqrt1_s(); 4481 gen_op_float_rsqrt1_s();
4453 GEN_STORE_FTN_FREG(fd, WT2); 4482 GEN_STORE_FTN_FREG(fd, WT2);
4454 opn = "rsqrt1.s"; 4483 opn = "rsqrt1.s";
4455 break; 4484 break;
4456 case FOP(31, 16): 4485 case FOP(31, 16):
4457 - gen_op_cp1_64bitmode(); 4486 + check_cp1_64bitmode(ctx);
4458 GEN_LOAD_FREG_FTN(WT0, fs); 4487 GEN_LOAD_FREG_FTN(WT0, fs);
4459 GEN_LOAD_FREG_FTN(WT2, fd); 4488 GEN_LOAD_FREG_FTN(WT2, fd);
4460 gen_op_float_rsqrt2_s(); 4489 gen_op_float_rsqrt2_s();
@@ -4462,7 +4491,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4462,7 +4491,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4462 opn = "rsqrt2.s"; 4491 opn = "rsqrt2.s";
4463 break; 4492 break;
4464 case FOP(33, 16): 4493 case FOP(33, 16):
4465 - gen_op_cp1_registers(fd); 4494 + check_cp1_registers(ctx, fd);
4466 GEN_LOAD_FREG_FTN(WT0, fs); 4495 GEN_LOAD_FREG_FTN(WT0, fs);
4467 gen_op_float_cvtd_s(); 4496 gen_op_float_cvtd_s();
4468 GEN_STORE_FTN_FREG(fd, DT2); 4497 GEN_STORE_FTN_FREG(fd, DT2);
@@ -4475,14 +4504,14 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4475,14 +4504,14 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4475 opn = "cvt.w.s"; 4504 opn = "cvt.w.s";
4476 break; 4505 break;
4477 case FOP(37, 16): 4506 case FOP(37, 16):
4478 - gen_op_cp1_64bitmode(); 4507 + check_cp1_64bitmode(ctx);
4479 GEN_LOAD_FREG_FTN(WT0, fs); 4508 GEN_LOAD_FREG_FTN(WT0, fs);
4480 gen_op_float_cvtl_s(); 4509 gen_op_float_cvtl_s();
4481 GEN_STORE_FTN_FREG(fd, DT2); 4510 GEN_STORE_FTN_FREG(fd, DT2);
4482 opn = "cvt.l.s"; 4511 opn = "cvt.l.s";
4483 break; 4512 break;
4484 case FOP(38, 16): 4513 case FOP(38, 16):
4485 - gen_op_cp1_64bitmode(); 4514 + check_cp1_64bitmode(ctx);
4486 GEN_LOAD_FREG_FTN(WT1, fs); 4515 GEN_LOAD_FREG_FTN(WT1, fs);
4487 GEN_LOAD_FREG_FTN(WT0, ft); 4516 GEN_LOAD_FREG_FTN(WT0, ft);
4488 gen_op_float_cvtps_s(); 4517 gen_op_float_cvtps_s();
@@ -4508,7 +4537,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4508,7 +4537,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4508 GEN_LOAD_FREG_FTN(WT0, fs); 4537 GEN_LOAD_FREG_FTN(WT0, fs);
4509 GEN_LOAD_FREG_FTN(WT1, ft); 4538 GEN_LOAD_FREG_FTN(WT1, ft);
4510 if (ctx->opcode & (1 << 6)) { 4539 if (ctx->opcode & (1 << 6)) {
4511 - gen_op_cp1_64bitmode(); 4540 + check_cp1_64bitmode(ctx);
4512 gen_cmpabs_s(func-48, cc); 4541 gen_cmpabs_s(func-48, cc);
4513 opn = condnames_abs[func-48]; 4542 opn = condnames_abs[func-48];
4514 } else { 4543 } else {
@@ -4517,7 +4546,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4517,7 +4546,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4517 } 4546 }
4518 break; 4547 break;
4519 case FOP(0, 17): 4548 case FOP(0, 17):
4520 - gen_op_cp1_registers(fs | ft | fd); 4549 + check_cp1_registers(ctx, fs | ft | fd);
4521 GEN_LOAD_FREG_FTN(DT0, fs); 4550 GEN_LOAD_FREG_FTN(DT0, fs);
4522 GEN_LOAD_FREG_FTN(DT1, ft); 4551 GEN_LOAD_FREG_FTN(DT1, ft);
4523 gen_op_float_add_d(); 4552 gen_op_float_add_d();
@@ -4526,7 +4555,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4526,7 +4555,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4526 optype = BINOP; 4555 optype = BINOP;
4527 break; 4556 break;
4528 case FOP(1, 17): 4557 case FOP(1, 17):
4529 - gen_op_cp1_registers(fs | ft | fd); 4558 + check_cp1_registers(ctx, fs | ft | fd);
4530 GEN_LOAD_FREG_FTN(DT0, fs); 4559 GEN_LOAD_FREG_FTN(DT0, fs);
4531 GEN_LOAD_FREG_FTN(DT1, ft); 4560 GEN_LOAD_FREG_FTN(DT1, ft);
4532 gen_op_float_sub_d(); 4561 gen_op_float_sub_d();
@@ -4535,7 +4564,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4535,7 +4564,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4535 optype = BINOP; 4564 optype = BINOP;
4536 break; 4565 break;
4537 case FOP(2, 17): 4566 case FOP(2, 17):
4538 - gen_op_cp1_registers(fs | ft | fd); 4567 + check_cp1_registers(ctx, fs | ft | fd);
4539 GEN_LOAD_FREG_FTN(DT0, fs); 4568 GEN_LOAD_FREG_FTN(DT0, fs);
4540 GEN_LOAD_FREG_FTN(DT1, ft); 4569 GEN_LOAD_FREG_FTN(DT1, ft);
4541 gen_op_float_mul_d(); 4570 gen_op_float_mul_d();
@@ -4544,7 +4573,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4544,7 +4573,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4544 optype = BINOP; 4573 optype = BINOP;
4545 break; 4574 break;
4546 case FOP(3, 17): 4575 case FOP(3, 17):
4547 - gen_op_cp1_registers(fs | ft | fd); 4576 + check_cp1_registers(ctx, fs | ft | fd);
4548 GEN_LOAD_FREG_FTN(DT0, fs); 4577 GEN_LOAD_FREG_FTN(DT0, fs);
4549 GEN_LOAD_FREG_FTN(DT1, ft); 4578 GEN_LOAD_FREG_FTN(DT1, ft);
4550 gen_op_float_div_d(); 4579 gen_op_float_div_d();
@@ -4553,84 +4582,84 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4553,84 +4582,84 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4553 optype = BINOP; 4582 optype = BINOP;
4554 break; 4583 break;
4555 case FOP(4, 17): 4584 case FOP(4, 17):
4556 - gen_op_cp1_registers(fs | fd); 4585 + check_cp1_registers(ctx, fs | fd);
4557 GEN_LOAD_FREG_FTN(DT0, fs); 4586 GEN_LOAD_FREG_FTN(DT0, fs);
4558 gen_op_float_sqrt_d(); 4587 gen_op_float_sqrt_d();
4559 GEN_STORE_FTN_FREG(fd, DT2); 4588 GEN_STORE_FTN_FREG(fd, DT2);
4560 opn = "sqrt.d"; 4589 opn = "sqrt.d";
4561 break; 4590 break;
4562 case FOP(5, 17): 4591 case FOP(5, 17):
4563 - gen_op_cp1_registers(fs | fd); 4592 + check_cp1_registers(ctx, fs | fd);
4564 GEN_LOAD_FREG_FTN(DT0, fs); 4593 GEN_LOAD_FREG_FTN(DT0, fs);
4565 gen_op_float_abs_d(); 4594 gen_op_float_abs_d();
4566 GEN_STORE_FTN_FREG(fd, DT2); 4595 GEN_STORE_FTN_FREG(fd, DT2);
4567 opn = "abs.d"; 4596 opn = "abs.d";
4568 break; 4597 break;
4569 case FOP(6, 17): 4598 case FOP(6, 17):
4570 - gen_op_cp1_registers(fs | fd); 4599 + check_cp1_registers(ctx, fs | fd);
4571 GEN_LOAD_FREG_FTN(DT0, fs); 4600 GEN_LOAD_FREG_FTN(DT0, fs);
4572 gen_op_float_mov_d(); 4601 gen_op_float_mov_d();
4573 GEN_STORE_FTN_FREG(fd, DT2); 4602 GEN_STORE_FTN_FREG(fd, DT2);
4574 opn = "mov.d"; 4603 opn = "mov.d";
4575 break; 4604 break;
4576 case FOP(7, 17): 4605 case FOP(7, 17):
4577 - gen_op_cp1_registers(fs | fd); 4606 + check_cp1_registers(ctx, fs | fd);
4578 GEN_LOAD_FREG_FTN(DT0, fs); 4607 GEN_LOAD_FREG_FTN(DT0, fs);
4579 gen_op_float_chs_d(); 4608 gen_op_float_chs_d();
4580 GEN_STORE_FTN_FREG(fd, DT2); 4609 GEN_STORE_FTN_FREG(fd, DT2);
4581 opn = "neg.d"; 4610 opn = "neg.d";
4582 break; 4611 break;
4583 case FOP(8, 17): 4612 case FOP(8, 17):
4584 - gen_op_cp1_64bitmode(); 4613 + check_cp1_64bitmode(ctx);
4585 GEN_LOAD_FREG_FTN(DT0, fs); 4614 GEN_LOAD_FREG_FTN(DT0, fs);
4586 gen_op_float_roundl_d(); 4615 gen_op_float_roundl_d();
4587 GEN_STORE_FTN_FREG(fd, DT2); 4616 GEN_STORE_FTN_FREG(fd, DT2);
4588 opn = "round.l.d"; 4617 opn = "round.l.d";
4589 break; 4618 break;
4590 case FOP(9, 17): 4619 case FOP(9, 17):
4591 - gen_op_cp1_64bitmode(); 4620 + check_cp1_64bitmode(ctx);
4592 GEN_LOAD_FREG_FTN(DT0, fs); 4621 GEN_LOAD_FREG_FTN(DT0, fs);
4593 gen_op_float_truncl_d(); 4622 gen_op_float_truncl_d();
4594 GEN_STORE_FTN_FREG(fd, DT2); 4623 GEN_STORE_FTN_FREG(fd, DT2);
4595 opn = "trunc.l.d"; 4624 opn = "trunc.l.d";
4596 break; 4625 break;
4597 case FOP(10, 17): 4626 case FOP(10, 17):
4598 - gen_op_cp1_64bitmode(); 4627 + check_cp1_64bitmode(ctx);
4599 GEN_LOAD_FREG_FTN(DT0, fs); 4628 GEN_LOAD_FREG_FTN(DT0, fs);
4600 gen_op_float_ceill_d(); 4629 gen_op_float_ceill_d();
4601 GEN_STORE_FTN_FREG(fd, DT2); 4630 GEN_STORE_FTN_FREG(fd, DT2);
4602 opn = "ceil.l.d"; 4631 opn = "ceil.l.d";
4603 break; 4632 break;
4604 case FOP(11, 17): 4633 case FOP(11, 17):
4605 - gen_op_cp1_64bitmode(); 4634 + check_cp1_64bitmode(ctx);
4606 GEN_LOAD_FREG_FTN(DT0, fs); 4635 GEN_LOAD_FREG_FTN(DT0, fs);
4607 gen_op_float_floorl_d(); 4636 gen_op_float_floorl_d();
4608 GEN_STORE_FTN_FREG(fd, DT2); 4637 GEN_STORE_FTN_FREG(fd, DT2);
4609 opn = "floor.l.d"; 4638 opn = "floor.l.d";
4610 break; 4639 break;
4611 case FOP(12, 17): 4640 case FOP(12, 17):
4612 - gen_op_cp1_registers(fs); 4641 + check_cp1_registers(ctx, fs);
4613 GEN_LOAD_FREG_FTN(DT0, fs); 4642 GEN_LOAD_FREG_FTN(DT0, fs);
4614 gen_op_float_roundw_d(); 4643 gen_op_float_roundw_d();
4615 GEN_STORE_FTN_FREG(fd, WT2); 4644 GEN_STORE_FTN_FREG(fd, WT2);
4616 opn = "round.w.d"; 4645 opn = "round.w.d";
4617 break; 4646 break;
4618 case FOP(13, 17): 4647 case FOP(13, 17):
4619 - gen_op_cp1_registers(fs); 4648 + check_cp1_registers(ctx, fs);
4620 GEN_LOAD_FREG_FTN(DT0, fs); 4649 GEN_LOAD_FREG_FTN(DT0, fs);
4621 gen_op_float_truncw_d(); 4650 gen_op_float_truncw_d();
4622 GEN_STORE_FTN_FREG(fd, WT2); 4651 GEN_STORE_FTN_FREG(fd, WT2);
4623 opn = "trunc.w.d"; 4652 opn = "trunc.w.d";
4624 break; 4653 break;
4625 case FOP(14, 17): 4654 case FOP(14, 17):
4626 - gen_op_cp1_registers(fs); 4655 + check_cp1_registers(ctx, fs);
4627 GEN_LOAD_FREG_FTN(DT0, fs); 4656 GEN_LOAD_FREG_FTN(DT0, fs);
4628 gen_op_float_ceilw_d(); 4657 gen_op_float_ceilw_d();
4629 GEN_STORE_FTN_FREG(fd, WT2); 4658 GEN_STORE_FTN_FREG(fd, WT2);
4630 opn = "ceil.w.d"; 4659 opn = "ceil.w.d";
4631 break; 4660 break;
4632 case FOP(15, 17): 4661 case FOP(15, 17):
4633 - gen_op_cp1_registers(fs); 4662 + check_cp1_registers(ctx, fs);
4634 GEN_LOAD_FREG_FTN(DT0, fs); 4663 GEN_LOAD_FREG_FTN(DT0, fs);
4635 gen_op_float_floorw_d(); 4664 gen_op_float_floorw_d();
4636 GEN_STORE_FTN_FREG(fd, WT2); 4665 GEN_STORE_FTN_FREG(fd, WT2);
@@ -4661,21 +4690,21 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4661,21 +4690,21 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4661 opn = "movn.d"; 4690 opn = "movn.d";
4662 break; 4691 break;
4663 case FOP(21, 17): 4692 case FOP(21, 17):
4664 - gen_op_cp1_registers(fs | fd); 4693 + check_cp1_registers(ctx, fs | fd);
4665 GEN_LOAD_FREG_FTN(DT0, fs); 4694 GEN_LOAD_FREG_FTN(DT0, fs);
4666 gen_op_float_recip_d(); 4695 gen_op_float_recip_d();
4667 GEN_STORE_FTN_FREG(fd, DT2); 4696 GEN_STORE_FTN_FREG(fd, DT2);
4668 opn = "recip.d"; 4697 opn = "recip.d";
4669 break; 4698 break;
4670 case FOP(22, 17): 4699 case FOP(22, 17):
4671 - gen_op_cp1_registers(fs | fd); 4700 + check_cp1_registers(ctx, fs | fd);
4672 GEN_LOAD_FREG_FTN(DT0, fs); 4701 GEN_LOAD_FREG_FTN(DT0, fs);
4673 gen_op_float_rsqrt_d(); 4702 gen_op_float_rsqrt_d();
4674 GEN_STORE_FTN_FREG(fd, DT2); 4703 GEN_STORE_FTN_FREG(fd, DT2);
4675 opn = "rsqrt.d"; 4704 opn = "rsqrt.d";
4676 break; 4705 break;
4677 case FOP(28, 17): 4706 case FOP(28, 17):
4678 - gen_op_cp1_64bitmode(); 4707 + check_cp1_64bitmode(ctx);
4679 GEN_LOAD_FREG_FTN(DT0, fs); 4708 GEN_LOAD_FREG_FTN(DT0, fs);
4680 GEN_LOAD_FREG_FTN(DT2, ft); 4709 GEN_LOAD_FREG_FTN(DT2, ft);
4681 gen_op_float_recip2_d(); 4710 gen_op_float_recip2_d();
@@ -4683,21 +4712,21 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4683,21 +4712,21 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4683 opn = "recip2.d"; 4712 opn = "recip2.d";
4684 break; 4713 break;
4685 case FOP(29, 17): 4714 case FOP(29, 17):
4686 - gen_op_cp1_64bitmode(); 4715 + check_cp1_64bitmode(ctx);
4687 GEN_LOAD_FREG_FTN(DT0, fs); 4716 GEN_LOAD_FREG_FTN(DT0, fs);
4688 gen_op_float_recip1_d(); 4717 gen_op_float_recip1_d();
4689 GEN_STORE_FTN_FREG(fd, DT2); 4718 GEN_STORE_FTN_FREG(fd, DT2);
4690 opn = "recip1.d"; 4719 opn = "recip1.d";
4691 break; 4720 break;
4692 case FOP(30, 17): 4721 case FOP(30, 17):
4693 - gen_op_cp1_64bitmode(); 4722 + check_cp1_64bitmode(ctx);
4694 GEN_LOAD_FREG_FTN(DT0, fs); 4723 GEN_LOAD_FREG_FTN(DT0, fs);
4695 gen_op_float_rsqrt1_d(); 4724 gen_op_float_rsqrt1_d();
4696 GEN_STORE_FTN_FREG(fd, DT2); 4725 GEN_STORE_FTN_FREG(fd, DT2);
4697 opn = "rsqrt1.d"; 4726 opn = "rsqrt1.d";
4698 break; 4727 break;
4699 case FOP(31, 17): 4728 case FOP(31, 17):
4700 - gen_op_cp1_64bitmode(); 4729 + check_cp1_64bitmode(ctx);
4701 GEN_LOAD_FREG_FTN(DT0, fs); 4730 GEN_LOAD_FREG_FTN(DT0, fs);
4702 GEN_LOAD_FREG_FTN(DT2, ft); 4731 GEN_LOAD_FREG_FTN(DT2, ft);
4703 gen_op_float_rsqrt2_d(); 4732 gen_op_float_rsqrt2_d();
@@ -4723,31 +4752,31 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4723,31 +4752,31 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4723 GEN_LOAD_FREG_FTN(DT0, fs); 4752 GEN_LOAD_FREG_FTN(DT0, fs);
4724 GEN_LOAD_FREG_FTN(DT1, ft); 4753 GEN_LOAD_FREG_FTN(DT1, ft);
4725 if (ctx->opcode & (1 << 6)) { 4754 if (ctx->opcode & (1 << 6)) {
4726 - gen_op_cp1_64bitmode(); 4755 + check_cp1_64bitmode(ctx);
4727 gen_cmpabs_d(func-48, cc); 4756 gen_cmpabs_d(func-48, cc);
4728 opn = condnames_abs[func-48]; 4757 opn = condnames_abs[func-48];
4729 } else { 4758 } else {
4730 - gen_op_cp1_registers(fs | ft); 4759 + check_cp1_registers(ctx, fs | ft);
4731 gen_cmp_d(func-48, cc); 4760 gen_cmp_d(func-48, cc);
4732 opn = condnames[func-48]; 4761 opn = condnames[func-48];
4733 } 4762 }
4734 break; 4763 break;
4735 case FOP(32, 17): 4764 case FOP(32, 17):
4736 - gen_op_cp1_registers(fs); 4765 + check_cp1_registers(ctx, fs);
4737 GEN_LOAD_FREG_FTN(DT0, fs); 4766 GEN_LOAD_FREG_FTN(DT0, fs);
4738 gen_op_float_cvts_d(); 4767 gen_op_float_cvts_d();
4739 GEN_STORE_FTN_FREG(fd, WT2); 4768 GEN_STORE_FTN_FREG(fd, WT2);
4740 opn = "cvt.s.d"; 4769 opn = "cvt.s.d";
4741 break; 4770 break;
4742 case FOP(36, 17): 4771 case FOP(36, 17):
4743 - gen_op_cp1_registers(fs); 4772 + check_cp1_registers(ctx, fs);
4744 GEN_LOAD_FREG_FTN(DT0, fs); 4773 GEN_LOAD_FREG_FTN(DT0, fs);
4745 gen_op_float_cvtw_d(); 4774 gen_op_float_cvtw_d();
4746 GEN_STORE_FTN_FREG(fd, WT2); 4775 GEN_STORE_FTN_FREG(fd, WT2);
4747 opn = "cvt.w.d"; 4776 opn = "cvt.w.d";
4748 break; 4777 break;
4749 case FOP(37, 17): 4778 case FOP(37, 17):
4750 - gen_op_cp1_64bitmode(); 4779 + check_cp1_64bitmode(ctx);
4751 GEN_LOAD_FREG_FTN(DT0, fs); 4780 GEN_LOAD_FREG_FTN(DT0, fs);
4752 gen_op_float_cvtl_d(); 4781 gen_op_float_cvtl_d();
4753 GEN_STORE_FTN_FREG(fd, DT2); 4782 GEN_STORE_FTN_FREG(fd, DT2);
@@ -4760,21 +4789,21 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4760,21 +4789,21 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4760 opn = "cvt.s.w"; 4789 opn = "cvt.s.w";
4761 break; 4790 break;
4762 case FOP(33, 20): 4791 case FOP(33, 20):
4763 - gen_op_cp1_registers(fd); 4792 + check_cp1_registers(ctx, fd);
4764 GEN_LOAD_FREG_FTN(WT0, fs); 4793 GEN_LOAD_FREG_FTN(WT0, fs);
4765 gen_op_float_cvtd_w(); 4794 gen_op_float_cvtd_w();
4766 GEN_STORE_FTN_FREG(fd, DT2); 4795 GEN_STORE_FTN_FREG(fd, DT2);
4767 opn = "cvt.d.w"; 4796 opn = "cvt.d.w";
4768 break; 4797 break;
4769 case FOP(32, 21): 4798 case FOP(32, 21):
4770 - gen_op_cp1_64bitmode(); 4799 + check_cp1_64bitmode(ctx);
4771 GEN_LOAD_FREG_FTN(DT0, fs); 4800 GEN_LOAD_FREG_FTN(DT0, fs);
4772 gen_op_float_cvts_l(); 4801 gen_op_float_cvts_l();
4773 GEN_STORE_FTN_FREG(fd, WT2); 4802 GEN_STORE_FTN_FREG(fd, WT2);
4774 opn = "cvt.s.l"; 4803 opn = "cvt.s.l";
4775 break; 4804 break;
4776 case FOP(33, 21): 4805 case FOP(33, 21):
4777 - gen_op_cp1_64bitmode(); 4806 + check_cp1_64bitmode(ctx);
4778 GEN_LOAD_FREG_FTN(DT0, fs); 4807 GEN_LOAD_FREG_FTN(DT0, fs);
4779 gen_op_float_cvtd_l(); 4808 gen_op_float_cvtd_l();
4780 GEN_STORE_FTN_FREG(fd, DT2); 4809 GEN_STORE_FTN_FREG(fd, DT2);
@@ -4782,7 +4811,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4782,7 +4811,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4782 break; 4811 break;
4783 case FOP(38, 20): 4812 case FOP(38, 20):
4784 case FOP(38, 21): 4813 case FOP(38, 21):
4785 - gen_op_cp1_64bitmode(); 4814 + check_cp1_64bitmode(ctx);
4786 GEN_LOAD_FREG_FTN(WT0, fs); 4815 GEN_LOAD_FREG_FTN(WT0, fs);
4787 GEN_LOAD_FREG_FTN(WTH0, fs); 4816 GEN_LOAD_FREG_FTN(WTH0, fs);
4788 gen_op_float_cvtps_pw(); 4817 gen_op_float_cvtps_pw();
@@ -4791,7 +4820,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4791,7 +4820,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4791 opn = "cvt.ps.pw"; 4820 opn = "cvt.ps.pw";
4792 break; 4821 break;
4793 case FOP(0, 22): 4822 case FOP(0, 22):
4794 - gen_op_cp1_64bitmode(); 4823 + check_cp1_64bitmode(ctx);
4795 GEN_LOAD_FREG_FTN(WT0, fs); 4824 GEN_LOAD_FREG_FTN(WT0, fs);
4796 GEN_LOAD_FREG_FTN(WTH0, fs); 4825 GEN_LOAD_FREG_FTN(WTH0, fs);
4797 GEN_LOAD_FREG_FTN(WT1, ft); 4826 GEN_LOAD_FREG_FTN(WT1, ft);
@@ -4802,7 +4831,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4802,7 +4831,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4802 opn = "add.ps"; 4831 opn = "add.ps";
4803 break; 4832 break;
4804 case FOP(1, 22): 4833 case FOP(1, 22):
4805 - gen_op_cp1_64bitmode(); 4834 + check_cp1_64bitmode(ctx);
4806 GEN_LOAD_FREG_FTN(WT0, fs); 4835 GEN_LOAD_FREG_FTN(WT0, fs);
4807 GEN_LOAD_FREG_FTN(WTH0, fs); 4836 GEN_LOAD_FREG_FTN(WTH0, fs);
4808 GEN_LOAD_FREG_FTN(WT1, ft); 4837 GEN_LOAD_FREG_FTN(WT1, ft);
@@ -4813,7 +4842,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4813,7 +4842,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4813 opn = "sub.ps"; 4842 opn = "sub.ps";
4814 break; 4843 break;
4815 case FOP(2, 22): 4844 case FOP(2, 22):
4816 - gen_op_cp1_64bitmode(); 4845 + check_cp1_64bitmode(ctx);
4817 GEN_LOAD_FREG_FTN(WT0, fs); 4846 GEN_LOAD_FREG_FTN(WT0, fs);
4818 GEN_LOAD_FREG_FTN(WTH0, fs); 4847 GEN_LOAD_FREG_FTN(WTH0, fs);
4819 GEN_LOAD_FREG_FTN(WT1, ft); 4848 GEN_LOAD_FREG_FTN(WT1, ft);
@@ -4824,7 +4853,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4824,7 +4853,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4824 opn = "mul.ps"; 4853 opn = "mul.ps";
4825 break; 4854 break;
4826 case FOP(5, 22): 4855 case FOP(5, 22):
4827 - gen_op_cp1_64bitmode(); 4856 + check_cp1_64bitmode(ctx);
4828 GEN_LOAD_FREG_FTN(WT0, fs); 4857 GEN_LOAD_FREG_FTN(WT0, fs);
4829 GEN_LOAD_FREG_FTN(WTH0, fs); 4858 GEN_LOAD_FREG_FTN(WTH0, fs);
4830 gen_op_float_abs_ps(); 4859 gen_op_float_abs_ps();
@@ -4833,7 +4862,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4833,7 +4862,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4833 opn = "abs.ps"; 4862 opn = "abs.ps";
4834 break; 4863 break;
4835 case FOP(6, 22): 4864 case FOP(6, 22):
4836 - gen_op_cp1_64bitmode(); 4865 + check_cp1_64bitmode(ctx);
4837 GEN_LOAD_FREG_FTN(WT0, fs); 4866 GEN_LOAD_FREG_FTN(WT0, fs);
4838 GEN_LOAD_FREG_FTN(WTH0, fs); 4867 GEN_LOAD_FREG_FTN(WTH0, fs);
4839 gen_op_float_mov_ps(); 4868 gen_op_float_mov_ps();
@@ -4842,7 +4871,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4842,7 +4871,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4842 opn = "mov.ps"; 4871 opn = "mov.ps";
4843 break; 4872 break;
4844 case FOP(7, 22): 4873 case FOP(7, 22):
4845 - gen_op_cp1_64bitmode(); 4874 + check_cp1_64bitmode(ctx);
4846 GEN_LOAD_FREG_FTN(WT0, fs); 4875 GEN_LOAD_FREG_FTN(WT0, fs);
4847 GEN_LOAD_FREG_FTN(WTH0, fs); 4876 GEN_LOAD_FREG_FTN(WTH0, fs);
4848 gen_op_float_chs_ps(); 4877 gen_op_float_chs_ps();
@@ -4851,7 +4880,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4851,7 +4880,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4851 opn = "neg.ps"; 4880 opn = "neg.ps";
4852 break; 4881 break;
4853 case FOP(17, 22): 4882 case FOP(17, 22):
4854 - gen_op_cp1_64bitmode(); 4883 + check_cp1_64bitmode(ctx);
4855 GEN_LOAD_REG_TN(T0, ft); 4884 GEN_LOAD_REG_TN(T0, ft);
4856 GEN_LOAD_FREG_FTN(WT0, fs); 4885 GEN_LOAD_FREG_FTN(WT0, fs);
4857 GEN_LOAD_FREG_FTN(WTH0, fs); 4886 GEN_LOAD_FREG_FTN(WTH0, fs);
@@ -4863,7 +4892,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4863,7 +4892,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4863 opn = "movcf.ps"; 4892 opn = "movcf.ps";
4864 break; 4893 break;
4865 case FOP(18, 22): 4894 case FOP(18, 22):
4866 - gen_op_cp1_64bitmode(); 4895 + check_cp1_64bitmode(ctx);
4867 GEN_LOAD_REG_TN(T0, ft); 4896 GEN_LOAD_REG_TN(T0, ft);
4868 GEN_LOAD_FREG_FTN(WT0, fs); 4897 GEN_LOAD_FREG_FTN(WT0, fs);
4869 GEN_LOAD_FREG_FTN(WTH0, fs); 4898 GEN_LOAD_FREG_FTN(WTH0, fs);
@@ -4875,7 +4904,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4875,7 +4904,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4875 opn = "movz.ps"; 4904 opn = "movz.ps";
4876 break; 4905 break;
4877 case FOP(19, 22): 4906 case FOP(19, 22):
4878 - gen_op_cp1_64bitmode(); 4907 + check_cp1_64bitmode(ctx);
4879 GEN_LOAD_REG_TN(T0, ft); 4908 GEN_LOAD_REG_TN(T0, ft);
4880 GEN_LOAD_FREG_FTN(WT0, fs); 4909 GEN_LOAD_FREG_FTN(WT0, fs);
4881 GEN_LOAD_FREG_FTN(WTH0, fs); 4910 GEN_LOAD_FREG_FTN(WTH0, fs);
@@ -4887,7 +4916,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4887,7 +4916,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4887 opn = "movn.ps"; 4916 opn = "movn.ps";
4888 break; 4917 break;
4889 case FOP(24, 22): 4918 case FOP(24, 22):
4890 - gen_op_cp1_64bitmode(); 4919 + check_cp1_64bitmode(ctx);
4891 GEN_LOAD_FREG_FTN(WT0, ft); 4920 GEN_LOAD_FREG_FTN(WT0, ft);
4892 GEN_LOAD_FREG_FTN(WTH0, ft); 4921 GEN_LOAD_FREG_FTN(WTH0, ft);
4893 GEN_LOAD_FREG_FTN(WT1, fs); 4922 GEN_LOAD_FREG_FTN(WT1, fs);
@@ -4898,7 +4927,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4898,7 +4927,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4898 opn = "addr.ps"; 4927 opn = "addr.ps";
4899 break; 4928 break;
4900 case FOP(26, 22): 4929 case FOP(26, 22):
4901 - gen_op_cp1_64bitmode(); 4930 + check_cp1_64bitmode(ctx);
4902 GEN_LOAD_FREG_FTN(WT0, ft); 4931 GEN_LOAD_FREG_FTN(WT0, ft);
4903 GEN_LOAD_FREG_FTN(WTH0, ft); 4932 GEN_LOAD_FREG_FTN(WTH0, ft);
4904 GEN_LOAD_FREG_FTN(WT1, fs); 4933 GEN_LOAD_FREG_FTN(WT1, fs);
@@ -4909,7 +4938,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4909,7 +4938,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4909 opn = "mulr.ps"; 4938 opn = "mulr.ps";
4910 break; 4939 break;
4911 case FOP(28, 22): 4940 case FOP(28, 22):
4912 - gen_op_cp1_64bitmode(); 4941 + check_cp1_64bitmode(ctx);
4913 GEN_LOAD_FREG_FTN(WT0, fs); 4942 GEN_LOAD_FREG_FTN(WT0, fs);
4914 GEN_LOAD_FREG_FTN(WTH0, fs); 4943 GEN_LOAD_FREG_FTN(WTH0, fs);
4915 GEN_LOAD_FREG_FTN(WT2, fd); 4944 GEN_LOAD_FREG_FTN(WT2, fd);
@@ -4920,7 +4949,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4920,7 +4949,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4920 opn = "recip2.ps"; 4949 opn = "recip2.ps";
4921 break; 4950 break;
4922 case FOP(29, 22): 4951 case FOP(29, 22):
4923 - gen_op_cp1_64bitmode(); 4952 + check_cp1_64bitmode(ctx);
4924 GEN_LOAD_FREG_FTN(WT0, fs); 4953 GEN_LOAD_FREG_FTN(WT0, fs);
4925 GEN_LOAD_FREG_FTN(WTH0, fs); 4954 GEN_LOAD_FREG_FTN(WTH0, fs);
4926 gen_op_float_recip1_ps(); 4955 gen_op_float_recip1_ps();
@@ -4929,7 +4958,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4929,7 +4958,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4929 opn = "recip1.ps"; 4958 opn = "recip1.ps";
4930 break; 4959 break;
4931 case FOP(30, 22): 4960 case FOP(30, 22):
4932 - gen_op_cp1_64bitmode(); 4961 + check_cp1_64bitmode(ctx);
4933 GEN_LOAD_FREG_FTN(WT0, fs); 4962 GEN_LOAD_FREG_FTN(WT0, fs);
4934 GEN_LOAD_FREG_FTN(WTH0, fs); 4963 GEN_LOAD_FREG_FTN(WTH0, fs);
4935 gen_op_float_rsqrt1_ps(); 4964 gen_op_float_rsqrt1_ps();
@@ -4938,7 +4967,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4938,7 +4967,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4938 opn = "rsqrt1.ps"; 4967 opn = "rsqrt1.ps";
4939 break; 4968 break;
4940 case FOP(31, 22): 4969 case FOP(31, 22):
4941 - gen_op_cp1_64bitmode(); 4970 + check_cp1_64bitmode(ctx);
4942 GEN_LOAD_FREG_FTN(WT0, fs); 4971 GEN_LOAD_FREG_FTN(WT0, fs);
4943 GEN_LOAD_FREG_FTN(WTH0, fs); 4972 GEN_LOAD_FREG_FTN(WTH0, fs);
4944 GEN_LOAD_FREG_FTN(WT2, fd); 4973 GEN_LOAD_FREG_FTN(WT2, fd);
@@ -4949,14 +4978,14 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4949,14 +4978,14 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4949 opn = "rsqrt2.ps"; 4978 opn = "rsqrt2.ps";
4950 break; 4979 break;
4951 case FOP(32, 22): 4980 case FOP(32, 22):
4952 - gen_op_cp1_64bitmode(); 4981 + check_cp1_64bitmode(ctx);
4953 GEN_LOAD_FREG_FTN(WTH0, fs); 4982 GEN_LOAD_FREG_FTN(WTH0, fs);
4954 gen_op_float_cvts_pu(); 4983 gen_op_float_cvts_pu();
4955 GEN_STORE_FTN_FREG(fd, WT2); 4984 GEN_STORE_FTN_FREG(fd, WT2);
4956 opn = "cvt.s.pu"; 4985 opn = "cvt.s.pu";
4957 break; 4986 break;
4958 case FOP(36, 22): 4987 case FOP(36, 22):
4959 - gen_op_cp1_64bitmode(); 4988 + check_cp1_64bitmode(ctx);
4960 GEN_LOAD_FREG_FTN(WT0, fs); 4989 GEN_LOAD_FREG_FTN(WT0, fs);
4961 GEN_LOAD_FREG_FTN(WTH0, fs); 4990 GEN_LOAD_FREG_FTN(WTH0, fs);
4962 gen_op_float_cvtpw_ps(); 4991 gen_op_float_cvtpw_ps();
@@ -4965,14 +4994,14 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4965,14 +4994,14 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4965 opn = "cvt.pw.ps"; 4994 opn = "cvt.pw.ps";
4966 break; 4995 break;
4967 case FOP(40, 22): 4996 case FOP(40, 22):
4968 - gen_op_cp1_64bitmode(); 4997 + check_cp1_64bitmode(ctx);
4969 GEN_LOAD_FREG_FTN(WT0, fs); 4998 GEN_LOAD_FREG_FTN(WT0, fs);
4970 gen_op_float_cvts_pl(); 4999 gen_op_float_cvts_pl();
4971 GEN_STORE_FTN_FREG(fd, WT2); 5000 GEN_STORE_FTN_FREG(fd, WT2);
4972 opn = "cvt.s.pl"; 5001 opn = "cvt.s.pl";
4973 break; 5002 break;
4974 case FOP(44, 22): 5003 case FOP(44, 22):
4975 - gen_op_cp1_64bitmode(); 5004 + check_cp1_64bitmode(ctx);
4976 GEN_LOAD_FREG_FTN(WT0, fs); 5005 GEN_LOAD_FREG_FTN(WT0, fs);
4977 GEN_LOAD_FREG_FTN(WT1, ft); 5006 GEN_LOAD_FREG_FTN(WT1, ft);
4978 gen_op_float_pll_ps(); 5007 gen_op_float_pll_ps();
@@ -4980,7 +5009,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4980,7 +5009,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4980 opn = "pll.ps"; 5009 opn = "pll.ps";
4981 break; 5010 break;
4982 case FOP(45, 22): 5011 case FOP(45, 22):
4983 - gen_op_cp1_64bitmode(); 5012 + check_cp1_64bitmode(ctx);
4984 GEN_LOAD_FREG_FTN(WT0, fs); 5013 GEN_LOAD_FREG_FTN(WT0, fs);
4985 GEN_LOAD_FREG_FTN(WTH1, ft); 5014 GEN_LOAD_FREG_FTN(WTH1, ft);
4986 gen_op_float_plu_ps(); 5015 gen_op_float_plu_ps();
@@ -4988,7 +5017,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4988,7 +5017,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4988 opn = "plu.ps"; 5017 opn = "plu.ps";
4989 break; 5018 break;
4990 case FOP(46, 22): 5019 case FOP(46, 22):
4991 - gen_op_cp1_64bitmode(); 5020 + check_cp1_64bitmode(ctx);
4992 GEN_LOAD_FREG_FTN(WTH0, fs); 5021 GEN_LOAD_FREG_FTN(WTH0, fs);
4993 GEN_LOAD_FREG_FTN(WT1, ft); 5022 GEN_LOAD_FREG_FTN(WT1, ft);
4994 gen_op_float_pul_ps(); 5023 gen_op_float_pul_ps();
@@ -4996,7 +5025,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -4996,7 +5025,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
4996 opn = "pul.ps"; 5025 opn = "pul.ps";
4997 break; 5026 break;
4998 case FOP(47, 22): 5027 case FOP(47, 22):
4999 - gen_op_cp1_64bitmode(); 5028 + check_cp1_64bitmode(ctx);
5000 GEN_LOAD_FREG_FTN(WTH0, fs); 5029 GEN_LOAD_FREG_FTN(WTH0, fs);
5001 GEN_LOAD_FREG_FTN(WTH1, ft); 5030 GEN_LOAD_FREG_FTN(WTH1, ft);
5002 gen_op_float_puu_ps(); 5031 gen_op_float_puu_ps();
@@ -5019,7 +5048,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -5019,7 +5048,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
5019 case FOP(61, 22): 5048 case FOP(61, 22):
5020 case FOP(62, 22): 5049 case FOP(62, 22):
5021 case FOP(63, 22): 5050 case FOP(63, 22):
5022 - gen_op_cp1_64bitmode(); 5051 + check_cp1_64bitmode(ctx);
5023 GEN_LOAD_FREG_FTN(WT0, fs); 5052 GEN_LOAD_FREG_FTN(WT0, fs);
5024 GEN_LOAD_FREG_FTN(WTH0, fs); 5053 GEN_LOAD_FREG_FTN(WTH0, fs);
5025 GEN_LOAD_FREG_FTN(WT1, ft); 5054 GEN_LOAD_FREG_FTN(WT1, ft);
@@ -5051,14 +5080,14 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, @@ -5051,14 +5080,14 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft,
5051 } 5080 }
5052 5081
5053 /* Coprocessor 3 (FPU) */ 5082 /* Coprocessor 3 (FPU) */
5054 -static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, int fd,  
5055 - int fs, int base, int index) 5083 +static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc,
  5084 + int fd, int fs, int base, int index)
5056 { 5085 {
5057 const char *opn = "extended float load/store"; 5086 const char *opn = "extended float load/store";
5058 int store = 0; 5087 int store = 0;
5059 5088
5060 /* All of those work only on 64bit FPUs. */ 5089 /* All of those work only on 64bit FPUs. */
5061 - gen_op_cp1_64bitmode(); 5090 + check_cp1_64bitmode(ctx);
5062 if (base == 0) { 5091 if (base == 0) {
5063 if (index == 0) 5092 if (index == 0)
5064 gen_op_reset_T0(); 5093 gen_op_reset_T0();
@@ -5117,13 +5146,13 @@ static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, int fd, @@ -5117,13 +5146,13 @@ static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, int fd,
5117 regnames[index], regnames[base]); 5146 regnames[index], regnames[base]);
5118 } 5147 }
5119 5148
5120 -static void gen_flt3_arith (DisasContext *ctx, uint32_t opc, int fd,  
5121 - int fr, int fs, int ft) 5149 +static void gen_flt3_arith (DisasContext *ctx, uint32_t opc,
  5150 + int fd, int fr, int fs, int ft)
5122 { 5151 {
5123 const char *opn = "flt3_arith"; 5152 const char *opn = "flt3_arith";
5124 5153
5125 /* All of those work only on 64bit FPUs. */ 5154 /* All of those work only on 64bit FPUs. */
5126 - gen_op_cp1_64bitmode(); 5155 + check_cp1_64bitmode(ctx);
5127 switch (opc) { 5156 switch (opc) {
5128 case OPC_ALNV_PS: 5157 case OPC_ALNV_PS:
5129 GEN_LOAD_REG_TN(T0, fr); 5158 GEN_LOAD_REG_TN(T0, fr);
@@ -5363,7 +5392,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) @@ -5363,7 +5392,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
5363 case OPC_MOVCI: 5392 case OPC_MOVCI:
5364 if (env->CP0_Config1 & (1 << CP0C1_FP)) { 5393 if (env->CP0_Config1 & (1 << CP0C1_FP)) {
5365 save_cpu_state(ctx, 1); 5394 save_cpu_state(ctx, 1);
5366 - gen_op_cp1_enabled(); 5395 + check_cp1_enabled(ctx);
5367 gen_movci(ctx, rd, rs, (ctx->opcode >> 18) & 0x7, 5396 gen_movci(ctx, rd, rs, (ctx->opcode >> 18) & 0x7,
5368 (ctx->opcode >> 16) & 1); 5397 (ctx->opcode >> 16) & 1);
5369 } else { 5398 } else {
@@ -5634,7 +5663,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) @@ -5634,7 +5663,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
5634 case OPC_SDC1: 5663 case OPC_SDC1:
5635 if (env->CP0_Config1 & (1 << CP0C1_FP)) { 5664 if (env->CP0_Config1 & (1 << CP0C1_FP)) {
5636 save_cpu_state(ctx, 1); 5665 save_cpu_state(ctx, 1);
5637 - gen_op_cp1_enabled(); 5666 + check_cp1_enabled(ctx);
5638 gen_flt_ldst(ctx, op, rt, rs, imm); 5667 gen_flt_ldst(ctx, op, rt, rs, imm);
5639 } else { 5668 } else {
5640 generate_exception_err(ctx, EXCP_CpU, 1); 5669 generate_exception_err(ctx, EXCP_CpU, 1);
@@ -5644,7 +5673,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) @@ -5644,7 +5673,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
5644 case OPC_CP1: 5673 case OPC_CP1:
5645 if (env->CP0_Config1 & (1 << CP0C1_FP)) { 5674 if (env->CP0_Config1 & (1 << CP0C1_FP)) {
5646 save_cpu_state(ctx, 1); 5675 save_cpu_state(ctx, 1);
5647 - gen_op_cp1_enabled(); 5676 + check_cp1_enabled(ctx);
5648 op1 = MASK_CP1(ctx->opcode); 5677 op1 = MASK_CP1(ctx->opcode);
5649 switch (op1) { 5678 switch (op1) {
5650 case OPC_MFC1: 5679 case OPC_MFC1:
@@ -5696,7 +5725,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) @@ -5696,7 +5725,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
5696 case OPC_CP3: 5725 case OPC_CP3:
5697 if (env->CP0_Config1 & (1 << CP0C1_FP)) { 5726 if (env->CP0_Config1 & (1 << CP0C1_FP)) {
5698 save_cpu_state(ctx, 1); 5727 save_cpu_state(ctx, 1);
5699 - gen_op_cp1_enabled(); 5728 + check_cp1_enabled(ctx);
5700 op1 = MASK_CP3(ctx->opcode); 5729 op1 = MASK_CP3(ctx->opcode);
5701 switch (op1) { 5730 switch (op1) {
5702 case OPC_LWXC1: 5731 case OPC_LWXC1:
@@ -5960,7 +5989,7 @@ void fpu_dump_state(CPUState *env, FILE *f, @@ -5960,7 +5989,7 @@ void fpu_dump_state(CPUState *env, FILE *f,
5960 int flags) 5989 int flags)
5961 { 5990 {
5962 int i; 5991 int i;
5963 - int is_fpu64 = !!(env->CP0_Status & (1 << CP0St_FR)); 5992 + int is_fpu64 = !!(env->hflags & MIPS_HFLAG_F64);
5964 5993
5965 #define printfpr(fp) \ 5994 #define printfpr(fp) \
5966 do { \ 5995 do { \
@@ -6038,7 +6067,6 @@ void cpu_dump_state (CPUState *env, FILE *f, @@ -6038,7 +6067,6 @@ void cpu_dump_state (CPUState *env, FILE *f,
6038 int (*cpu_fprintf)(FILE *f, const char *fmt, ...), 6067 int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
6039 int flags) 6068 int flags)
6040 { 6069 {
6041 - uint32_t c0_status;  
6042 int i; 6070 int i;
6043 6071
6044 cpu_fprintf(f, "pc=0x" TARGET_FMT_lx " HI=0x" TARGET_FMT_lx " LO=0x" TARGET_FMT_lx " ds %04x " TARGET_FMT_lx " %d\n", 6072 cpu_fprintf(f, "pc=0x" TARGET_FMT_lx " HI=0x" TARGET_FMT_lx " LO=0x" TARGET_FMT_lx " ds %04x " TARGET_FMT_lx " %d\n",
@@ -6051,13 +6079,11 @@ void cpu_dump_state (CPUState *env, FILE *f, @@ -6051,13 +6079,11 @@ void cpu_dump_state (CPUState *env, FILE *f,
6051 cpu_fprintf(f, "\n"); 6079 cpu_fprintf(f, "\n");
6052 } 6080 }
6053 6081
6054 - c0_status = env->CP0_Status;  
6055 -  
6056 cpu_fprintf(f, "CP0 Status 0x%08x Cause 0x%08x EPC 0x" TARGET_FMT_lx "\n", 6082 cpu_fprintf(f, "CP0 Status 0x%08x Cause 0x%08x EPC 0x" TARGET_FMT_lx "\n",
6057 - c0_status, env->CP0_Cause, env->CP0_EPC); 6083 + env->CP0_Status, env->CP0_Cause, env->CP0_EPC);
6058 cpu_fprintf(f, " Config0 0x%08x Config1 0x%08x LLAddr 0x" TARGET_FMT_lx "\n", 6084 cpu_fprintf(f, " Config0 0x%08x Config1 0x%08x LLAddr 0x" TARGET_FMT_lx "\n",
6059 env->CP0_Config0, env->CP0_Config1, env->CP0_LLAddr); 6085 env->CP0_Config0, env->CP0_Config1, env->CP0_LLAddr);
6060 - if (c0_status & (1 << CP0St_CU1)) 6086 + if (env->hflags & MIPS_HFLAG_FPU)
6061 fpu_dump_state(env, f, cpu_fprintf, flags); 6087 fpu_dump_state(env, f, cpu_fprintf, flags);
6062 #if defined(TARGET_MIPS64) && defined(MIPS_DEBUG_SIGN_EXTENSIONS) 6088 #if defined(TARGET_MIPS64) && defined(MIPS_DEBUG_SIGN_EXTENSIONS)
6063 cpu_mips_check_sign_extensions(env, f, cpu_fprintf, flags); 6089 cpu_mips_check_sign_extensions(env, f, cpu_fprintf, flags);