]> xenbits.xensource.com Git - qemu-xen-4.1-testing.git/commitdiff
Optimisations: avoid generation of duplicated micro-ops.
authorj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 1 Oct 2007 03:03:51 +0000 (03:03 +0000)
committerj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 1 Oct 2007 03:03:51 +0000 (03:03 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3305 c046a42c-6fe2-441c-8c8c-71466251a162

target-ppc/translate.c

index d76a92a65d65a85c443d4fc7745fabe22248975c..e599243b7348dea5c30bdb65a8f1ed4cc563a216 100644 (file)
@@ -2996,6 +2996,7 @@ static inline void gen_bcond (DisasContext *ctx, int type)
         case 6:
             if (type == BCOND_IM) {
                 gen_goto_tb(ctx, 0, target);
+                goto out;
             } else {
 #if defined(TARGET_PPC64)
                 if (ctx->sf_mode)
@@ -3004,8 +3005,9 @@ static inline void gen_bcond (DisasContext *ctx, int type)
 #endif
                     gen_op_b_T1();
                 gen_op_reset_T0();
+                goto no_test;
             }
-            goto no_test;
+            break;
         }
     } else {
         mask = 1 << (3 - (bi & 0x03));
@@ -3079,6 +3081,7 @@ static inline void gen_bcond (DisasContext *ctx, int type)
             gen_op_debug();
         gen_op_exit_tb();
     }
+ out:
     ctx->exception = POWERPC_EXCP_BRANCH;
 }
 
@@ -3381,11 +3384,15 @@ GEN_HANDLER(mtmsrd, 0x1F, 0x12, 0x05, 0x001EF801, PPC_64B)
         /* Special form that does not need any synchronisation */
         gen_op_update_riee();
     } else {
+        /* XXX: we need to update nip before the store
+         *      if we enter power saving mode, we will exit the loop
+         *      directly from ppc_store_msr
+         */
         gen_update_nip(ctx, ctx->nip);
         gen_op_store_msr();
         /* Must stop the translation as machine state (may have) changed */
         /* Note that mtmsr is not always defined as context-synchronizing */
-        GEN_STOP(ctx);
+        ctx->exception = POWERPC_EXCP_STOP;
     }
 #endif
 }
@@ -3405,6 +3412,10 @@ GEN_HANDLER(mtmsr, 0x1F, 0x12, 0x04, 0x001FF801, PPC_MISC)
         /* Special form that does not need any synchronisation */
         gen_op_update_riee();
     } else {
+        /* XXX: we need to update nip before the store
+         *      if we enter power saving mode, we will exit the loop
+         *      directly from ppc_store_msr
+         */
         gen_update_nip(ctx, ctx->nip);
 #if defined(TARGET_PPC64)
         if (!ctx->sf_mode)
@@ -3414,7 +3425,7 @@ GEN_HANDLER(mtmsr, 0x1F, 0x12, 0x04, 0x001FF801, PPC_MISC)
             gen_op_store_msr();
         /* Must stop the translation as machine state (may have) changed */
         /* Note that mtmsrd is not always defined as context-synchronizing */
-        GEN_STOP(ctx);
+        ctx->exception = POWERPC_EXCP_STOP;
     }
 #endif
 }