Re: [Qemu-devel] [PATCH v6 13/25] tcg/aarch64: Implement goto_ptr

2017-05-06 Thread Aurelien Jarno
On 2017-05-02 12:22, Richard Henderson wrote:
> Measurements:
> 
>   SPECint06 (test set), x86_64-linux-user. Host: APM 
> 64-bit ARMv8 (Atlas/A57) @ 2.4 GHz
> 
>  1.45x 
> +-+-+-+
>|  *   
>|
>|  +++ *   *   
>  +goto-ptr |
>   1.4x 
> +-+...**...*+-+
>| *+++**   *   
>  +++   |
>  1.35x 
> +-+...*...**...*...*+-+
>| *   **   *   
> *+++*  |
>| *   **   *   
> *   *  |
>   1.3x 
> +-+...*...**...*...*...*+-+
>| *   **   *   
> *   *  |
>| *   **   *   
> *   ** |
>  1.25x 
> +-+...*...*...**...*...*...**...*...*...+-+
>| *   *   *   **   *   
> *   **+++*   *   * |
>   1.2x 
> +-+...*...*...*...**...*...*...**...*...*...*...+-+
>| *   *   *   **   *   
> *   **   *   *   * |
>| *   *   *   **   *   
> *   **   *   *   *   * |
>  1.15x 
> +-+...*...*...*...**...*...*...**...*...*...*...*...*...+-+
>| *   *   *   **   *   
> *   *+++ *   *   *   *   *   * |
>| *   *   *   **   *   
> *   *   **   *   *   *   *   * |
>   1.1x 
> +-+...*...*...*...**...*...*...*...*...*...*...**...*...*...*...*...*...+-+
>| *   *   *   **   *   *   *   *   *   
> *   *   *   **   *   *   *   *   * |
>  1.05x 
> +-+...*...*...*...**...*...*...*...*...*...*...*...*...**...*...*...*...*...*...+-+
>| *   *   *   *   **   *   *   *   *   *   
> *   *   *   **   *   *   *   *   * |
>| *   *   *   *   *   **   *   *   *   *   *   *   *   
> *   *   *   **   *   *   *   *   * |
> 1x 
> +-+---*---*---**---*---*---*---*---*---**---*---*---+-+
>   astar   bzip2 gccgobmk h264ref   hmmlibquantum mcf 
> omnetpperlbenchsjenxalancbmk   hmean
>   png: http://imgur.com/en9HE8L
> 
> Tested-by: Emilio G. Cota 
> Signed-off-by: Richard Henderson 
> ---
>  tcg/aarch64/tcg-target.h |  2 +-
>  tcg/aarch64/tcg-target.inc.c | 22 --
>  2 files changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h
> index b82eac4..55a46ac 100644
> --- a/tcg/aarch64/tcg-target.h
> +++ b/tcg/aarch64/tcg-target.h
> @@ -77,7 +77,7 @@ typedef enum {
>  #define TCG_TARGET_HAS_mulsh_i320
>  #define TCG_TARGET_HAS_extrl_i64_i320
>  #define TCG_TARGET_HAS_extrh_i64_i320
> -#define TCG_TARGET_HAS_goto_ptr 0
> +#define TCG_TARGET_HAS_goto_ptr 1
>  
>  #define TCG_TARGET_HAS_div_i64  1
>  #define TCG_TARGET_HAS_rem_i64  1
> diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c
> index 290de6d..5f18545 100644
> --- a/tcg/aarch64/tcg-target.inc.c
> +++ b/tcg/aarch64/tcg-target.inc.c
> @@ -1357,8 +1357,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
>  
>  switch (opc) {
>  case INDEX_op_exit_tb:
> -tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0);
> -tcg_out_goto(s, tb_ret_addr);
> +/* Reuse the zeroing that exists for goto_ptr.  */
> +if (a0 == 0) {
> +tcg_out_goto(s, s->code_gen_epilogue);
> +} else {
> +tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0);
> +tcg_out_goto(s, 

[Qemu-devel] [PATCH v6 13/25] tcg/aarch64: Implement goto_ptr

2017-05-02 Thread Richard Henderson
Measurements:

  SPECint06 (test set), x86_64-linux-user. Host: APM 64-bit 
ARMv8 (Atlas/A57) @ 2.4 GHz

 1.45x 
+-+-+-+
   |  * 
 |
   |  +++ *   * 
   +goto-ptr |
  1.4x 
+-+...**...*+-+
   | *+++**   *
+++   |
 1.35x 
+-+...*...**...*...*+-+
   | *   **   *   
*+++*  |
   | *   **   *   * 
  *  |
  1.3x 
+-+...*...**...*...*...*+-+
   | *   **   *   * 
  *  |
   | *   **   *   * 
  ** |
 1.25x 
+-+...*...*...**...*...*...**...*...*...+-+
   | *   *   *   **   *   * 
  **+++*   *   * |
  1.2x 
+-+...*...*...*...**...*...*...**...*...*...*...+-+
   | *   *   *   **   *   * 
  **   *   *   * |
   | *   *   *   **   *   * 
  **   *   *   *   * |
 1.15x 
+-+...*...*...*...**...*...*...**...*...*...*...*...*...+-+
   | *   *   *   **   *   * 
  *+++ *   *   *   *   *   * |
   | *   *   *   **   *   * 
  *   **   *   *   *   *   * |
  1.1x 
+-+...*...*...*...**...*...*...*...*...*...*...**...*...*...*...*...*...+-+
   | *   *   *   **   *   *   *   *   *   * 
  *   *   **   *   *   *   *   * |
 1.05x 
+-+...*...*...*...**...*...*...*...*...*...*...*...*...**...*...*...*...*...*...+-+
   | *   *   *   *   **   *   *   *   *   *   * 
  *   *   **   *   *   *   *   * |
   | *   *   *   *   *   **   *   *   *   *   *   *   *   * 
  *   *   **   *   *   *   *   * |
1x 
+-+---*---*---**---*---*---*---*---*---**---*---*---+-+
  astar   bzip2 gccgobmk h264ref   hmmlibquantum mcf 
omnetpperlbenchsjenxalancbmk   hmean
  png: http://imgur.com/en9HE8L

Tested-by: Emilio G. Cota 
Signed-off-by: Richard Henderson 
---
 tcg/aarch64/tcg-target.h |  2 +-
 tcg/aarch64/tcg-target.inc.c | 22 --
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h
index b82eac4..55a46ac 100644
--- a/tcg/aarch64/tcg-target.h
+++ b/tcg/aarch64/tcg-target.h
@@ -77,7 +77,7 @@ typedef enum {
 #define TCG_TARGET_HAS_mulsh_i320
 #define TCG_TARGET_HAS_extrl_i64_i320
 #define TCG_TARGET_HAS_extrh_i64_i320
-#define TCG_TARGET_HAS_goto_ptr 0
+#define TCG_TARGET_HAS_goto_ptr 1
 
 #define TCG_TARGET_HAS_div_i64  1
 #define TCG_TARGET_HAS_rem_i64  1
diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c
index 290de6d..5f18545 100644
--- a/tcg/aarch64/tcg-target.inc.c
+++ b/tcg/aarch64/tcg-target.inc.c
@@ -1357,8 +1357,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
 
 switch (opc) {
 case INDEX_op_exit_tb:
-tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0);
-tcg_out_goto(s, tb_ret_addr);
+/* Reuse the zeroing that exists for goto_ptr.  */
+if (a0 == 0) {
+tcg_out_goto(s, s->code_gen_epilogue);
+} else {
+tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0);
+tcg_out_goto(s, tb_ret_addr);
+}
 break;
 
 case INDEX_op_goto_tb:
@@ -1374,6 +1379,10 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
 s->tb_jmp_reset_offset[a0] = tcg_current_code_size(s);
 break;
 
+case