Commit 056b05f8d22d0fdd46bbf1fdf01e5f3a32242a16

Authored by j_mayer
1 parent b48d7d69

Optimisations: avoid generation of duplicated micro-ops.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3305 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 14 additions and 3 deletions
target-ppc/translate.c
... ... @@ -2996,6 +2996,7 @@ static inline void gen_bcond (DisasContext *ctx, int type)
2996 2996 case 6:
2997 2997 if (type == BCOND_IM) {
2998 2998 gen_goto_tb(ctx, 0, target);
  2999 + goto out;
2999 3000 } else {
3000 3001 #if defined(TARGET_PPC64)
3001 3002 if (ctx->sf_mode)
... ... @@ -3004,8 +3005,9 @@ static inline void gen_bcond (DisasContext *ctx, int type)
3004 3005 #endif
3005 3006 gen_op_b_T1();
3006 3007 gen_op_reset_T0();
  3008 + goto no_test;
3007 3009 }
3008   - goto no_test;
  3010 + break;
3009 3011 }
3010 3012 } else {
3011 3013 mask = 1 << (3 - (bi & 0x03));
... ... @@ -3079,6 +3081,7 @@ static inline void gen_bcond (DisasContext *ctx, int type)
3079 3081 gen_op_debug();
3080 3082 gen_op_exit_tb();
3081 3083 }
  3084 + out:
3082 3085 ctx->exception = POWERPC_EXCP_BRANCH;
3083 3086 }
3084 3087  
... ... @@ -3381,11 +3384,15 @@ GEN_HANDLER(mtmsrd, 0x1F, 0x12, 0x05, 0x001EF801, PPC_64B)
3381 3384 /* Special form that does not need any synchronisation */
3382 3385 gen_op_update_riee();
3383 3386 } else {
  3387 + /* XXX: we need to update nip before the store
  3388 + * if we enter power saving mode, we will exit the loop
  3389 + * directly from ppc_store_msr
  3390 + */
3384 3391 gen_update_nip(ctx, ctx->nip);
3385 3392 gen_op_store_msr();
3386 3393 /* Must stop the translation as machine state (may have) changed */
3387 3394 /* Note that mtmsr is not always defined as context-synchronizing */
3388   - GEN_STOP(ctx);
  3395 + ctx->exception = POWERPC_EXCP_STOP;
3389 3396 }
3390 3397 #endif
3391 3398 }
... ... @@ -3405,6 +3412,10 @@ GEN_HANDLER(mtmsr, 0x1F, 0x12, 0x04, 0x001FF801, PPC_MISC)
3405 3412 /* Special form that does not need any synchronisation */
3406 3413 gen_op_update_riee();
3407 3414 } else {
  3415 + /* XXX: we need to update nip before the store
  3416 + * if we enter power saving mode, we will exit the loop
  3417 + * directly from ppc_store_msr
  3418 + */
3408 3419 gen_update_nip(ctx, ctx->nip);
3409 3420 #if defined(TARGET_PPC64)
3410 3421 if (!ctx->sf_mode)
... ... @@ -3414,7 +3425,7 @@ GEN_HANDLER(mtmsr, 0x1F, 0x12, 0x04, 0x001FF801, PPC_MISC)
3414 3425 gen_op_store_msr();
3415 3426 /* Must stop the translation as machine state (may have) changed */
3416 3427 /* Note that mtmsrd is not always defined as context-synchronizing */
3417   - GEN_STOP(ctx);
  3428 + ctx->exception = POWERPC_EXCP_STOP;
3418 3429 }
3419 3430 #endif
3420 3431 }
... ...