qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/2] Queued TCG patches
@ 2015-09-02 21:41 Richard Henderson
  2015-09-02 21:41 ` [Qemu-devel] [PULL 1/2] tcg/aarch64: Fix tcg_out_qemu_{ld, st} for guest_base == 0 Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Richard Henderson @ 2015-09-02 21:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

These two patches represent all of the backlog for tcg/* of
which I'm aware.  Please pull.


r~


The following changes since commit 090d0bfd948343d522cd20bc634105b5cfe2483b:

  s390: fix softmmu compilation (2015-08-28 16:05:24 +0100)

are available in the git repository at:

  git://github.com/rth7680/qemu.git tags/pull-tcg-20150902

for you to fetch changes up to 08b0b23be639b955e5e3d84dc42fa4e5ce6a8728:

  tcg/i386: omit a few REXW prefixes in softmmu code (2015-09-02 14:24:10 -0700)

----------------------------------------------------------------
queued tcg patches

----------------------------------------------------------------
Aurelien Jarno (1):
      tcg/i386: omit a few REXW prefixes in softmmu code

Richard Henderson (1):
      tcg/aarch64: Fix tcg_out_qemu_{ld, st} for guest_base == 0

 tcg/aarch64/tcg-target.c | 27 ++++++++++++++++++++-------
 tcg/i386/tcg-target.c    | 15 +++++++++------
 2 files changed, 29 insertions(+), 13 deletions(-)

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

* [Qemu-devel] [PULL 1/2] tcg/aarch64: Fix tcg_out_qemu_{ld, st} for guest_base == 0
  2015-09-02 21:41 [Qemu-devel] [PULL 0/2] Queued TCG patches Richard Henderson
@ 2015-09-02 21:41 ` Richard Henderson
  2015-09-02 21:41 ` [Qemu-devel] [PULL 2/2] tcg/i386: omit a few REXW prefixes in softmmu code Richard Henderson
  2015-09-03 13:32 ` [Qemu-devel] [PULL 0/2] Queued TCG patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2015-09-02 21:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, v2.4.0

In ffc6372851d8631a9f9fa56ec613b3244dc635b9, we swapped the guest
base to the address base register from the address index register.
Except that 31 in the base slot is SP not XZR, so we need to be
more intelligent about which reg gets placed in which slot.

Cc: qemu-stable@nongnu.org (v2.4.0)
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/aarch64/tcg-target.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c
index 01ae610..0ed10a9 100644
--- a/tcg/aarch64/tcg-target.c
+++ b/tcg/aarch64/tcg-target.c
@@ -56,6 +56,11 @@ static const int tcg_target_call_oarg_regs[1] = {
 #define TCG_REG_TMP TCG_REG_X30
 
 #ifndef CONFIG_SOFTMMU
+/* Note that XZR cannot be encoded in the address base register slot,
+   as that actaully encodes SP.  So if we need to zero-extend the guest
+   address, via the address index register slot, we need to load even
+   a zero guest base into a register.  */
+#define USE_GUEST_BASE     (guest_base != 0 || TARGET_LONG_BITS == 32)
 #define TCG_REG_GUEST_BASE TCG_REG_X28
 #endif
 
@@ -1224,9 +1229,13 @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data_reg, TCGReg addr_reg,
     add_qemu_ldst_label(s, true, oi, ext, data_reg, addr_reg,
                         s->code_ptr, label_ptr);
 #else /* !CONFIG_SOFTMMU */
-    tcg_out_qemu_ld_direct(s, memop, ext, data_reg,
-                           guest_base ? TCG_REG_GUEST_BASE : TCG_REG_XZR,
-                           otype, addr_reg);
+    if (USE_GUEST_BASE) {
+        tcg_out_qemu_ld_direct(s, memop, ext, data_reg,
+                               TCG_REG_GUEST_BASE, otype, addr_reg);
+    } else {
+        tcg_out_qemu_ld_direct(s, memop, ext, data_reg,
+                               addr_reg, TCG_TYPE_I64, TCG_REG_XZR);
+    }
 #endif /* CONFIG_SOFTMMU */
 }
 
@@ -1245,9 +1254,13 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg data_reg, TCGReg addr_reg,
     add_qemu_ldst_label(s, false, oi, (memop & MO_SIZE)== MO_64,
                         data_reg, addr_reg, s->code_ptr, label_ptr);
 #else /* !CONFIG_SOFTMMU */
-    tcg_out_qemu_st_direct(s, memop, data_reg,
-                           guest_base ? TCG_REG_GUEST_BASE : TCG_REG_XZR,
-                           otype, addr_reg);
+    if (USE_GUEST_BASE) {
+        tcg_out_qemu_st_direct(s, memop, data_reg,
+                               TCG_REG_GUEST_BASE, otype, addr_reg);
+    } else {
+        tcg_out_qemu_st_direct(s, memop, data_reg,
+                               addr_reg, TCG_TYPE_I64, TCG_REG_XZR);
+    }
 #endif /* CONFIG_SOFTMMU */
 }
 
@@ -1806,7 +1819,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
                   CPU_TEMP_BUF_NLONGS * sizeof(long));
 
 #if !defined(CONFIG_SOFTMMU)
-    if (guest_base) {
+    if (USE_GUEST_BASE) {
         tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_GUEST_BASE, guest_base);
         tcg_regset_set_reg(s->reserved_regs, TCG_REG_GUEST_BASE);
     }
-- 
2.4.3

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

* [Qemu-devel] [PULL 2/2] tcg/i386: omit a few REXW prefixes in softmmu code
  2015-09-02 21:41 [Qemu-devel] [PULL 0/2] Queued TCG patches Richard Henderson
  2015-09-02 21:41 ` [Qemu-devel] [PULL 1/2] tcg/aarch64: Fix tcg_out_qemu_{ld, st} for guest_base == 0 Richard Henderson
@ 2015-09-02 21:41 ` Richard Henderson
  2015-09-03 13:32 ` [Qemu-devel] [PULL 0/2] Queued TCG patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2015-09-02 21:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Aurelien Jarno

From: Aurelien Jarno <aurelien@aurel32.net>

When computing the TLB address we are likely to mask out the high
32-bits by using shr + and. We can use 32-bit instructions in that
case. This saves 2 bytes per TLB access.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <1437306632-20655-1-git-send-email-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/i386/tcg-target.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index d2adbc4..9187d34 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -1178,8 +1178,8 @@ static inline void tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi,
     const TCGReg r0 = TCG_REG_L0;
     const TCGReg r1 = TCG_REG_L1;
     TCGType ttype = TCG_TYPE_I32;
-    TCGType htype = TCG_TYPE_I32;
-    int trexw = 0, hrexw = 0;
+    TCGType tlbtype = TCG_TYPE_I32;
+    int trexw = 0, hrexw = 0, tlbrexw = 0;
     int s_mask = (1 << (opc & MO_SIZE)) - 1;
     bool aligned = (opc & MO_AMASK) == MO_ALIGN || s_mask == 0;
 
@@ -1189,12 +1189,15 @@ static inline void tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi,
             trexw = P_REXW;
         }
         if (TCG_TYPE_PTR == TCG_TYPE_I64) {
-            htype = TCG_TYPE_I64;
             hrexw = P_REXW;
+            if (TARGET_PAGE_BITS + CPU_TLB_BITS > 32) {
+                tlbtype = TCG_TYPE_I64;
+                tlbrexw = P_REXW;
+            }
         }
     }
 
-    tcg_out_mov(s, htype, r0, addrlo);
+    tcg_out_mov(s, tlbtype, r0, addrlo);
     if (aligned) {
         tcg_out_mov(s, ttype, r1, addrlo);
     } else {
@@ -1203,12 +1206,12 @@ static inline void tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi,
         tcg_out_modrm_offset(s, OPC_LEA + trexw, r1, addrlo, s_mask);
     }
 
-    tcg_out_shifti(s, SHIFT_SHR + hrexw, r0,
+    tcg_out_shifti(s, SHIFT_SHR + tlbrexw, r0,
                    TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS);
 
     tgen_arithi(s, ARITH_AND + trexw, r1,
                 TARGET_PAGE_MASK | (aligned ? s_mask : 0), 0);
-    tgen_arithi(s, ARITH_AND + hrexw, r0,
+    tgen_arithi(s, ARITH_AND + tlbrexw, r0,
                 (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS, 0);
 
     tcg_out_modrm_sib_offset(s, OPC_LEA + hrexw, r0, TCG_AREG0, r0, 0,
-- 
2.4.3

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

* Re: [Qemu-devel] [PULL 0/2] Queued TCG patches
  2015-09-02 21:41 [Qemu-devel] [PULL 0/2] Queued TCG patches Richard Henderson
  2015-09-02 21:41 ` [Qemu-devel] [PULL 1/2] tcg/aarch64: Fix tcg_out_qemu_{ld, st} for guest_base == 0 Richard Henderson
  2015-09-02 21:41 ` [Qemu-devel] [PULL 2/2] tcg/i386: omit a few REXW prefixes in softmmu code Richard Henderson
@ 2015-09-03 13:32 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2015-09-03 13:32 UTC (permalink / raw)
  To: Richard Henderson; +Cc: QEMU Developers

On 2 September 2015 at 22:41, Richard Henderson <rth@twiddle.net> wrote:
> These two patches represent all of the backlog for tcg/* of
> which I'm aware.  Please pull.
>
>
> r~
>
>
> The following changes since commit 090d0bfd948343d522cd20bc634105b5cfe2483b:
>
>   s390: fix softmmu compilation (2015-08-28 16:05:24 +0100)
>
> are available in the git repository at:
>
>   git://github.com/rth7680/qemu.git tags/pull-tcg-20150902
>
> for you to fetch changes up to 08b0b23be639b955e5e3d84dc42fa4e5ce6a8728:
>
>   tcg/i386: omit a few REXW prefixes in softmmu code (2015-09-02 14:24:10 -0700)
>
> ----------------------------------------------------------------
> queued tcg patches

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2015-09-03 13:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-02 21:41 [Qemu-devel] [PULL 0/2] Queued TCG patches Richard Henderson
2015-09-02 21:41 ` [Qemu-devel] [PULL 1/2] tcg/aarch64: Fix tcg_out_qemu_{ld, st} for guest_base == 0 Richard Henderson
2015-09-02 21:41 ` [Qemu-devel] [PULL 2/2] tcg/i386: omit a few REXW prefixes in softmmu code Richard Henderson
2015-09-03 13:32 ` [Qemu-devel] [PULL 0/2] Queued TCG patches Peter Maydell

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).