Commit 35fbce2c41f4ae302af51166f62ea48f5e54617d
1 parent
72c3a3ee
target-mips: optimize decode_opc()
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7042 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
17 additions
and
13 deletions
target-mips/translate.c
| @@ -7527,7 +7527,6 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -7527,7 +7527,6 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
| 7527 | case OPC_MOVCI: | 7527 | case OPC_MOVCI: |
| 7528 | check_insn(env, ctx, ISA_MIPS4 | ISA_MIPS32); | 7528 | check_insn(env, ctx, ISA_MIPS4 | ISA_MIPS32); |
| 7529 | if (env->CP0_Config1 & (1 << CP0C1_FP)) { | 7529 | if (env->CP0_Config1 & (1 << CP0C1_FP)) { |
| 7530 | - save_cpu_state(ctx, 1); | ||
| 7531 | check_cp1_enabled(ctx); | 7530 | check_cp1_enabled(ctx); |
| 7532 | gen_movci(ctx, rd, rs, (ctx->opcode >> 18) & 0x7, | 7531 | gen_movci(ctx, rd, rs, (ctx->opcode >> 18) & 0x7, |
| 7533 | (ctx->opcode >> 16) & 1); | 7532 | (ctx->opcode >> 16) & 1); |
| @@ -7623,28 +7622,33 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -7623,28 +7622,33 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
| 7623 | case OPC_RDHWR: | 7622 | case OPC_RDHWR: |
| 7624 | check_insn(env, ctx, ISA_MIPS32R2); | 7623 | check_insn(env, ctx, ISA_MIPS32R2); |
| 7625 | { | 7624 | { |
| 7626 | - TCGv t0 = tcg_temp_local_new(); | 7625 | + TCGv t0 = tcg_temp_new(); |
| 7627 | 7626 | ||
| 7628 | switch (rd) { | 7627 | switch (rd) { |
| 7629 | case 0: | 7628 | case 0: |
| 7630 | save_cpu_state(ctx, 1); | 7629 | save_cpu_state(ctx, 1); |
| 7631 | gen_helper_rdhwr_cpunum(t0); | 7630 | gen_helper_rdhwr_cpunum(t0); |
| 7631 | + gen_store_gpr(t0, rt); | ||
| 7632 | break; | 7632 | break; |
| 7633 | case 1: | 7633 | case 1: |
| 7634 | save_cpu_state(ctx, 1); | 7634 | save_cpu_state(ctx, 1); |
| 7635 | gen_helper_rdhwr_synci_step(t0); | 7635 | gen_helper_rdhwr_synci_step(t0); |
| 7636 | + gen_store_gpr(t0, rt); | ||
| 7636 | break; | 7637 | break; |
| 7637 | case 2: | 7638 | case 2: |
| 7638 | save_cpu_state(ctx, 1); | 7639 | save_cpu_state(ctx, 1); |
| 7639 | gen_helper_rdhwr_cc(t0); | 7640 | gen_helper_rdhwr_cc(t0); |
| 7641 | + gen_store_gpr(t0, rt); | ||
| 7640 | break; | 7642 | break; |
| 7641 | case 3: | 7643 | case 3: |
| 7642 | save_cpu_state(ctx, 1); | 7644 | save_cpu_state(ctx, 1); |
| 7643 | gen_helper_rdhwr_ccres(t0); | 7645 | gen_helper_rdhwr_ccres(t0); |
| 7646 | + gen_store_gpr(t0, rt); | ||
| 7644 | break; | 7647 | break; |
| 7645 | case 29: | 7648 | case 29: |
| 7646 | #if defined(CONFIG_USER_ONLY) | 7649 | #if defined(CONFIG_USER_ONLY) |
| 7647 | tcg_gen_ld_tl(t0, cpu_env, offsetof(CPUState, tls_value)); | 7650 | tcg_gen_ld_tl(t0, cpu_env, offsetof(CPUState, tls_value)); |
| 7651 | + gen_store_gpr(t0, rt); | ||
| 7648 | break; | 7652 | break; |
| 7649 | #else | 7653 | #else |
| 7650 | /* XXX: Some CPUs implement this in hardware. | 7654 | /* XXX: Some CPUs implement this in hardware. |
| @@ -7655,15 +7659,14 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -7655,15 +7659,14 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
| 7655 | generate_exception(ctx, EXCP_RI); | 7659 | generate_exception(ctx, EXCP_RI); |
| 7656 | break; | 7660 | break; |
| 7657 | } | 7661 | } |
| 7658 | - gen_store_gpr(t0, rt); | ||
| 7659 | tcg_temp_free(t0); | 7662 | tcg_temp_free(t0); |
| 7660 | } | 7663 | } |
| 7661 | break; | 7664 | break; |
| 7662 | case OPC_FORK: | 7665 | case OPC_FORK: |
| 7663 | check_insn(env, ctx, ASE_MT); | 7666 | check_insn(env, ctx, ASE_MT); |
| 7664 | { | 7667 | { |
| 7665 | - TCGv t0 = tcg_temp_local_new(); | ||
| 7666 | - TCGv t1 = tcg_temp_local_new(); | 7668 | + TCGv t0 = tcg_temp_new(); |
| 7669 | + TCGv t1 = tcg_temp_new(); | ||
| 7667 | 7670 | ||
| 7668 | gen_load_gpr(t0, rt); | 7671 | gen_load_gpr(t0, rt); |
| 7669 | gen_load_gpr(t1, rs); | 7672 | gen_load_gpr(t1, rs); |
| @@ -7675,8 +7678,9 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -7675,8 +7678,9 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
| 7675 | case OPC_YIELD: | 7678 | case OPC_YIELD: |
| 7676 | check_insn(env, ctx, ASE_MT); | 7679 | check_insn(env, ctx, ASE_MT); |
| 7677 | { | 7680 | { |
| 7678 | - TCGv t0 = tcg_temp_local_new(); | 7681 | + TCGv t0 = tcg_temp_new(); |
| 7679 | 7682 | ||
| 7683 | + save_cpu_state(ctx, 1); | ||
| 7680 | gen_load_gpr(t0, rs); | 7684 | gen_load_gpr(t0, rs); |
| 7681 | gen_helper_yield(t0, t0); | 7685 | gen_helper_yield(t0, t0); |
| 7682 | gen_store_gpr(t0, rd); | 7686 | gen_store_gpr(t0, rd); |
| @@ -7748,37 +7752,41 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -7748,37 +7752,41 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
| 7748 | case OPC_MFMC0: | 7752 | case OPC_MFMC0: |
| 7749 | #ifndef CONFIG_USER_ONLY | 7753 | #ifndef CONFIG_USER_ONLY |
| 7750 | { | 7754 | { |
| 7751 | - TCGv t0 = tcg_temp_local_new(); | 7755 | + TCGv t0 = tcg_temp_new(); |
| 7752 | 7756 | ||
| 7753 | op2 = MASK_MFMC0(ctx->opcode); | 7757 | op2 = MASK_MFMC0(ctx->opcode); |
| 7754 | switch (op2) { | 7758 | switch (op2) { |
| 7755 | case OPC_DMT: | 7759 | case OPC_DMT: |
| 7756 | check_insn(env, ctx, ASE_MT); | 7760 | check_insn(env, ctx, ASE_MT); |
| 7757 | gen_helper_dmt(t0, t0); | 7761 | gen_helper_dmt(t0, t0); |
| 7762 | + gen_store_gpr(t0, rt); | ||
| 7758 | break; | 7763 | break; |
| 7759 | case OPC_EMT: | 7764 | case OPC_EMT: |
| 7760 | check_insn(env, ctx, ASE_MT); | 7765 | check_insn(env, ctx, ASE_MT); |
| 7761 | gen_helper_emt(t0, t0); | 7766 | gen_helper_emt(t0, t0); |
| 7767 | + gen_store_gpr(t0, rt); | ||
| 7762 | break; | 7768 | break; |
| 7763 | case OPC_DVPE: | 7769 | case OPC_DVPE: |
| 7764 | check_insn(env, ctx, ASE_MT); | 7770 | check_insn(env, ctx, ASE_MT); |
| 7765 | gen_helper_dvpe(t0, t0); | 7771 | gen_helper_dvpe(t0, t0); |
| 7772 | + gen_store_gpr(t0, rt); | ||
| 7766 | break; | 7773 | break; |
| 7767 | case OPC_EVPE: | 7774 | case OPC_EVPE: |
| 7768 | check_insn(env, ctx, ASE_MT); | 7775 | check_insn(env, ctx, ASE_MT); |
| 7769 | gen_helper_evpe(t0, t0); | 7776 | gen_helper_evpe(t0, t0); |
| 7777 | + gen_store_gpr(t0, rt); | ||
| 7770 | break; | 7778 | break; |
| 7771 | case OPC_DI: | 7779 | case OPC_DI: |
| 7772 | check_insn(env, ctx, ISA_MIPS32R2); | 7780 | check_insn(env, ctx, ISA_MIPS32R2); |
| 7773 | - save_cpu_state(ctx, 1); | ||
| 7774 | gen_helper_di(t0); | 7781 | gen_helper_di(t0); |
| 7782 | + gen_store_gpr(t0, rt); | ||
| 7775 | /* Stop translation as we may have switched the execution mode */ | 7783 | /* Stop translation as we may have switched the execution mode */ |
| 7776 | ctx->bstate = BS_STOP; | 7784 | ctx->bstate = BS_STOP; |
| 7777 | break; | 7785 | break; |
| 7778 | case OPC_EI: | 7786 | case OPC_EI: |
| 7779 | check_insn(env, ctx, ISA_MIPS32R2); | 7787 | check_insn(env, ctx, ISA_MIPS32R2); |
| 7780 | - save_cpu_state(ctx, 1); | ||
| 7781 | gen_helper_ei(t0); | 7788 | gen_helper_ei(t0); |
| 7789 | + gen_store_gpr(t0, rt); | ||
| 7782 | /* Stop translation as we may have switched the execution mode */ | 7790 | /* Stop translation as we may have switched the execution mode */ |
| 7783 | ctx->bstate = BS_STOP; | 7791 | ctx->bstate = BS_STOP; |
| 7784 | break; | 7792 | break; |
| @@ -7787,7 +7795,6 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -7787,7 +7795,6 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
| 7787 | generate_exception(ctx, EXCP_RI); | 7795 | generate_exception(ctx, EXCP_RI); |
| 7788 | break; | 7796 | break; |
| 7789 | } | 7797 | } |
| 7790 | - gen_store_gpr(t0, rt); | ||
| 7791 | tcg_temp_free(t0); | 7798 | tcg_temp_free(t0); |
| 7792 | } | 7799 | } |
| 7793 | #endif /* !CONFIG_USER_ONLY */ | 7800 | #endif /* !CONFIG_USER_ONLY */ |
| @@ -7839,7 +7846,6 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -7839,7 +7846,6 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
| 7839 | case OPC_SWC1: | 7846 | case OPC_SWC1: |
| 7840 | case OPC_SDC1: | 7847 | case OPC_SDC1: |
| 7841 | if (env->CP0_Config1 & (1 << CP0C1_FP)) { | 7848 | if (env->CP0_Config1 & (1 << CP0C1_FP)) { |
| 7842 | - save_cpu_state(ctx, 1); | ||
| 7843 | check_cp1_enabled(ctx); | 7849 | check_cp1_enabled(ctx); |
| 7844 | gen_flt_ldst(ctx, op, rt, rs, imm); | 7850 | gen_flt_ldst(ctx, op, rt, rs, imm); |
| 7845 | } else { | 7851 | } else { |
| @@ -7849,7 +7855,6 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -7849,7 +7855,6 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
| 7849 | 7855 | ||
| 7850 | case OPC_CP1: | 7856 | case OPC_CP1: |
| 7851 | if (env->CP0_Config1 & (1 << CP0C1_FP)) { | 7857 | if (env->CP0_Config1 & (1 << CP0C1_FP)) { |
| 7852 | - save_cpu_state(ctx, 1); | ||
| 7853 | check_cp1_enabled(ctx); | 7858 | check_cp1_enabled(ctx); |
| 7854 | op1 = MASK_CP1(ctx->opcode); | 7859 | op1 = MASK_CP1(ctx->opcode); |
| 7855 | switch (op1) { | 7860 | switch (op1) { |
| @@ -7908,7 +7913,6 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -7908,7 +7913,6 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
| 7908 | 7913 | ||
| 7909 | case OPC_CP3: | 7914 | case OPC_CP3: |
| 7910 | if (env->CP0_Config1 & (1 << CP0C1_FP)) { | 7915 | if (env->CP0_Config1 & (1 << CP0C1_FP)) { |
| 7911 | - save_cpu_state(ctx, 1); | ||
| 7912 | check_cp1_enabled(ctx); | 7916 | check_cp1_enabled(ctx); |
| 7913 | op1 = MASK_CP3(ctx->opcode); | 7917 | op1 = MASK_CP3(ctx->opcode); |
| 7914 | switch (op1) { | 7918 | switch (op1) { |