Skip to contentSkip to conversation

tcg patch queue

GIT PULL Applied Richard Henderson 2 participants 3 messages Dec 17, 2018

lore
Share & tools
lore
#0 lore raw

Now include a patch to address

qemu-system-x86_64: /home/pm215/qemu/tcg/sparc/tcg-target.inc.c:319:
patch_reloc: Assertion `check_fit_ptr(value, 13)' failed.

I believe it was the change to bswap64 to use the constant pool more often that exposed the latent problem.

Only re-posting the new patch.

r~

The following changes since commit 58b1f0f21edcab13f78a376b1d90267626be1275:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2018-12-16 12:49:06 +0000)

are available in the Git repository at:

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

for you to fetch changes up to b7c2cd08a6f68010ad27c9c0bf2fde02fb743a0e:

xxhash: match output against the original xxhash32 (2018-12-17 06:04:44 +0300)

----------------------------------------------------------------
- Remove retranslation remenents
- Return success from patch_reloc
- Preserve 32-bit values as zero-extended on x86_64
- Make bswap during memory ops as optional
- Cleanup xxhash
- Revert constant pooling for tcg/sparc/

----------------------------------------------------------------
Alistair Francis (1):
tcg/mips: Improve the add2/sub2 command to use TCG_TARGET_REG_BITS

Emilio G. Cota (5):
tcg: Drop nargs from tcg_op_insert_{before,after}
qht-bench: document -p flag
exec: introduce qemu_xxhash{2,4,5,6,7}
include: move exec/tb-hash-xx.h to qemu/xxhash.h
xxhash: match output against the original xxhash32

Richard Henderson (27):
target/sparc: Remove the constant pool
tcg/i386: Always use %ebp for TCG_AREG0
tcg/i386: Move TCG_REG_CALL_STACK from define to enum tcg/aarch64: Remove reloc_pc26_atomic
tcg/aarch64: Fold away "noaddr" branch routines tcg/arm: Remove reloc_pc24_atomic
tcg/arm: Fold away "noaddr" branch routines
tcg/ppc: Fold away "noaddr" branch routines tcg/s390: Remove retranslation code
tcg/sparc: Remove retranslation code
tcg/mips: Remove retranslation code
tcg: Return success from patch_reloc
tcg/i386: Return false on failure from patch_reloc tcg/aarch64: Return false on failure from patch_reloc tcg/arm: Return false on failure from patch_reloc tcg/ppc: Return false on failure from patch_reloc tcg/s390x: Return false on failure from patch_reloc tcg/i386: Propagate is64 to tcg_out_qemu_ld_direct tcg/i386: Propagate is64 to tcg_out_qemu_ld_slow_path tcg/i386: Implement INDEX_op_extr{lh}_i64_i32 for 32-bit guests tcg/i386: Assume 32-bit values are zero-extended tcg/i386: Precompute all guest_base parameters tcg/i386: Add setup_guest_base_seg for FreeBSD
tcg: Clean up generic bswap32
tcg: Clean up generic bswap64
tcg/optimize: Optimize bswap
tcg: Add TCG_TARGET_HAS_MEMORY_BSWAP

 include/exec/tb-hash.h                       |   4 +-
 include/{exec/tb-hash-xx.h => qemu/xxhash.h} |  47 ++++--
 tcg/aarch64/tcg-target.h                     |   1 +
 tcg/arm/tcg-target.h                         |   1 +
 tcg/i386/tcg-target.h                        |  17 +--
 tcg/mips/tcg-target.h                        |   1 +
 tcg/ppc/tcg-target.h                         |   1 +
 tcg/s390/tcg-target.h                        |   1 +
 tcg/sparc/tcg-target.h                       |   1 +
 tcg/tcg.h                                    |   4 +-
 tcg/tci/tcg-target.h                         |   2 +
 tcg/aarch64/tcg-target.inc.c                 |  71 +++------
 tcg/arm/tcg-target.inc.c                     |  55 +++----
 tcg/i386/tcg-target.inc.c                    | 208 ++++++++++++--------------
 tcg/mips/tcg-target.inc.c                    |  12 +-
 tcg/optimize.c                               |  16 +-
 tcg/ppc/tcg-target.inc.c                     |  60 ++++----
 tcg/s390/tcg-target.inc.c                    |  45 +++---
 tcg/sparc/tcg-target.inc.c                   |  58 ++------
 tcg/tcg-op.c                                 | 215 ++++++++++++++++++++-------
 tcg/tcg.c                                    |  18 +--
 tcg/tci/tcg-target.inc.c                     |   3 +-
 tests/qht-bench.c                            |   5 +-
 util/qsp.c                                   |  14 +-
 24 files changed, 460 insertions(+), 400 deletions(-)
 rename include/{exec/tb-hash-xx.h => qemu/xxhash.h} (73%)
#1 lore raw

[Qemu-devel] [PULL v2 01/33] target/sparc: Remove the constant pool

Partially reverts ab20bdc1162. The 14-bit displacement that we allowed to reach the constant pool is not always sufficient. Retain the tb-relative addressing, as that is how most return values from the tb are computed.

---
 tcg/sparc/tcg-target.inc.c | 47 ++++++++------------------------------
 1 file changed, 9 insertions(+), 38 deletions(-)
tcg/sparc/tcg-target.inc.c +9 -38
index 04bdc3df5e..3237ae6a2f 100644
@@ -311,24 +311,6 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int type,
         insn &= ~INSN_OFF19(-1);
         insn |= INSN_OFF19(pcrel);
         break;
-    case R_SPARC_13:
-        /* Note that we're abusing this reloc type for our own needs.  */
-        if (!check_fit_ptr(value, 13)) {
-            int adj = (value > 0 ? 0xff8 : -0x1000);
-            value -= adj;
-            assert(check_fit_ptr(value, 13));
-            *code_ptr++ = (ARITH_ADD | INSN_RD(TCG_REG_T2)
-                           | INSN_RS1(TCG_REG_TB) | INSN_IMM13(adj));
-            insn ^= INSN_RS1(TCG_REG_TB) ^ INSN_RS1(TCG_REG_T2);
-        }
-        insn &= ~INSN_IMM13(-1);
-        insn |= INSN_IMM13(value);
-        break;
-    case R_SPARC_32:
-        /* Note that we're abusing this reloc type for our own needs.  */
-        code_ptr[0] = deposit32(code_ptr[0], 0, 22, value >> 10);
-        code_ptr[1] = deposit32(code_ptr[1], 0, 10, value);
-        return;
     default:
         g_assert_not_reached();
     }
@@ -459,6 +441,15 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret,
         return;
     }
 
+    /* A 13-bit constant relative to the TB.  */
+    if (!in_prologue && USE_REG_TB) {
+        test = arg - (uintptr_t)s->code_gen_ptr;
+        if (check_fit_ptr(test, 13)) {
+            tcg_out_arithi(s, ret, TCG_REG_TB, test, ARITH_ADD);
+            return;
+        }
+    }
+
     /* A 32-bit constant, or 32-bit zero-extended to 64-bits.  */
     if (type == TCG_TYPE_I32 || arg == (uint32_t)arg) {
         tcg_out_sethi(s, ret, arg);
@@ -488,26 +479,6 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret,
         return;
     }
 
-    if (!in_prologue) {
-        if (USE_REG_TB) {
-            intptr_t diff = arg - (uintptr_t)s->code_gen_ptr;
-            if (check_fit_ptr(diff, 13)) {
-                tcg_out_arithi(s, ret, TCG_REG_TB, diff, ARITH_ADD);
-            } else {
-                new_pool_label(s, arg, R_SPARC_13, s->code_ptr,
-                               -(intptr_t)s->code_gen_ptr);
-                tcg_out32(s, LDX | INSN_RD(ret) | INSN_RS1(TCG_REG_TB));
-                /* May be used to extend the 13-bit range in patch_reloc.  */
-                tcg_out32(s, NOP);
-            }
-        } else {
-            new_pool_label(s, arg, R_SPARC_32, s->code_ptr, 0);
-            tcg_out_sethi(s, ret, 0);
-            tcg_out32(s, LDX | INSN_RD(ret) | INSN_RS1(ret) | INSN_IMM13(0));
-        }
-        return;
-    }
-
     /* A 64-bit constant decomposed into 2 32-bit pieces.  */
     if (check_fit_i32(lo, 13)) {
         hi = (arg - lo) >> 32;
Signature · 1 line
2.17.2
#2 lore raw
In reply to Richard Henderson
Quoted 21 lines · Richard Henderson

Now include a patch to address

qemu-system-x86_64: /home/pm215/qemu/tcg/sparc/tcg-target.inc.c:319:
patch_reloc: Assertion `check_fit_ptr(value, 13)' failed.

I believe it was the change to bswap64 to use the constant pool more often that exposed the latent problem.

Only re-posting the new patch.

r~

The following changes since commit 58b1f0f21edcab13f78a376b1d90267626be1275:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2018-12-16 12:49:06 +0000)

are available in the Git repository at:

Quoted 7 lines

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

for you to fetch changes up to b7c2cd08a6f68010ad27c9c0bf2fde02fb743a0e:

xxhash: match output against the original xxhash32 (2018-12-17 06:04:44 +0300)

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

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.

-- PMM