aboutsummaryrefslogtreecommitdiff
path: root/tcg/aarch64
diff options
context:
space:
mode:
authorPranith Kumar <bobby.prani@gmail.com>2017-06-30 10:36:12 -0400
committerRichard Henderson <rth@twiddle.net>2017-07-09 21:10:23 -1000
commit23b7aa1d2af04ba57cc94f74d9f0ab25dce72fa0 (patch)
tree96b92ef5c4b8aaa0c2cfc64aa7c9e2d054fd6edd /tcg/aarch64
parentb11365867568ba954de667a0bfe0945b8f78d6bd (diff)
downloadqemu-23b7aa1d2af04ba57cc94f74d9f0ab25dce72fa0.zip
qemu-23b7aa1d2af04ba57cc94f74d9f0ab25dce72fa0.tar.gz
qemu-23b7aa1d2af04ba57cc94f74d9f0ab25dce72fa0.tar.bz2
tcg/aarch64: Introduce and use long branch to register
We can use a branch to register instruction for exit_tb for offsets greater than 128MB. CC: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> Message-Id: <20170630143614.31059-1-bobby.prani@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg/aarch64')
-rw-r--r--tcg/aarch64/tcg-target.inc.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c
index 1fa3bcc..8fce11a 100644
--- a/tcg/aarch64/tcg-target.inc.c
+++ b/tcg/aarch64/tcg-target.inc.c
@@ -819,6 +819,17 @@ static inline void tcg_out_goto(TCGContext *s, tcg_insn_unit *target)
tcg_out_insn(s, 3206, B, offset);
}
+static inline void tcg_out_goto_long(TCGContext *s, tcg_insn_unit *target)
+{
+ ptrdiff_t offset = target - s->code_ptr;
+ if (offset == sextract64(offset, 0, 26)) {
+ tcg_out_insn(s, 3206, BL, offset);
+ } else {
+ tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP, (intptr_t)target);
+ tcg_out_insn(s, 3207, BR, TCG_REG_TMP);
+ }
+}
+
static inline void tcg_out_goto_noaddr(TCGContext *s)
{
/* We pay attention here to not modify the branch target by reading from
@@ -1364,10 +1375,10 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
case INDEX_op_exit_tb:
/* Reuse the zeroing that exists for goto_ptr. */
if (a0 == 0) {
- tcg_out_goto(s, s->code_gen_epilogue);
+ tcg_out_goto_long(s, s->code_gen_epilogue);
} else {
tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0);
- tcg_out_goto(s, tb_ret_addr);
+ tcg_out_goto_long(s, tb_ret_addr);
}
break;