qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] tcg/aarch64: Use ADR for shorter jumps


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH] tcg/aarch64: Use ADR for shorter jumps
Date: Wed, 12 Jul 2017 13:08:08 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/12/2017 12:14 PM, Pranith Kumar wrote:
Use ADR instruction for shorter jumps.

I was going through rth's email and realized that I should have done
this the first time.

Signed-off-by: Pranith Kumar <address@hidden>
---
  tcg/aarch64/tcg-target.inc.c | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c
index 04bc369a92..5121ebc1a1 100644
--- a/tcg/aarch64/tcg-target.inc.c
+++ b/tcg/aarch64/tcg-target.inc.c
@@ -886,12 +886,16 @@ void aarch64_tb_set_jmp_target(uintptr_t jmp_addr, 
uintptr_t addr)
          i1 = I3206_B | ((offset >> 2) & 0x3ffffff);
          i2 = NOP;
      } else {
-        offset = (addr >> 12) - (jmp_addr >> 12);
+        if (offset == sextract64(offset, 0, 21)) {
+            i1 = I3406_ADR;
+            i2 = NOP;
+        } else {

This is dead code because it is covered by the direct jump above.
B has a 26-bit range, whereas ADR has a 21-bit range.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]