tcg patch queue
The following changes since commit 15df33ceb73cb6bb3c6736cf4d2cff51129ed4b4:
Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20220312-1' into staging (2022-03-13 17:29:18 +0000)
are available in the Git repository at:
https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20220314
for you to fetch changes up to 76cff100beeae8d3676bb658cccd45ef5ced8aa9:
tcg/arm: Don't emit UNPREDICTABLE LDRD with Rm == Rt or Rt+1 (2022-03-14 10:31:51 -0700)
----------------------------------------------------------------
Fixes for s390x host vectors
Fix for arm ldrd unpredictable case
----------------------------------------------------------------
Richard Henderson (4):
tcg/s390x: Fix tcg_out_dupi_vec vs VGM
tcg/s390x: Fix INDEX_op_bitsel_vec vs VSEL
tcg/s390x: Fix tcg_out_dup_vec vs general registers
tcg/arm: Don't emit UNPREDICTABLE LDRD with Rm == Rt or Rt+1tcg/arm/tcg-target.c.inc | 17 +++++++++++++++-- tcg/s390x/tcg-target.c.inc | 7 ++++--- 2 files changed, 19 insertions(+), 5 deletions(-)
[PULL 3/4] tcg/s390x: Fix tcg_out_dup_vec vs general registers
We copied the data from the general register input to the vector register output, but have not yet replicated it. We intended to fall through into the vector-vector case, but failed to redirect the input register.
This is caught by an assertion failure in tcg_out_insn_VRIc, which diagnosed the incorrect register class.
--- tcg/s390x/tcg-target.c.inc | 1 + 1 file changed, 1 insertion(+)
tcg/s390x/tcg-target.c.inc +1 -0
@@ -2675,6 +2675,7 @@ static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, if (vece == MO_64) { return true; } + src = dst; } /*
Signature · 1 line
2.25.1
[PULL 2/4] tcg/s390x: Fix INDEX_op_bitsel_vec vs VSEL
In reply to Richard HendersonThe operands are output in the wrong order: the tcg selector argument is first, whereas the s390x selector argument is last.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/898
--- tcg/s390x/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tcg/s390x/tcg-target.c.inc +1 -1
@@ -2868,7 +2868,7 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_bitsel_vec: - tcg_out_insn(s, VRRe, VSEL, a0, a1, a2, args[3]); + tcg_out_insn(s, VRRe, VSEL, a0, a2, args[3], a1); break; case INDEX_op_cmp_vec:
Signature · 1 line
2.25.1
[PULL 1/4] tcg/s390x: Fix tcg_out_dupi_vec vs VGM
In reply to Richard HendersonThe immediate operands to VGM were in the wrong order, producing an inverse mask.
--- tcg/s390x/tcg-target.c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tcg/s390x/tcg-target.c.inc +2 -2
@@ -2715,7 +2715,7 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, msb = clz32(val); lsb = 31 - ctz32(val); } - tcg_out_insn(s, VRIb, VGM, dst, lsb, msb, MO_32); + tcg_out_insn(s, VRIb, VGM, dst, msb, lsb, MO_32); return; } } else {
@@ -2729,7 +2729,7 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, msb = clz64(val); lsb = 63 - ctz64(val); } - tcg_out_insn(s, VRIb, VGM, dst, lsb, msb, MO_64); + tcg_out_insn(s, VRIb, VGM, dst, msb, lsb, MO_64); return; } }
Signature · 1 line
2.25.1
[PULL 4/4] tcg/arm: Don't emit UNPREDICTABLE LDRD with Rm == Rt or Rt+1
In reply to Richard HendersonThe LDRD (register) instruction is UNPREDICTABLE if the Rm register is the same as either Rt or Rt+1 (the two registers being loaded to). We weren't making sure we avoided this, with the result that on some host CPUs like the Cortex-A7 we would get a SIGILL because the CPU chooses to UNDEF for this particular UNPREDICTABLE case.
Since we've already checked that datalo is aligned, we can simplify the test vs the Rm operand by aligning it before comparison. Check for the two orderings before falling back to two ldr instructions.
We don't bother to do anything similar for tcg_out_ldrd_rwb(), because it is only used in tcg_out_tlb_read() with a fixed set of registers which don't overlap.
There is no equivalent UNPREDICTABLE case for STRD.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/896
--- tcg/arm/tcg-target.c.inc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
tcg/arm/tcg-target.c.inc +15 -2
@@ -1689,8 +1689,21 @@ static void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, /* LDRD requires alignment; double-check that. */ if (get_alignment_bits(opc) >= MO_64 && (datalo & 1) == 0 && datahi == datalo + 1) { - tcg_out_ldrd_r(s, COND_AL, datalo, addrlo, addend); - } else if (scratch_addend) { + /* + * Rm (the second address op) must not overlap Rt or Rt + 1. + * Since datalo is aligned, we can simplify the test via alignment. + * Flip the two address arguments if that works. + */ + if ((addend & ~1) != datalo) { + tcg_out_ldrd_r(s, COND_AL, datalo, addrlo, addend); + break; + } + if ((addrlo & ~1) != datalo) { + tcg_out_ldrd_r(s, COND_AL, datalo, addend, addrlo); + break; + } + } + if (scratch_addend) { tcg_out_ld32_rwb(s, COND_AL, datalo, addend, addrlo); tcg_out_ld32_12(s, COND_AL, datahi, addend, 4); } else {
Signature · 1 line
2.25.1
Peter Maydell
AppliedQuoted 9 lines · Richard Henderson
The following changes since commit
15df33ceb73cb6bb3c6736cf4d2cff51129ed4b4:Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20220312-1' into staging (2022-03-13 17:29:18 +0000)
are available in the Git repository at:
https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20220314
Quoted 8 lines
for you to fetch changes up to
76cff100beeae8d3676bb658cccd45ef5ced8aa9:tcg/arm: Don't emit UNPREDICTABLE LDRD with Rm == Rt or Rt+1 (2022-03-14 10:31:51 -0700)
----------------------------------------------------------------
Fixes for s390x host vectors
Fix for arm ldrd unpredictable case
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.
-- PMM