Skip to contentSkip to conversation

Queued tcg patches

GIT PULL Richard Henderson 1 participant 5 messages Jul 15, 2013 – Jul 23, 2013

lore
Share & tools
lore
#0 lore raw

The following are the outstanding TCG patches (that I know of) that have been previously posted and reviewed. Please pull.

r~

The following changes since commit 2562becfc126ed7678c662ee23b7c1fe135d8966:

Merge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging (2013-07-15 14:02:41 -0500)

are available in the git repository at:

git://github.com/rth7680/qemu.git tcg-next

for you to fetch changes up to f290e4988dd8eb012de0517a1ff93df130e87da1:

Merge git://github.com/hw-claudio/qemu-aarch64-queue into tcg-next (2013-07-15 13:21:10 -0700)

----------------------------------------------------------------

Claudio Fontana (1):
tcg/aarch64: implement ldst 12bit scaled uimm offset

Jani Kokkonen (1):
tcg/aarch64: Implement tlb lookup fast path

Richard Henderson (2):
tcg: Remove temp_buf
Merge git://github.com/hw-claudio/qemu-aarch64-queue into tcg-next

 configure                |   2 +-
 include/exec/cpu-defs.h  |   2 -
 include/exec/exec-all.h  |  14 +++
 tcg/aarch64/tcg-target.c | 256 +++++++++++++++++++++++++++++++++++++----------
 4 files changed, 218 insertions(+), 56 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/3] tcg/aarch64: implement ldst 12bit scaled uimm offset

From: Claudio Fontana <[email protected]>

implement the 12bit scaled unsigned immediate offset variant of LDR/STR. This improves code size by avoiding the movi + ldst_r for naturally aligned offsets in range.

---
 tcg/aarch64/tcg-target.c | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)
tcg/aarch64/tcg-target.c +29 -3
index 562a549..cfd4081 100644
@@ -315,6 +315,17 @@ static inline void tcg_out_ldst_9(TCGContext *s,
     tcg_out32(s, op_data << 24 | mod << 20 | off << 12 | rn << 5 | rd);
 }
 
+/* tcg_out_ldst_12 expects a scaled unsigned immediate offset */
+static inline void tcg_out_ldst_12(TCGContext *s,
+                                   enum aarch64_ldst_op_data op_data,
+                                   enum aarch64_ldst_op_type op_type,
+                                   TCGReg rd, TCGReg rn,
+                                   tcg_target_ulong scaled_uimm)
+{
+    tcg_out32(s, (op_data | 1) << 24
+              | op_type << 20 | scaled_uimm << 10 | rn << 5 | rd);
+}
+
 static inline void tcg_out_movr(TCGContext *s, int ext, TCGReg rd, TCGReg src)
 {
     /* register to register move using MOV (shifted register with no shift) */
@@ -374,10 +385,25 @@ static inline void tcg_out_ldst(TCGContext *s, enum aarch64_ldst_op_data data,
 {
     if (offset >= -256 && offset < 256) {
         tcg_out_ldst_9(s, data, type, rd, rn, offset);
-    } else {
-        tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP, offset);
-        tcg_out_ldst_r(s, data, type, rd, rn, TCG_REG_TMP);
+        return;
     }
+
+    if (offset >= 256) {
+        /* if the offset is naturally aligned and in range,
+           then we can use the scaled uimm12 encoding */
+        unsigned int s_bits = data >> 6;
+        if (!(offset & ((1 << s_bits) - 1))) {
+            tcg_target_ulong scaled_uimm = offset >> s_bits;
+            if (scaled_uimm <= 0xfff) {
+                tcg_out_ldst_12(s, data, type, rd, rn, scaled_uimm);
+                return;
+            }
+        }
+    }
+
+    /* worst-case scenario, move offset to temp register, use reg offset */
+    tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP, offset);
+    tcg_out_ldst_r(s, data, type, rd, rn, TCG_REG_TMP);
 }
 
 /* mov alias implemented with add immediate, useful to move to/from SP */
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL 2/3] tcg/aarch64: Implement tlb lookup fast path

In reply to Richard Henderson

From: Jani Kokkonen <[email protected]>

Supports CONFIG_QEMU_LDST_OPTIMIZATION

---
 configure                |   2 +-
 include/exec/exec-all.h  |  14 +++
 tcg/aarch64/tcg-target.c | 224 ++++++++++++++++++++++++++++++++++++-----------
 3 files changed, 189 insertions(+), 51 deletions(-)
configure +1 -1
index 0e0adde..8e425ba 100755
@@ -3594,7 +3594,7 @@ echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
 echo "ARCH=$ARCH" >> $config_host_mak
 
 case "$cpu" in
-  arm|i386|x86_64|ppc)
+  arm|i386|x86_64|ppc|aarch64)
     # The TCG interpreter currently does not support ld/st optimization.
     if test "$tcg_interpreter" = "no" ; then
         echo "CONFIG_QEMU_LDST_OPTIMIZATION=y" >> $config_host_mak
include/exec/exec-all.h +14 -0
index b2162a4..5920f73 100644
@@ -358,6 +358,20 @@ static inline uintptr_t tcg_getpc_ldst(uintptr_t ra)
                                    not the start of the next opcode  */
     return ra;
 }
+#elif defined(__aarch64__)
+#  define GETRA()       ((uintptr_t)__builtin_return_address(0))
+#  define GETPC_LDST()  tcg_getpc_ldst(GETRA())
+static inline uintptr_t tcg_getpc_ldst(uintptr_t ra)
+{
+    int32_t b;
+    ra += 4;                    /* skip one instruction */
+    b = *(int32_t *)ra;         /* load the branch insn */
+    b = (b << 6) >> (6 - 2);    /* extract the displacement */
+    ra += b;                    /* apply the displacement  */
+    ra -= 4;                    /* return a pointer into the current opcode,
+                                   not the start of the next opcode  */
+    return ra;
+}
 # else
 #  error "CONFIG_QEMU_LDST_OPTIMIZATION needs GETPC_LDST() implementation!"
 # endif
tcg/aarch64/tcg-target.c +174 -50

272 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#3 lore raw

[Qemu-devel] [PULL 3/3] tcg: Remove temp_buf

In reply to Richard Henderson

All targets have been converted to allocating space for temporaries on the stack. No need to allocate space within the CPU_COMMON block.

---
 include/exec/cpu-defs.h | 2 --
 1 file changed, 2 deletions(-)
include/exec/cpu-defs.h +0 -2
index 39094b3..5321171 100644
@@ -154,8 +154,6 @@ typedef struct CPUWatchpoint {
                                      memory was accessed */             \
     CPU_COMMON_TLB                                                      \
     struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE];           \
-    /* buffer for temporaries in the code generator */                  \
-    long temp_buf[CPU_TEMP_BUF_NLONGS];                                 \
                                                                         \
     int64_t icount_extra; /* Instructions until next timer event.  */   \
     /* Number of cycles left, with interrupt flag in high bit.          \
Signature · 1 line
1.8.3.1
#4 lore raw
In reply to Richard Henderson

Ping.

r~

Quoted 38 lines · Richard Henderson

The following are the outstanding TCG patches (that I know of) that have been previously posted and reviewed. Please pull.

r~

The following changes since commit 2562becfc126ed7678c662ee23b7c1fe135d8966:

Merge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging (2013-07-15 14:02:41 -0500)

are available in the git repository at:

git://github.com/rth7680/qemu.git tcg-next

for you to fetch changes up to f290e4988dd8eb012de0517a1ff93df130e87da1:

Merge git://github.com/hw-claudio/qemu-aarch64-queue into tcg-next (2013-07-15 13:21:10 -0700)

----------------------------------------------------------------

Claudio Fontana (1):
tcg/aarch64: implement ldst 12bit scaled uimm offset

Jani Kokkonen (1):
tcg/aarch64: Implement tlb lookup fast path

Richard Henderson (2):
tcg: Remove temp_buf
Merge git://github.com/hw-claudio/qemu-aarch64-queue into tcg-next

 configure                |   2 +-
 include/exec/cpu-defs.h  |   2 -
 include/exec/exec-all.h  |  14 +++
 tcg/aarch64/tcg-target.c | 256 +++++++++++++++++++++++++++++++++++++----------
 4 files changed, 218 insertions(+), 56 deletions(-)