qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] target/ppc: Use tcg_gen_lookup_and_goto_ptr
@ 2017-10-27 16:58 Richard Henderson
  2017-10-27 21:45 ` David Gibson
  2017-11-14 16:05 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Henderson @ 2017-10-27 16:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: david, qemu-ppc, Richard Henderson

From: Richard Henderson <rth@twiddle.net>

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
Rebased and updated for changes to tcg_gen_lookup_and_goto_ptr.

---
 target/ppc/translate.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 998fbed848..4075fc8589 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -3419,7 +3419,7 @@ static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
 }
 
 /***                                Branch                                 ***/
-static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
+static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
 {
     if (NARROW_MODE(ctx)) {
         dest = (uint32_t) dest;
@@ -3441,7 +3441,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
                 gen_debug_exception(ctx);
             }
         }
-        tcg_gen_exit_tb(0);
+        tcg_gen_lookup_and_goto_ptr();
     }
 }
 
@@ -3479,7 +3479,7 @@ static void gen_b(DisasContext *ctx)
 #define BCOND_CTR 2
 #define BCOND_TAR 3
 
-static inline void gen_bcond(DisasContext *ctx, int type)
+static void gen_bcond(DisasContext *ctx, int type)
 {
     uint32_t bo = BO(ctx->opcode);
     TCGLabel *l1;
@@ -3543,26 +3543,19 @@ static inline void gen_bcond(DisasContext *ctx, int type)
         } else {
             gen_goto_tb(ctx, 0, li);
         }
-        if ((bo & 0x14) != 0x14) {
-            gen_set_label(l1);
-            gen_goto_tb(ctx, 1, ctx->nip);
-        }
     } else {
         if (NARROW_MODE(ctx)) {
             tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3);
         } else {
             tcg_gen_andi_tl(cpu_nip, target, ~3);
         }
-        tcg_gen_exit_tb(0);
-        if ((bo & 0x14) != 0x14) {
-            gen_set_label(l1);
-            gen_update_nip(ctx, ctx->nip);
-            tcg_gen_exit_tb(0);
-        }
-    }
-    if (type == BCOND_LR || type == BCOND_CTR || type == BCOND_TAR) {
+        tcg_gen_lookup_and_goto_ptr();
         tcg_temp_free(target);
     }
+    if ((bo & 0x14) != 0x14) {
+        gen_set_label(l1);
+        gen_goto_tb(ctx, 1, ctx->nip);
+    }
 }
 
 static void gen_bc(DisasContext *ctx)
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] target/ppc: Use tcg_gen_lookup_and_goto_ptr
  2017-10-27 16:58 [Qemu-devel] [PATCH v2] target/ppc: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
@ 2017-10-27 21:45 ` David Gibson
  2017-11-14 16:05 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2017-10-27 21:45 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, qemu-ppc, Richard Henderson

[-- Attachment #1: Type: text/plain, Size: 2792 bytes --]

On Fri, Oct 27, 2017 at 06:58:14PM +0200, Richard Henderson wrote:
> From: Richard Henderson <rth@twiddle.net>
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>

Applied,thanks.

> ---
> Rebased and updated for changes to tcg_gen_lookup_and_goto_ptr.
> 
> ---
>  target/ppc/translate.c | 23 ++++++++---------------
>  1 file changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 998fbed848..4075fc8589 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -3419,7 +3419,7 @@ static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
>  }
>  
>  /***                                Branch                                 ***/
> -static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
> +static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
>  {
>      if (NARROW_MODE(ctx)) {
>          dest = (uint32_t) dest;
> @@ -3441,7 +3441,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
>                  gen_debug_exception(ctx);
>              }
>          }
> -        tcg_gen_exit_tb(0);
> +        tcg_gen_lookup_and_goto_ptr();
>      }
>  }
>  
> @@ -3479,7 +3479,7 @@ static void gen_b(DisasContext *ctx)
>  #define BCOND_CTR 2
>  #define BCOND_TAR 3
>  
> -static inline void gen_bcond(DisasContext *ctx, int type)
> +static void gen_bcond(DisasContext *ctx, int type)
>  {
>      uint32_t bo = BO(ctx->opcode);
>      TCGLabel *l1;
> @@ -3543,26 +3543,19 @@ static inline void gen_bcond(DisasContext *ctx, int type)
>          } else {
>              gen_goto_tb(ctx, 0, li);
>          }
> -        if ((bo & 0x14) != 0x14) {
> -            gen_set_label(l1);
> -            gen_goto_tb(ctx, 1, ctx->nip);
> -        }
>      } else {
>          if (NARROW_MODE(ctx)) {
>              tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3);
>          } else {
>              tcg_gen_andi_tl(cpu_nip, target, ~3);
>          }
> -        tcg_gen_exit_tb(0);
> -        if ((bo & 0x14) != 0x14) {
> -            gen_set_label(l1);
> -            gen_update_nip(ctx, ctx->nip);
> -            tcg_gen_exit_tb(0);
> -        }
> -    }
> -    if (type == BCOND_LR || type == BCOND_CTR || type == BCOND_TAR) {
> +        tcg_gen_lookup_and_goto_ptr();
>          tcg_temp_free(target);
>      }
> +    if ((bo & 0x14) != 0x14) {
> +        gen_set_label(l1);
> +        gen_goto_tb(ctx, 1, ctx->nip);
> +    }
>  }
>  
>  static void gen_bc(DisasContext *ctx)

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH v2] target/ppc: Use tcg_gen_lookup_and_goto_ptr
  2017-10-27 16:58 [Qemu-devel] [PATCH v2] target/ppc: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
  2017-10-27 21:45 ` David Gibson
@ 2017-11-14 16:05 ` Daniel Henrique Barboza
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Henrique Barboza @ 2017-11-14 16:05 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: Richard Henderson, qemu-ppc, david



On 10/27/2017 02:58 PM, Richard Henderson wrote:
> From: Richard Henderson <rth@twiddle.net>
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
> Rebased and updated for changes to tcg_gen_lookup_and_goto_ptr.
>
> ---

I am experiencing a remarkable performance boost running a simple scenario
up to SLOF prompt with this patch. It takes 50 seconds on average to get 
to SLOF
prompt as is now on my Lenovo laptop, upstream qemu and default pseries
machine. With this patch it takes 21 seconds average.


Reviewed-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>

>   target/ppc/translate.c | 23 ++++++++---------------
>   1 file changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 998fbed848..4075fc8589 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -3419,7 +3419,7 @@ static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
>   }
>
>   /***                                Branch                                 ***/
> -static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
> +static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
>   {
>       if (NARROW_MODE(ctx)) {
>           dest = (uint32_t) dest;
> @@ -3441,7 +3441,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
>                   gen_debug_exception(ctx);
>               }
>           }
> -        tcg_gen_exit_tb(0);
> +        tcg_gen_lookup_and_goto_ptr();
>       }
>   }
>
> @@ -3479,7 +3479,7 @@ static void gen_b(DisasContext *ctx)
>   #define BCOND_CTR 2
>   #define BCOND_TAR 3
>
> -static inline void gen_bcond(DisasContext *ctx, int type)
> +static void gen_bcond(DisasContext *ctx, int type)
>   {
>       uint32_t bo = BO(ctx->opcode);
>       TCGLabel *l1;
> @@ -3543,26 +3543,19 @@ static inline void gen_bcond(DisasContext *ctx, int type)
>           } else {
>               gen_goto_tb(ctx, 0, li);
>           }
> -        if ((bo & 0x14) != 0x14) {
> -            gen_set_label(l1);
> -            gen_goto_tb(ctx, 1, ctx->nip);
> -        }
>       } else {
>           if (NARROW_MODE(ctx)) {
>               tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3);
>           } else {
>               tcg_gen_andi_tl(cpu_nip, target, ~3);
>           }
> -        tcg_gen_exit_tb(0);
> -        if ((bo & 0x14) != 0x14) {
> -            gen_set_label(l1);
> -            gen_update_nip(ctx, ctx->nip);
> -            tcg_gen_exit_tb(0);
> -        }
> -    }
> -    if (type == BCOND_LR || type == BCOND_CTR || type == BCOND_TAR) {
> +        tcg_gen_lookup_and_goto_ptr();
>           tcg_temp_free(target);
>       }
> +    if ((bo & 0x14) != 0x14) {
> +        gen_set_label(l1);
> +        gen_goto_tb(ctx, 1, ctx->nip);
> +    }
>   }
>
>   static void gen_bc(DisasContext *ctx)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-14 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-27 16:58 [Qemu-devel] [PATCH v2] target/ppc: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
2017-10-27 21:45 ` David Gibson
2017-11-14 16:05 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).