Patchwork [v5,17/19] tcg-arm: Use movi32 + blx for calls on v7

login
register
mail settings
Submitter Richard Henderson
Date March 31, 2013, 10:35 p.m.
Message ID <1364769305-3687-18-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/232643/
State New
Headers show

Comments

Richard Henderson - March 31, 2013, 10:35 p.m.
Work better with branch predition when we have movw+movt,
as the size of the code is the same.  Perhaps re-evaluate
when we have a proper constant pool.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/arm/tcg-target.c | 3 +++
 1 file changed, 3 insertions(+)
Aurelien Jarno - April 22, 2013, 9:55 a.m.
On Sun, Mar 31, 2013 at 03:35:03PM -0700, Richard Henderson wrote:
> Work better with branch predition when we have movw+movt,
> as the size of the code is the same.  Perhaps re-evaluate
> when we have a proper constant pool.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  tcg/arm/tcg-target.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
> index 35598a8..ff6dc90 100644
> --- a/tcg/arm/tcg-target.c
> +++ b/tcg/arm/tcg-target.c
> @@ -1019,6 +1019,9 @@ static inline void tcg_out_call(TCGContext *s, uint32_t addr)
>          } else {
>              tcg_out_bl(s, COND_AL, val);
>          }
> +    } else if (use_armv7_instructions) {
> +        tcg_out_movi32(s, COND_AL, TCG_REG_TMP, addr);
> +        tcg_out_blx(s, COND_AL, TCG_REG_TMP);
>      } else {
>          tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R14, TCG_REG_PC, 4);
>          tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, -4);

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>

Patch

diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
index 35598a8..ff6dc90 100644
--- a/tcg/arm/tcg-target.c
+++ b/tcg/arm/tcg-target.c
@@ -1019,6 +1019,9 @@  static inline void tcg_out_call(TCGContext *s, uint32_t addr)
         } else {
             tcg_out_bl(s, COND_AL, val);
         }
+    } else if (use_armv7_instructions) {
+        tcg_out_movi32(s, COND_AL, TCG_REG_TMP, addr);
+        tcg_out_blx(s, COND_AL, TCG_REG_TMP);
     } else {
         tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R14, TCG_REG_PC, 4);
         tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, -4);