Commit ae2dbf7fb04194c367c3352f716715bb569602ed
1 parent
2382dc6b
Micro-optimize back-to-back store-load sequences.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3743 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
135 additions
and
103 deletions
target-mips/translate.c
@@ -543,6 +543,8 @@ typedef struct DisasContext { | @@ -543,6 +543,8 @@ typedef struct DisasContext { | ||
543 | uint32_t hflags, saved_hflags; | 543 | uint32_t hflags, saved_hflags; |
544 | int bstate; | 544 | int bstate; |
545 | target_ulong btarget; | 545 | target_ulong btarget; |
546 | + void *last_T0_store; | ||
547 | + int last_T0_gpr; | ||
546 | } DisasContext; | 548 | } DisasContext; |
547 | 549 | ||
548 | enum { | 550 | enum { |
@@ -572,12 +574,33 @@ do { \ | @@ -572,12 +574,33 @@ do { \ | ||
572 | ctx->opcode & 0x3F, ((ctx->opcode >> 16) & 0x1F)); \ | 574 | ctx->opcode & 0x3F, ((ctx->opcode >> 16) & 0x1F)); \ |
573 | } while (0) | 575 | } while (0) |
574 | 576 | ||
575 | -#define GEN_LOAD_REG_TN(Tn, Rn) \ | 577 | +#define GEN_LOAD_REG_T0(Rn) \ |
576 | do { \ | 578 | do { \ |
577 | if (Rn == 0) { \ | 579 | if (Rn == 0) { \ |
578 | - glue(gen_op_reset_, Tn)(); \ | 580 | + gen_op_reset_T0(); \ |
581 | + } else { \ | ||
582 | + if (ctx->glue(last_T0, _store) != gen_opc_ptr \ | ||
583 | + || ctx->glue(last_T0, _gpr) != Rn) { \ | ||
584 | + gen_op_load_gpr_T0(Rn); \ | ||
585 | + } \ | ||
586 | + } \ | ||
587 | +} while (0) | ||
588 | + | ||
589 | +#define GEN_LOAD_REG_T1(Rn) \ | ||
590 | +do { \ | ||
591 | + if (Rn == 0) { \ | ||
592 | + gen_op_reset_T1(); \ | ||
593 | + } else { \ | ||
594 | + gen_op_load_gpr_T1(Rn); \ | ||
595 | + } \ | ||
596 | +} while (0) | ||
597 | + | ||
598 | +#define GEN_LOAD_REG_T2(Rn) \ | ||
599 | +do { \ | ||
600 | + if (Rn == 0) { \ | ||
601 | + gen_op_reset_T2(); \ | ||
579 | } else { \ | 602 | } else { \ |
580 | - glue(gen_op_load_gpr_, Tn)(Rn); \ | 603 | + gen_op_load_gpr_T2(Rn); \ |
581 | } \ | 604 | } \ |
582 | } while (0) | 605 | } while (0) |
583 | 606 | ||
@@ -612,13 +635,21 @@ do { \ | @@ -612,13 +635,21 @@ do { \ | ||
612 | } while (0) | 635 | } while (0) |
613 | #endif | 636 | #endif |
614 | 637 | ||
615 | -#define GEN_STORE_TN_REG(Rn, Tn) \ | 638 | +#define GEN_STORE_T0_REG(Rn) \ |
616 | do { \ | 639 | do { \ |
617 | if (Rn != 0) { \ | 640 | if (Rn != 0) { \ |
618 | - glue(glue(gen_op_store_, Tn),_gpr)(Rn); \ | 641 | + glue(gen_op_store_T0,_gpr)(Rn); \ |
642 | + ctx->glue(last_T0,_store) = gen_opc_ptr; \ | ||
643 | + ctx->glue(last_T0,_gpr) = Rn; \ | ||
619 | } \ | 644 | } \ |
620 | } while (0) | 645 | } while (0) |
621 | 646 | ||
647 | +#define GEN_STORE_T1_REG(Rn) \ | ||
648 | +do { \ | ||
649 | + if (Rn != 0) \ | ||
650 | + glue(gen_op_store_T1,_gpr)(Rn); \ | ||
651 | +} while (0) | ||
652 | + | ||
622 | #define GEN_STORE_TN_SRSREG(Rn, Tn) \ | 653 | #define GEN_STORE_TN_SRSREG(Rn, Tn) \ |
623 | do { \ | 654 | do { \ |
624 | if (Rn != 0) { \ | 655 | if (Rn != 0) { \ |
@@ -855,126 +886,126 @@ static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt, | @@ -855,126 +886,126 @@ static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt, | ||
855 | #if defined(TARGET_MIPS64) | 886 | #if defined(TARGET_MIPS64) |
856 | case OPC_LWU: | 887 | case OPC_LWU: |
857 | op_ldst(lwu); | 888 | op_ldst(lwu); |
858 | - GEN_STORE_TN_REG(rt, T0); | 889 | + GEN_STORE_T0_REG(rt); |
859 | opn = "lwu"; | 890 | opn = "lwu"; |
860 | break; | 891 | break; |
861 | case OPC_LD: | 892 | case OPC_LD: |
862 | op_ldst(ld); | 893 | op_ldst(ld); |
863 | - GEN_STORE_TN_REG(rt, T0); | 894 | + GEN_STORE_T0_REG(rt); |
864 | opn = "ld"; | 895 | opn = "ld"; |
865 | break; | 896 | break; |
866 | case OPC_LLD: | 897 | case OPC_LLD: |
867 | op_ldst(lld); | 898 | op_ldst(lld); |
868 | - GEN_STORE_TN_REG(rt, T0); | 899 | + GEN_STORE_T0_REG(rt); |
869 | opn = "lld"; | 900 | opn = "lld"; |
870 | break; | 901 | break; |
871 | case OPC_SD: | 902 | case OPC_SD: |
872 | - GEN_LOAD_REG_TN(T1, rt); | 903 | + GEN_LOAD_REG_T1(rt); |
873 | op_ldst(sd); | 904 | op_ldst(sd); |
874 | opn = "sd"; | 905 | opn = "sd"; |
875 | break; | 906 | break; |
876 | case OPC_SCD: | 907 | case OPC_SCD: |
877 | save_cpu_state(ctx, 1); | 908 | save_cpu_state(ctx, 1); |
878 | - GEN_LOAD_REG_TN(T1, rt); | 909 | + GEN_LOAD_REG_T1(rt); |
879 | op_ldst(scd); | 910 | op_ldst(scd); |
880 | - GEN_STORE_TN_REG(rt, T0); | 911 | + GEN_STORE_T0_REG(rt); |
881 | opn = "scd"; | 912 | opn = "scd"; |
882 | break; | 913 | break; |
883 | case OPC_LDL: | 914 | case OPC_LDL: |
884 | - GEN_LOAD_REG_TN(T1, rt); | 915 | + GEN_LOAD_REG_T1(rt); |
885 | op_ldst(ldl); | 916 | op_ldst(ldl); |
886 | - GEN_STORE_TN_REG(rt, T1); | 917 | + GEN_STORE_T1_REG(rt); |
887 | opn = "ldl"; | 918 | opn = "ldl"; |
888 | break; | 919 | break; |
889 | case OPC_SDL: | 920 | case OPC_SDL: |
890 | - GEN_LOAD_REG_TN(T1, rt); | 921 | + GEN_LOAD_REG_T1(rt); |
891 | op_ldst(sdl); | 922 | op_ldst(sdl); |
892 | opn = "sdl"; | 923 | opn = "sdl"; |
893 | break; | 924 | break; |
894 | case OPC_LDR: | 925 | case OPC_LDR: |
895 | - GEN_LOAD_REG_TN(T1, rt); | 926 | + GEN_LOAD_REG_T1(rt); |
896 | op_ldst(ldr); | 927 | op_ldst(ldr); |
897 | - GEN_STORE_TN_REG(rt, T1); | 928 | + GEN_STORE_T1_REG(rt); |
898 | opn = "ldr"; | 929 | opn = "ldr"; |
899 | break; | 930 | break; |
900 | case OPC_SDR: | 931 | case OPC_SDR: |
901 | - GEN_LOAD_REG_TN(T1, rt); | 932 | + GEN_LOAD_REG_T1(rt); |
902 | op_ldst(sdr); | 933 | op_ldst(sdr); |
903 | opn = "sdr"; | 934 | opn = "sdr"; |
904 | break; | 935 | break; |
905 | #endif | 936 | #endif |
906 | case OPC_LW: | 937 | case OPC_LW: |
907 | op_ldst(lw); | 938 | op_ldst(lw); |
908 | - GEN_STORE_TN_REG(rt, T0); | 939 | + GEN_STORE_T0_REG(rt); |
909 | opn = "lw"; | 940 | opn = "lw"; |
910 | break; | 941 | break; |
911 | case OPC_SW: | 942 | case OPC_SW: |
912 | - GEN_LOAD_REG_TN(T1, rt); | 943 | + GEN_LOAD_REG_T1(rt); |
913 | op_ldst(sw); | 944 | op_ldst(sw); |
914 | opn = "sw"; | 945 | opn = "sw"; |
915 | break; | 946 | break; |
916 | case OPC_LH: | 947 | case OPC_LH: |
917 | op_ldst(lh); | 948 | op_ldst(lh); |
918 | - GEN_STORE_TN_REG(rt, T0); | 949 | + GEN_STORE_T0_REG(rt); |
919 | opn = "lh"; | 950 | opn = "lh"; |
920 | break; | 951 | break; |
921 | case OPC_SH: | 952 | case OPC_SH: |
922 | - GEN_LOAD_REG_TN(T1, rt); | 953 | + GEN_LOAD_REG_T1(rt); |
923 | op_ldst(sh); | 954 | op_ldst(sh); |
924 | opn = "sh"; | 955 | opn = "sh"; |
925 | break; | 956 | break; |
926 | case OPC_LHU: | 957 | case OPC_LHU: |
927 | op_ldst(lhu); | 958 | op_ldst(lhu); |
928 | - GEN_STORE_TN_REG(rt, T0); | 959 | + GEN_STORE_T0_REG(rt); |
929 | opn = "lhu"; | 960 | opn = "lhu"; |
930 | break; | 961 | break; |
931 | case OPC_LB: | 962 | case OPC_LB: |
932 | op_ldst(lb); | 963 | op_ldst(lb); |
933 | - GEN_STORE_TN_REG(rt, T0); | 964 | + GEN_STORE_T0_REG(rt); |
934 | opn = "lb"; | 965 | opn = "lb"; |
935 | break; | 966 | break; |
936 | case OPC_SB: | 967 | case OPC_SB: |
937 | - GEN_LOAD_REG_TN(T1, rt); | 968 | + GEN_LOAD_REG_T1(rt); |
938 | op_ldst(sb); | 969 | op_ldst(sb); |
939 | opn = "sb"; | 970 | opn = "sb"; |
940 | break; | 971 | break; |
941 | case OPC_LBU: | 972 | case OPC_LBU: |
942 | op_ldst(lbu); | 973 | op_ldst(lbu); |
943 | - GEN_STORE_TN_REG(rt, T0); | 974 | + GEN_STORE_T0_REG(rt); |
944 | opn = "lbu"; | 975 | opn = "lbu"; |
945 | break; | 976 | break; |
946 | case OPC_LWL: | 977 | case OPC_LWL: |
947 | - GEN_LOAD_REG_TN(T1, rt); | 978 | + GEN_LOAD_REG_T1(rt); |
948 | op_ldst(lwl); | 979 | op_ldst(lwl); |
949 | - GEN_STORE_TN_REG(rt, T1); | 980 | + GEN_STORE_T1_REG(rt); |
950 | opn = "lwl"; | 981 | opn = "lwl"; |
951 | break; | 982 | break; |
952 | case OPC_SWL: | 983 | case OPC_SWL: |
953 | - GEN_LOAD_REG_TN(T1, rt); | 984 | + GEN_LOAD_REG_T1(rt); |
954 | op_ldst(swl); | 985 | op_ldst(swl); |
955 | opn = "swr"; | 986 | opn = "swr"; |
956 | break; | 987 | break; |
957 | case OPC_LWR: | 988 | case OPC_LWR: |
958 | - GEN_LOAD_REG_TN(T1, rt); | 989 | + GEN_LOAD_REG_T1(rt); |
959 | op_ldst(lwr); | 990 | op_ldst(lwr); |
960 | - GEN_STORE_TN_REG(rt, T1); | 991 | + GEN_STORE_T1_REG(rt); |
961 | opn = "lwr"; | 992 | opn = "lwr"; |
962 | break; | 993 | break; |
963 | case OPC_SWR: | 994 | case OPC_SWR: |
964 | - GEN_LOAD_REG_TN(T1, rt); | 995 | + GEN_LOAD_REG_T1(rt); |
965 | op_ldst(swr); | 996 | op_ldst(swr); |
966 | opn = "swr"; | 997 | opn = "swr"; |
967 | break; | 998 | break; |
968 | case OPC_LL: | 999 | case OPC_LL: |
969 | op_ldst(ll); | 1000 | op_ldst(ll); |
970 | - GEN_STORE_TN_REG(rt, T0); | 1001 | + GEN_STORE_T0_REG(rt); |
971 | opn = "ll"; | 1002 | opn = "ll"; |
972 | break; | 1003 | break; |
973 | case OPC_SC: | 1004 | case OPC_SC: |
974 | save_cpu_state(ctx, 1); | 1005 | save_cpu_state(ctx, 1); |
975 | - GEN_LOAD_REG_TN(T1, rt); | 1006 | + GEN_LOAD_REG_T1(rt); |
976 | op_ldst(sc); | 1007 | op_ldst(sc); |
977 | - GEN_STORE_TN_REG(rt, T0); | 1008 | + GEN_STORE_T0_REG(rt); |
978 | opn = "sc"; | 1009 | opn = "sc"; |
979 | break; | 1010 | break; |
980 | default: | 1011 | default: |
@@ -1059,7 +1090,7 @@ static void gen_arith_imm (CPUState *env, DisasContext *ctx, uint32_t opc, | @@ -1059,7 +1090,7 @@ static void gen_arith_imm (CPUState *env, DisasContext *ctx, uint32_t opc, | ||
1059 | case OPC_ANDI: | 1090 | case OPC_ANDI: |
1060 | case OPC_ORI: | 1091 | case OPC_ORI: |
1061 | case OPC_XORI: | 1092 | case OPC_XORI: |
1062 | - GEN_LOAD_REG_TN(T0, rs); | 1093 | + GEN_LOAD_REG_T0(rs); |
1063 | GEN_LOAD_IMM_TN(T1, uimm); | 1094 | GEN_LOAD_IMM_TN(T1, uimm); |
1064 | break; | 1095 | break; |
1065 | case OPC_LUI: | 1096 | case OPC_LUI: |
@@ -1077,7 +1108,7 @@ static void gen_arith_imm (CPUState *env, DisasContext *ctx, uint32_t opc, | @@ -1077,7 +1108,7 @@ static void gen_arith_imm (CPUState *env, DisasContext *ctx, uint32_t opc, | ||
1077 | case OPC_DSRL32: | 1108 | case OPC_DSRL32: |
1078 | #endif | 1109 | #endif |
1079 | uimm &= 0x1f; | 1110 | uimm &= 0x1f; |
1080 | - GEN_LOAD_REG_TN(T0, rs); | 1111 | + GEN_LOAD_REG_T0(rs); |
1081 | GEN_LOAD_IMM_TN(T1, uimm); | 1112 | GEN_LOAD_IMM_TN(T1, uimm); |
1082 | break; | 1113 | break; |
1083 | } | 1114 | } |
@@ -1222,7 +1253,7 @@ static void gen_arith_imm (CPUState *env, DisasContext *ctx, uint32_t opc, | @@ -1222,7 +1253,7 @@ static void gen_arith_imm (CPUState *env, DisasContext *ctx, uint32_t opc, | ||
1222 | generate_exception(ctx, EXCP_RI); | 1253 | generate_exception(ctx, EXCP_RI); |
1223 | return; | 1254 | return; |
1224 | } | 1255 | } |
1225 | - GEN_STORE_TN_REG(rt, T0); | 1256 | + GEN_STORE_T0_REG(rt); |
1226 | MIPS_DEBUG("%s %s, %s, " TARGET_FMT_lx, opn, regnames[rt], regnames[rs], uimm); | 1257 | MIPS_DEBUG("%s %s, %s, " TARGET_FMT_lx, opn, regnames[rt], regnames[rs], uimm); |
1227 | } | 1258 | } |
1228 | 1259 | ||
@@ -1239,14 +1270,14 @@ static void gen_arith (CPUState *env, DisasContext *ctx, uint32_t opc, | @@ -1239,14 +1270,14 @@ static void gen_arith (CPUState *env, DisasContext *ctx, uint32_t opc, | ||
1239 | MIPS_DEBUG("NOP"); | 1270 | MIPS_DEBUG("NOP"); |
1240 | return; | 1271 | return; |
1241 | } | 1272 | } |
1242 | - GEN_LOAD_REG_TN(T0, rs); | 1273 | + GEN_LOAD_REG_T0(rs); |
1243 | /* Specialcase the conventional move operation. */ | 1274 | /* Specialcase the conventional move operation. */ |
1244 | if (rt == 0 && (opc == OPC_ADDU || opc == OPC_DADDU | 1275 | if (rt == 0 && (opc == OPC_ADDU || opc == OPC_DADDU |
1245 | || opc == OPC_SUBU || opc == OPC_DSUBU)) { | 1276 | || opc == OPC_SUBU || opc == OPC_DSUBU)) { |
1246 | - GEN_STORE_TN_REG(rd, T0); | 1277 | + GEN_STORE_T0_REG(rd); |
1247 | return; | 1278 | return; |
1248 | } | 1279 | } |
1249 | - GEN_LOAD_REG_TN(T1, rt); | 1280 | + GEN_LOAD_REG_T1(rt); |
1250 | switch (opc) { | 1281 | switch (opc) { |
1251 | case OPC_ADD: | 1282 | case OPC_ADD: |
1252 | save_cpu_state(ctx, 1); | 1283 | save_cpu_state(ctx, 1); |
@@ -1389,7 +1420,7 @@ static void gen_arith (CPUState *env, DisasContext *ctx, uint32_t opc, | @@ -1389,7 +1420,7 @@ static void gen_arith (CPUState *env, DisasContext *ctx, uint32_t opc, | ||
1389 | generate_exception(ctx, EXCP_RI); | 1420 | generate_exception(ctx, EXCP_RI); |
1390 | return; | 1421 | return; |
1391 | } | 1422 | } |
1392 | - GEN_STORE_TN_REG(rd, T0); | 1423 | + GEN_STORE_T0_REG(rd); |
1393 | print: | 1424 | print: |
1394 | MIPS_DEBUG("%s %s, %s, %s", opn, regnames[rd], regnames[rs], regnames[rt]); | 1425 | MIPS_DEBUG("%s %s, %s, %s", opn, regnames[rd], regnames[rs], regnames[rt]); |
1395 | } | 1426 | } |
@@ -1407,21 +1438,21 @@ static void gen_HILO (DisasContext *ctx, uint32_t opc, int reg) | @@ -1407,21 +1438,21 @@ static void gen_HILO (DisasContext *ctx, uint32_t opc, int reg) | ||
1407 | switch (opc) { | 1438 | switch (opc) { |
1408 | case OPC_MFHI: | 1439 | case OPC_MFHI: |
1409 | gen_op_load_HI(0); | 1440 | gen_op_load_HI(0); |
1410 | - GEN_STORE_TN_REG(reg, T0); | 1441 | + GEN_STORE_T0_REG(reg); |
1411 | opn = "mfhi"; | 1442 | opn = "mfhi"; |
1412 | break; | 1443 | break; |
1413 | case OPC_MFLO: | 1444 | case OPC_MFLO: |
1414 | gen_op_load_LO(0); | 1445 | gen_op_load_LO(0); |
1415 | - GEN_STORE_TN_REG(reg, T0); | 1446 | + GEN_STORE_T0_REG(reg); |
1416 | opn = "mflo"; | 1447 | opn = "mflo"; |
1417 | break; | 1448 | break; |
1418 | case OPC_MTHI: | 1449 | case OPC_MTHI: |
1419 | - GEN_LOAD_REG_TN(T0, reg); | 1450 | + GEN_LOAD_REG_T0(reg); |
1420 | gen_op_store_HI(0); | 1451 | gen_op_store_HI(0); |
1421 | opn = "mthi"; | 1452 | opn = "mthi"; |
1422 | break; | 1453 | break; |
1423 | case OPC_MTLO: | 1454 | case OPC_MTLO: |
1424 | - GEN_LOAD_REG_TN(T0, reg); | 1455 | + GEN_LOAD_REG_T0(reg); |
1425 | gen_op_store_LO(0); | 1456 | gen_op_store_LO(0); |
1426 | opn = "mtlo"; | 1457 | opn = "mtlo"; |
1427 | break; | 1458 | break; |
@@ -1438,8 +1469,8 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc, | @@ -1438,8 +1469,8 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc, | ||
1438 | { | 1469 | { |
1439 | const char *opn = "mul/div"; | 1470 | const char *opn = "mul/div"; |
1440 | 1471 | ||
1441 | - GEN_LOAD_REG_TN(T0, rs); | ||
1442 | - GEN_LOAD_REG_TN(T1, rt); | 1472 | + GEN_LOAD_REG_T0(rs); |
1473 | + GEN_LOAD_REG_T1(rt); | ||
1443 | switch (opc) { | 1474 | switch (opc) { |
1444 | case OPC_DIV: | 1475 | case OPC_DIV: |
1445 | gen_op_div(); | 1476 | gen_op_div(); |
@@ -1508,7 +1539,7 @@ static void gen_cl (DisasContext *ctx, uint32_t opc, | @@ -1508,7 +1539,7 @@ static void gen_cl (DisasContext *ctx, uint32_t opc, | ||
1508 | MIPS_DEBUG("NOP"); | 1539 | MIPS_DEBUG("NOP"); |
1509 | return; | 1540 | return; |
1510 | } | 1541 | } |
1511 | - GEN_LOAD_REG_TN(T0, rs); | 1542 | + GEN_LOAD_REG_T0(rs); |
1512 | switch (opc) { | 1543 | switch (opc) { |
1513 | case OPC_CLO: | 1544 | case OPC_CLO: |
1514 | gen_op_clo(); | 1545 | gen_op_clo(); |
@@ -1554,8 +1585,8 @@ static void gen_trap (DisasContext *ctx, uint32_t opc, | @@ -1554,8 +1585,8 @@ static void gen_trap (DisasContext *ctx, uint32_t opc, | ||
1554 | case OPC_TNE: | 1585 | case OPC_TNE: |
1555 | /* Compare two registers */ | 1586 | /* Compare two registers */ |
1556 | if (rs != rt) { | 1587 | if (rs != rt) { |
1557 | - GEN_LOAD_REG_TN(T0, rs); | ||
1558 | - GEN_LOAD_REG_TN(T1, rt); | 1588 | + GEN_LOAD_REG_T0(rs); |
1589 | + GEN_LOAD_REG_T1(rt); | ||
1559 | cond = 1; | 1590 | cond = 1; |
1560 | } | 1591 | } |
1561 | break; | 1592 | break; |
@@ -1567,7 +1598,7 @@ static void gen_trap (DisasContext *ctx, uint32_t opc, | @@ -1567,7 +1598,7 @@ static void gen_trap (DisasContext *ctx, uint32_t opc, | ||
1567 | case OPC_TNEI: | 1598 | case OPC_TNEI: |
1568 | /* Compare register to immediate */ | 1599 | /* Compare register to immediate */ |
1569 | if (rs != 0 || imm != 0) { | 1600 | if (rs != 0 || imm != 0) { |
1570 | - GEN_LOAD_REG_TN(T0, rs); | 1601 | + GEN_LOAD_REG_T0(rs); |
1571 | GEN_LOAD_IMM_TN(T1, (int32_t)imm); | 1602 | GEN_LOAD_IMM_TN(T1, (int32_t)imm); |
1572 | cond = 1; | 1603 | cond = 1; |
1573 | } | 1604 | } |
@@ -1680,8 +1711,8 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, | @@ -1680,8 +1711,8 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, | ||
1680 | case OPC_BNEL: | 1711 | case OPC_BNEL: |
1681 | /* Compare two registers */ | 1712 | /* Compare two registers */ |
1682 | if (rs != rt) { | 1713 | if (rs != rt) { |
1683 | - GEN_LOAD_REG_TN(T0, rs); | ||
1684 | - GEN_LOAD_REG_TN(T1, rt); | 1714 | + GEN_LOAD_REG_T0(rs); |
1715 | + GEN_LOAD_REG_T1(rt); | ||
1685 | bcond = 1; | 1716 | bcond = 1; |
1686 | } | 1717 | } |
1687 | btarget = ctx->pc + 4 + offset; | 1718 | btarget = ctx->pc + 4 + offset; |
@@ -1720,7 +1751,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, | @@ -1720,7 +1751,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, | ||
1720 | generate_exception(ctx, EXCP_RI); | 1751 | generate_exception(ctx, EXCP_RI); |
1721 | return; | 1752 | return; |
1722 | } | 1753 | } |
1723 | - GEN_LOAD_REG_TN(T2, rs); | 1754 | + GEN_LOAD_REG_T2(rs); |
1724 | break; | 1755 | break; |
1725 | default: | 1756 | default: |
1726 | MIPS_INVAL("branch/jump"); | 1757 | MIPS_INVAL("branch/jump"); |
@@ -1896,7 +1927,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, | @@ -1896,7 +1927,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, | ||
1896 | static void gen_bitops (DisasContext *ctx, uint32_t opc, int rt, | 1927 | static void gen_bitops (DisasContext *ctx, uint32_t opc, int rt, |
1897 | int rs, int lsb, int msb) | 1928 | int rs, int lsb, int msb) |
1898 | { | 1929 | { |
1899 | - GEN_LOAD_REG_TN(T1, rs); | 1930 | + GEN_LOAD_REG_T1(rs); |
1900 | switch (opc) { | 1931 | switch (opc) { |
1901 | case OPC_EXT: | 1932 | case OPC_EXT: |
1902 | if (lsb + msb > 31) | 1933 | if (lsb + msb > 31) |
@@ -1923,26 +1954,26 @@ static void gen_bitops (DisasContext *ctx, uint32_t opc, int rt, | @@ -1923,26 +1954,26 @@ static void gen_bitops (DisasContext *ctx, uint32_t opc, int rt, | ||
1923 | case OPC_INS: | 1954 | case OPC_INS: |
1924 | if (lsb > msb) | 1955 | if (lsb > msb) |
1925 | goto fail; | 1956 | goto fail; |
1926 | - GEN_LOAD_REG_TN(T0, rt); | 1957 | + GEN_LOAD_REG_T0(rt); |
1927 | gen_op_ins(lsb, msb - lsb + 1); | 1958 | gen_op_ins(lsb, msb - lsb + 1); |
1928 | break; | 1959 | break; |
1929 | #if defined(TARGET_MIPS64) | 1960 | #if defined(TARGET_MIPS64) |
1930 | case OPC_DINSM: | 1961 | case OPC_DINSM: |
1931 | if (lsb > msb) | 1962 | if (lsb > msb) |
1932 | goto fail; | 1963 | goto fail; |
1933 | - GEN_LOAD_REG_TN(T0, rt); | 1964 | + GEN_LOAD_REG_T0(rt); |
1934 | gen_op_dins(lsb, msb - lsb + 1 + 32); | 1965 | gen_op_dins(lsb, msb - lsb + 1 + 32); |
1935 | break; | 1966 | break; |
1936 | case OPC_DINSU: | 1967 | case OPC_DINSU: |
1937 | if (lsb > msb) | 1968 | if (lsb > msb) |
1938 | goto fail; | 1969 | goto fail; |
1939 | - GEN_LOAD_REG_TN(T0, rt); | 1970 | + GEN_LOAD_REG_T0(rt); |
1940 | gen_op_dins(lsb + 32, msb - lsb + 1); | 1971 | gen_op_dins(lsb + 32, msb - lsb + 1); |
1941 | break; | 1972 | break; |
1942 | case OPC_DINS: | 1973 | case OPC_DINS: |
1943 | if (lsb > msb) | 1974 | if (lsb > msb) |
1944 | goto fail; | 1975 | goto fail; |
1945 | - GEN_LOAD_REG_TN(T0, rt); | 1976 | + GEN_LOAD_REG_T0(rt); |
1946 | gen_op_dins(lsb, msb - lsb + 1); | 1977 | gen_op_dins(lsb, msb - lsb + 1); |
1947 | break; | 1978 | break; |
1948 | #endif | 1979 | #endif |
@@ -1952,7 +1983,7 @@ fail: | @@ -1952,7 +1983,7 @@ fail: | ||
1952 | generate_exception(ctx, EXCP_RI); | 1983 | generate_exception(ctx, EXCP_RI); |
1953 | return; | 1984 | return; |
1954 | } | 1985 | } |
1955 | - GEN_STORE_TN_REG(rt, T0); | 1986 | + GEN_STORE_T0_REG(rt); |
1956 | } | 1987 | } |
1957 | 1988 | ||
1958 | /* CP0 (MMU and control) */ | 1989 | /* CP0 (MMU and control) */ |
@@ -4611,7 +4642,7 @@ static void gen_cp0 (CPUState *env, DisasContext *ctx, uint32_t opc, int rt, int | @@ -4611,7 +4642,7 @@ static void gen_cp0 (CPUState *env, DisasContext *ctx, uint32_t opc, int rt, int | ||
4611 | opn = "mfc0"; | 4642 | opn = "mfc0"; |
4612 | break; | 4643 | break; |
4613 | case OPC_MTC0: | 4644 | case OPC_MTC0: |
4614 | - GEN_LOAD_REG_TN(T0, rt); | 4645 | + GEN_LOAD_REG_T0(rt); |
4615 | save_cpu_state(ctx, 1); | 4646 | save_cpu_state(ctx, 1); |
4616 | gen_mtc0(env, ctx, rd, ctx->opcode & 0x7); | 4647 | gen_mtc0(env, ctx, rd, ctx->opcode & 0x7); |
4617 | opn = "mtc0"; | 4648 | opn = "mtc0"; |
@@ -4629,7 +4660,7 @@ static void gen_cp0 (CPUState *env, DisasContext *ctx, uint32_t opc, int rt, int | @@ -4629,7 +4660,7 @@ static void gen_cp0 (CPUState *env, DisasContext *ctx, uint32_t opc, int rt, int | ||
4629 | break; | 4660 | break; |
4630 | case OPC_DMTC0: | 4661 | case OPC_DMTC0: |
4631 | check_insn(env, ctx, ISA_MIPS3); | 4662 | check_insn(env, ctx, ISA_MIPS3); |
4632 | - GEN_LOAD_REG_TN(T0, rt); | 4663 | + GEN_LOAD_REG_T0(rt); |
4633 | save_cpu_state(ctx, 1); | 4664 | save_cpu_state(ctx, 1); |
4634 | gen_dmtc0(env, ctx, rd, ctx->opcode & 0x7); | 4665 | gen_dmtc0(env, ctx, rd, ctx->opcode & 0x7); |
4635 | opn = "dmtc0"; | 4666 | opn = "dmtc0"; |
@@ -4648,7 +4679,7 @@ static void gen_cp0 (CPUState *env, DisasContext *ctx, uint32_t opc, int rt, int | @@ -4648,7 +4679,7 @@ static void gen_cp0 (CPUState *env, DisasContext *ctx, uint32_t opc, int rt, int | ||
4648 | break; | 4679 | break; |
4649 | case OPC_MTTR: | 4680 | case OPC_MTTR: |
4650 | check_insn(env, ctx, ASE_MT); | 4681 | check_insn(env, ctx, ASE_MT); |
4651 | - GEN_LOAD_REG_TN(T0, rt); | 4682 | + GEN_LOAD_REG_T0(rt); |
4652 | gen_mttr(env, ctx, rd, (ctx->opcode >> 5) & 1, | 4683 | gen_mttr(env, ctx, rd, (ctx->opcode >> 5) & 1, |
4653 | ctx->opcode & 0x7, (ctx->opcode >> 4) & 1); | 4684 | ctx->opcode & 0x7, (ctx->opcode >> 4) & 1); |
4654 | opn = "mttr"; | 4685 | opn = "mttr"; |
@@ -4789,33 +4820,33 @@ static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs) | @@ -4789,33 +4820,33 @@ static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs) | ||
4789 | case OPC_MFC1: | 4820 | case OPC_MFC1: |
4790 | GEN_LOAD_FREG_FTN(WT0, fs); | 4821 | GEN_LOAD_FREG_FTN(WT0, fs); |
4791 | gen_op_mfc1(); | 4822 | gen_op_mfc1(); |
4792 | - GEN_STORE_TN_REG(rt, T0); | 4823 | + GEN_STORE_T0_REG(rt); |
4793 | opn = "mfc1"; | 4824 | opn = "mfc1"; |
4794 | break; | 4825 | break; |
4795 | case OPC_MTC1: | 4826 | case OPC_MTC1: |
4796 | - GEN_LOAD_REG_TN(T0, rt); | 4827 | + GEN_LOAD_REG_T0(rt); |
4797 | gen_op_mtc1(); | 4828 | gen_op_mtc1(); |
4798 | GEN_STORE_FTN_FREG(fs, WT0); | 4829 | GEN_STORE_FTN_FREG(fs, WT0); |
4799 | opn = "mtc1"; | 4830 | opn = "mtc1"; |
4800 | break; | 4831 | break; |
4801 | case OPC_CFC1: | 4832 | case OPC_CFC1: |
4802 | gen_op_cfc1(fs); | 4833 | gen_op_cfc1(fs); |
4803 | - GEN_STORE_TN_REG(rt, T0); | 4834 | + GEN_STORE_T0_REG(rt); |
4804 | opn = "cfc1"; | 4835 | opn = "cfc1"; |
4805 | break; | 4836 | break; |
4806 | case OPC_CTC1: | 4837 | case OPC_CTC1: |
4807 | - GEN_LOAD_REG_TN(T0, rt); | 4838 | + GEN_LOAD_REG_T0(rt); |
4808 | gen_op_ctc1(fs); | 4839 | gen_op_ctc1(fs); |
4809 | opn = "ctc1"; | 4840 | opn = "ctc1"; |
4810 | break; | 4841 | break; |
4811 | case OPC_DMFC1: | 4842 | case OPC_DMFC1: |
4812 | GEN_LOAD_FREG_FTN(DT0, fs); | 4843 | GEN_LOAD_FREG_FTN(DT0, fs); |
4813 | gen_op_dmfc1(); | 4844 | gen_op_dmfc1(); |
4814 | - GEN_STORE_TN_REG(rt, T0); | 4845 | + GEN_STORE_T0_REG(rt); |
4815 | opn = "dmfc1"; | 4846 | opn = "dmfc1"; |
4816 | break; | 4847 | break; |
4817 | case OPC_DMTC1: | 4848 | case OPC_DMTC1: |
4818 | - GEN_LOAD_REG_TN(T0, rt); | 4849 | + GEN_LOAD_REG_T0(rt); |
4819 | gen_op_dmtc1(); | 4850 | gen_op_dmtc1(); |
4820 | GEN_STORE_FTN_FREG(fs, DT0); | 4851 | GEN_STORE_FTN_FREG(fs, DT0); |
4821 | opn = "dmtc1"; | 4852 | opn = "dmtc1"; |
@@ -4823,11 +4854,11 @@ static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs) | @@ -4823,11 +4854,11 @@ static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs) | ||
4823 | case OPC_MFHC1: | 4854 | case OPC_MFHC1: |
4824 | GEN_LOAD_FREG_FTN(WTH0, fs); | 4855 | GEN_LOAD_FREG_FTN(WTH0, fs); |
4825 | gen_op_mfhc1(); | 4856 | gen_op_mfhc1(); |
4826 | - GEN_STORE_TN_REG(rt, T0); | 4857 | + GEN_STORE_T0_REG(rt); |
4827 | opn = "mfhc1"; | 4858 | opn = "mfhc1"; |
4828 | break; | 4859 | break; |
4829 | case OPC_MTHC1: | 4860 | case OPC_MTHC1: |
4830 | - GEN_LOAD_REG_TN(T0, rt); | 4861 | + GEN_LOAD_REG_T0(rt); |
4831 | gen_op_mthc1(); | 4862 | gen_op_mthc1(); |
4832 | GEN_STORE_FTN_FREG(fs, WTH0); | 4863 | GEN_STORE_FTN_FREG(fs, WTH0); |
4833 | opn = "mthc1"; | 4864 | opn = "mthc1"; |
@@ -4844,8 +4875,8 @@ static void gen_movci (DisasContext *ctx, int rd, int rs, int cc, int tf) | @@ -4844,8 +4875,8 @@ static void gen_movci (DisasContext *ctx, int rd, int rs, int cc, int tf) | ||
4844 | { | 4875 | { |
4845 | uint32_t ccbit; | 4876 | uint32_t ccbit; |
4846 | 4877 | ||
4847 | - GEN_LOAD_REG_TN(T0, rd); | ||
4848 | - GEN_LOAD_REG_TN(T1, rs); | 4878 | + GEN_LOAD_REG_T0(rd); |
4879 | + GEN_LOAD_REG_T1(rs); | ||
4849 | if (cc) { | 4880 | if (cc) { |
4850 | ccbit = 1 << (24 + cc); | 4881 | ccbit = 1 << (24 + cc); |
4851 | } else | 4882 | } else |
@@ -4854,7 +4885,7 @@ static void gen_movci (DisasContext *ctx, int rd, int rs, int cc, int tf) | @@ -4854,7 +4885,7 @@ static void gen_movci (DisasContext *ctx, int rd, int rs, int cc, int tf) | ||
4854 | gen_op_movf(ccbit); | 4885 | gen_op_movf(ccbit); |
4855 | else | 4886 | else |
4856 | gen_op_movt(ccbit); | 4887 | gen_op_movt(ccbit); |
4857 | - GEN_STORE_TN_REG(rd, T0); | 4888 | + GEN_STORE_T0_REG(rd); |
4858 | } | 4889 | } |
4859 | 4890 | ||
4860 | #define GEN_MOVCF(fmt) \ | 4891 | #define GEN_MOVCF(fmt) \ |
@@ -5029,7 +5060,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -5029,7 +5060,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
5029 | opn = "floor.w.s"; | 5060 | opn = "floor.w.s"; |
5030 | break; | 5061 | break; |
5031 | case FOP(17, 16): | 5062 | case FOP(17, 16): |
5032 | - GEN_LOAD_REG_TN(T0, ft); | 5063 | + GEN_LOAD_REG_T0(ft); |
5033 | GEN_LOAD_FREG_FTN(WT0, fs); | 5064 | GEN_LOAD_FREG_FTN(WT0, fs); |
5034 | GEN_LOAD_FREG_FTN(WT2, fd); | 5065 | GEN_LOAD_FREG_FTN(WT2, fd); |
5035 | gen_movcf_s(ctx, (ft >> 2) & 0x7, ft & 0x1); | 5066 | gen_movcf_s(ctx, (ft >> 2) & 0x7, ft & 0x1); |
@@ -5037,7 +5068,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -5037,7 +5068,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
5037 | opn = "movcf.s"; | 5068 | opn = "movcf.s"; |
5038 | break; | 5069 | break; |
5039 | case FOP(18, 16): | 5070 | case FOP(18, 16): |
5040 | - GEN_LOAD_REG_TN(T0, ft); | 5071 | + GEN_LOAD_REG_T0(ft); |
5041 | GEN_LOAD_FREG_FTN(WT0, fs); | 5072 | GEN_LOAD_FREG_FTN(WT0, fs); |
5042 | GEN_LOAD_FREG_FTN(WT2, fd); | 5073 | GEN_LOAD_FREG_FTN(WT2, fd); |
5043 | gen_op_float_movz_s(); | 5074 | gen_op_float_movz_s(); |
@@ -5045,7 +5076,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -5045,7 +5076,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
5045 | opn = "movz.s"; | 5076 | opn = "movz.s"; |
5046 | break; | 5077 | break; |
5047 | case FOP(19, 16): | 5078 | case FOP(19, 16): |
5048 | - GEN_LOAD_REG_TN(T0, ft); | 5079 | + GEN_LOAD_REG_T0(ft); |
5049 | GEN_LOAD_FREG_FTN(WT0, fs); | 5080 | GEN_LOAD_FREG_FTN(WT0, fs); |
5050 | GEN_LOAD_FREG_FTN(WT2, fd); | 5081 | GEN_LOAD_FREG_FTN(WT2, fd); |
5051 | gen_op_float_movn_s(); | 5082 | gen_op_float_movn_s(); |
@@ -5270,7 +5301,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -5270,7 +5301,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
5270 | opn = "floor.w.d"; | 5301 | opn = "floor.w.d"; |
5271 | break; | 5302 | break; |
5272 | case FOP(17, 17): | 5303 | case FOP(17, 17): |
5273 | - GEN_LOAD_REG_TN(T0, ft); | 5304 | + GEN_LOAD_REG_T0(ft); |
5274 | GEN_LOAD_FREG_FTN(DT0, fs); | 5305 | GEN_LOAD_FREG_FTN(DT0, fs); |
5275 | GEN_LOAD_FREG_FTN(DT2, fd); | 5306 | GEN_LOAD_FREG_FTN(DT2, fd); |
5276 | gen_movcf_d(ctx, (ft >> 2) & 0x7, ft & 0x1); | 5307 | gen_movcf_d(ctx, (ft >> 2) & 0x7, ft & 0x1); |
@@ -5278,7 +5309,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -5278,7 +5309,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
5278 | opn = "movcf.d"; | 5309 | opn = "movcf.d"; |
5279 | break; | 5310 | break; |
5280 | case FOP(18, 17): | 5311 | case FOP(18, 17): |
5281 | - GEN_LOAD_REG_TN(T0, ft); | 5312 | + GEN_LOAD_REG_T0(ft); |
5282 | GEN_LOAD_FREG_FTN(DT0, fs); | 5313 | GEN_LOAD_FREG_FTN(DT0, fs); |
5283 | GEN_LOAD_FREG_FTN(DT2, fd); | 5314 | GEN_LOAD_FREG_FTN(DT2, fd); |
5284 | gen_op_float_movz_d(); | 5315 | gen_op_float_movz_d(); |
@@ -5286,7 +5317,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -5286,7 +5317,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
5286 | opn = "movz.d"; | 5317 | opn = "movz.d"; |
5287 | break; | 5318 | break; |
5288 | case FOP(19, 17): | 5319 | case FOP(19, 17): |
5289 | - GEN_LOAD_REG_TN(T0, ft); | 5320 | + GEN_LOAD_REG_T0(ft); |
5290 | GEN_LOAD_FREG_FTN(DT0, fs); | 5321 | GEN_LOAD_FREG_FTN(DT0, fs); |
5291 | GEN_LOAD_FREG_FTN(DT2, fd); | 5322 | GEN_LOAD_FREG_FTN(DT2, fd); |
5292 | gen_op_float_movn_d(); | 5323 | gen_op_float_movn_d(); |
@@ -5484,7 +5515,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -5484,7 +5515,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
5484 | break; | 5515 | break; |
5485 | case FOP(17, 22): | 5516 | case FOP(17, 22): |
5486 | check_cp1_64bitmode(ctx); | 5517 | check_cp1_64bitmode(ctx); |
5487 | - GEN_LOAD_REG_TN(T0, ft); | 5518 | + GEN_LOAD_REG_T0(ft); |
5488 | GEN_LOAD_FREG_FTN(WT0, fs); | 5519 | GEN_LOAD_FREG_FTN(WT0, fs); |
5489 | GEN_LOAD_FREG_FTN(WTH0, fs); | 5520 | GEN_LOAD_FREG_FTN(WTH0, fs); |
5490 | GEN_LOAD_FREG_FTN(WT2, fd); | 5521 | GEN_LOAD_FREG_FTN(WT2, fd); |
@@ -5496,7 +5527,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -5496,7 +5527,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
5496 | break; | 5527 | break; |
5497 | case FOP(18, 22): | 5528 | case FOP(18, 22): |
5498 | check_cp1_64bitmode(ctx); | 5529 | check_cp1_64bitmode(ctx); |
5499 | - GEN_LOAD_REG_TN(T0, ft); | 5530 | + GEN_LOAD_REG_T0(ft); |
5500 | GEN_LOAD_FREG_FTN(WT0, fs); | 5531 | GEN_LOAD_FREG_FTN(WT0, fs); |
5501 | GEN_LOAD_FREG_FTN(WTH0, fs); | 5532 | GEN_LOAD_FREG_FTN(WTH0, fs); |
5502 | GEN_LOAD_FREG_FTN(WT2, fd); | 5533 | GEN_LOAD_FREG_FTN(WT2, fd); |
@@ -5508,7 +5539,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -5508,7 +5539,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
5508 | break; | 5539 | break; |
5509 | case FOP(19, 22): | 5540 | case FOP(19, 22): |
5510 | check_cp1_64bitmode(ctx); | 5541 | check_cp1_64bitmode(ctx); |
5511 | - GEN_LOAD_REG_TN(T0, ft); | 5542 | + GEN_LOAD_REG_T0(ft); |
5512 | GEN_LOAD_FREG_FTN(WT0, fs); | 5543 | GEN_LOAD_FREG_FTN(WT0, fs); |
5513 | GEN_LOAD_FREG_FTN(WTH0, fs); | 5544 | GEN_LOAD_FREG_FTN(WTH0, fs); |
5514 | GEN_LOAD_FREG_FTN(WT2, fd); | 5545 | GEN_LOAD_FREG_FTN(WT2, fd); |
@@ -5695,12 +5726,12 @@ static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, | @@ -5695,12 +5726,12 @@ static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, | ||
5695 | if (index == 0) | 5726 | if (index == 0) |
5696 | gen_op_reset_T0(); | 5727 | gen_op_reset_T0(); |
5697 | else | 5728 | else |
5698 | - GEN_LOAD_REG_TN(T0, index); | 5729 | + GEN_LOAD_REG_T0(index); |
5699 | } else if (index == 0) { | 5730 | } else if (index == 0) { |
5700 | - GEN_LOAD_REG_TN(T0, base); | 5731 | + GEN_LOAD_REG_T0(base); |
5701 | } else { | 5732 | } else { |
5702 | - GEN_LOAD_REG_TN(T0, base); | ||
5703 | - GEN_LOAD_REG_TN(T1, index); | 5733 | + GEN_LOAD_REG_T0(base); |
5734 | + GEN_LOAD_REG_T1(index); | ||
5704 | gen_op_addr_add(); | 5735 | gen_op_addr_add(); |
5705 | } | 5736 | } |
5706 | /* Don't do NOP if destination is zero: we must perform the actual | 5737 | /* Don't do NOP if destination is zero: we must perform the actual |
@@ -5757,7 +5788,7 @@ static void gen_flt3_arith (DisasContext *ctx, uint32_t opc, | @@ -5757,7 +5788,7 @@ static void gen_flt3_arith (DisasContext *ctx, uint32_t opc, | ||
5757 | check_cp1_64bitmode(ctx); | 5788 | check_cp1_64bitmode(ctx); |
5758 | switch (opc) { | 5789 | switch (opc) { |
5759 | case OPC_ALNV_PS: | 5790 | case OPC_ALNV_PS: |
5760 | - GEN_LOAD_REG_TN(T0, fr); | 5791 | + GEN_LOAD_REG_T0(fr); |
5761 | GEN_LOAD_FREG_FTN(DT0, fs); | 5792 | GEN_LOAD_FREG_FTN(DT0, fs); |
5762 | GEN_LOAD_FREG_FTN(DT1, ft); | 5793 | GEN_LOAD_FREG_FTN(DT1, ft); |
5763 | gen_op_float_alnv_ps(); | 5794 | gen_op_float_alnv_ps(); |
@@ -6081,15 +6112,15 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -6081,15 +6112,15 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
6081 | op2 = MASK_BSHFL(ctx->opcode); | 6112 | op2 = MASK_BSHFL(ctx->opcode); |
6082 | switch (op2) { | 6113 | switch (op2) { |
6083 | case OPC_WSBH: | 6114 | case OPC_WSBH: |
6084 | - GEN_LOAD_REG_TN(T1, rt); | 6115 | + GEN_LOAD_REG_T1(rt); |
6085 | gen_op_wsbh(); | 6116 | gen_op_wsbh(); |
6086 | break; | 6117 | break; |
6087 | case OPC_SEB: | 6118 | case OPC_SEB: |
6088 | - GEN_LOAD_REG_TN(T1, rt); | 6119 | + GEN_LOAD_REG_T1(rt); |
6089 | gen_op_seb(); | 6120 | gen_op_seb(); |
6090 | break; | 6121 | break; |
6091 | case OPC_SEH: | 6122 | case OPC_SEH: |
6092 | - GEN_LOAD_REG_TN(T1, rt); | 6123 | + GEN_LOAD_REG_T1(rt); |
6093 | gen_op_seh(); | 6124 | gen_op_seh(); |
6094 | break; | 6125 | break; |
6095 | default: /* Invalid */ | 6126 | default: /* Invalid */ |
@@ -6097,7 +6128,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -6097,7 +6128,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
6097 | generate_exception(ctx, EXCP_RI); | 6128 | generate_exception(ctx, EXCP_RI); |
6098 | break; | 6129 | break; |
6099 | } | 6130 | } |
6100 | - GEN_STORE_TN_REG(rd, T0); | 6131 | + GEN_STORE_T0_REG(rd); |
6101 | break; | 6132 | break; |
6102 | case OPC_RDHWR: | 6133 | case OPC_RDHWR: |
6103 | check_insn(env, ctx, ISA_MIPS32R2); | 6134 | check_insn(env, ctx, ISA_MIPS32R2); |
@@ -6128,19 +6159,19 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -6128,19 +6159,19 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
6128 | generate_exception(ctx, EXCP_RI); | 6159 | generate_exception(ctx, EXCP_RI); |
6129 | break; | 6160 | break; |
6130 | } | 6161 | } |
6131 | - GEN_STORE_TN_REG(rt, T0); | 6162 | + GEN_STORE_T0_REG(rt); |
6132 | break; | 6163 | break; |
6133 | case OPC_FORK: | 6164 | case OPC_FORK: |
6134 | check_insn(env, ctx, ASE_MT); | 6165 | check_insn(env, ctx, ASE_MT); |
6135 | - GEN_LOAD_REG_TN(T0, rt); | ||
6136 | - GEN_LOAD_REG_TN(T1, rs); | 6166 | + GEN_LOAD_REG_T0(rt); |
6167 | + GEN_LOAD_REG_T1(rs); | ||
6137 | gen_op_fork(); | 6168 | gen_op_fork(); |
6138 | break; | 6169 | break; |
6139 | case OPC_YIELD: | 6170 | case OPC_YIELD: |
6140 | check_insn(env, ctx, ASE_MT); | 6171 | check_insn(env, ctx, ASE_MT); |
6141 | - GEN_LOAD_REG_TN(T0, rs); | 6172 | + GEN_LOAD_REG_T0(rs); |
6142 | gen_op_yield(); | 6173 | gen_op_yield(); |
6143 | - GEN_STORE_TN_REG(rd, T0); | 6174 | + GEN_STORE_T0_REG(rd); |
6144 | break; | 6175 | break; |
6145 | #if defined(TARGET_MIPS64) | 6176 | #if defined(TARGET_MIPS64) |
6146 | case OPC_DEXTM ... OPC_DEXT: | 6177 | case OPC_DEXTM ... OPC_DEXT: |
@@ -6155,11 +6186,11 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -6155,11 +6186,11 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
6155 | op2 = MASK_DBSHFL(ctx->opcode); | 6186 | op2 = MASK_DBSHFL(ctx->opcode); |
6156 | switch (op2) { | 6187 | switch (op2) { |
6157 | case OPC_DSBH: | 6188 | case OPC_DSBH: |
6158 | - GEN_LOAD_REG_TN(T1, rt); | 6189 | + GEN_LOAD_REG_T1(rt); |
6159 | gen_op_dsbh(); | 6190 | gen_op_dsbh(); |
6160 | break; | 6191 | break; |
6161 | case OPC_DSHD: | 6192 | case OPC_DSHD: |
6162 | - GEN_LOAD_REG_TN(T1, rt); | 6193 | + GEN_LOAD_REG_T1(rt); |
6163 | gen_op_dshd(); | 6194 | gen_op_dshd(); |
6164 | break; | 6195 | break; |
6165 | default: /* Invalid */ | 6196 | default: /* Invalid */ |
@@ -6167,7 +6198,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -6167,7 +6198,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
6167 | generate_exception(ctx, EXCP_RI); | 6198 | generate_exception(ctx, EXCP_RI); |
6168 | break; | 6199 | break; |
6169 | } | 6200 | } |
6170 | - GEN_STORE_TN_REG(rd, T0); | 6201 | + GEN_STORE_T0_REG(rd); |
6171 | break; | 6202 | break; |
6172 | #endif | 6203 | #endif |
6173 | default: /* Invalid */ | 6204 | default: /* Invalid */ |
@@ -6252,16 +6283,16 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -6252,16 +6283,16 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
6252 | generate_exception(ctx, EXCP_RI); | 6283 | generate_exception(ctx, EXCP_RI); |
6253 | break; | 6284 | break; |
6254 | } | 6285 | } |
6255 | - GEN_STORE_TN_REG(rt, T0); | 6286 | + GEN_STORE_T0_REG(rt); |
6256 | break; | 6287 | break; |
6257 | case OPC_RDPGPR: | 6288 | case OPC_RDPGPR: |
6258 | check_insn(env, ctx, ISA_MIPS32R2); | 6289 | check_insn(env, ctx, ISA_MIPS32R2); |
6259 | GEN_LOAD_SRSREG_TN(T0, rt); | 6290 | GEN_LOAD_SRSREG_TN(T0, rt); |
6260 | - GEN_STORE_TN_REG(rd, T0); | 6291 | + GEN_STORE_T0_REG(rd); |
6261 | break; | 6292 | break; |
6262 | case OPC_WRPGPR: | 6293 | case OPC_WRPGPR: |
6263 | check_insn(env, ctx, ISA_MIPS32R2); | 6294 | check_insn(env, ctx, ISA_MIPS32R2); |
6264 | - GEN_LOAD_REG_TN(T0, rt); | 6295 | + GEN_LOAD_REG_T0(rt); |
6265 | GEN_STORE_TN_SRSREG(rd, T0); | 6296 | GEN_STORE_TN_SRSREG(rd, T0); |
6266 | break; | 6297 | break; |
6267 | default: | 6298 | default: |
@@ -6589,6 +6620,7 @@ gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, | @@ -6589,6 +6620,7 @@ gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, | ||
6589 | } | 6620 | } |
6590 | } | 6621 | } |
6591 | done_generating: | 6622 | done_generating: |
6623 | + ctx.last_T0_store = NULL; | ||
6592 | *gen_opc_ptr = INDEX_op_end; | 6624 | *gen_opc_ptr = INDEX_op_end; |
6593 | if (search_pc) { | 6625 | if (search_pc) { |
6594 | j = gen_opc_ptr - gen_opc_buf; | 6626 | j = gen_opc_ptr - gen_opc_buf; |