* [Qemu-devel] [PULL] tcg bugfix pull
@ 2014-05-14 16:59 Richard Henderson
2014-05-14 16:59 ` [Qemu-devel] [PULL] tcg: Fix tcg_reg_alloc_mov vs no-op truncation Richard Henderson
2014-05-15 16:28 ` [Qemu-devel] [PULL] tcg bugfix pull Peter Maydell
0 siblings, 2 replies; 3+ messages in thread
From: Richard Henderson @ 2014-05-14 16:59 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
Definitely fixes ppc64 host, maybe fixes s390 host.
Please pull.
r~
The following changes since commit f30d56e7d63fe2f536511bffa13306bec2e01c37:
Merge remote-tracking branch 'remotes/rth/fix-i386' into staging (2014-05-13 18:36:19 +0100)
are available in the git repository at:
git://github.com/rth7680/qemu.git fix-mov
for you to fetch changes up to 450445d543a33fdb1d18a18ab7669a33dc1ca7ae:
tcg: Fix tcg_reg_alloc_mov vs no-op truncation (2014-05-14 09:56:13 -0700)
----------------------------------------------------------------
Richard Henderson (1):
tcg: Fix tcg_reg_alloc_mov vs no-op truncation
tcg/tcg.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PULL] tcg: Fix tcg_reg_alloc_mov vs no-op truncation
2014-05-14 16:59 [Qemu-devel] [PULL] tcg bugfix pull Richard Henderson
@ 2014-05-14 16:59 ` Richard Henderson
2014-05-15 16:28 ` [Qemu-devel] [PULL] tcg bugfix pull Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2014-05-14 16:59 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
Commit af3cbfbe8018ccc16fb3a0048e928f66f0d05e87 hoisted some "common"
loads of the temporary type, forgetting that the types could differ
during truncating moves. This affects the correctness of the memory
offset on big-endian hosts.
Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
tcg/tcg.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 0670aff..ea8aa70 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2096,12 +2096,15 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOpDef *def,
{
TCGRegSet allocated_regs;
TCGTemp *ts, *ots;
- TCGType type;
+ TCGType otype, itype;
tcg_regset_set(allocated_regs, s->reserved_regs);
ots = &s->temps[args[0]];
ts = &s->temps[args[1]];
- type = ots->type;
+
+ /* Note that otype != itype for no-op truncation. */
+ otype = ots->type;
+ itype = ts->type;
/* If the source value is not in a register, and we're going to be
forced to have it in a register in order to perform the copy,
@@ -2109,13 +2112,13 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOpDef *def,
we don't have to reload SOURCE the next time it is used. */
if (((NEED_SYNC_ARG(0) || ots->fixed_reg) && ts->val_type != TEMP_VAL_REG)
|| ts->val_type == TEMP_VAL_MEM) {
- ts->reg = tcg_reg_alloc(s, tcg_target_available_regs[type],
+ ts->reg = tcg_reg_alloc(s, tcg_target_available_regs[itype],
allocated_regs);
if (ts->val_type == TEMP_VAL_MEM) {
- tcg_out_ld(s, type, ts->reg, ts->mem_reg, ts->mem_offset);
+ tcg_out_ld(s, itype, ts->reg, ts->mem_reg, ts->mem_offset);
ts->mem_coherent = 1;
} else if (ts->val_type == TEMP_VAL_CONST) {
- tcg_out_movi(s, type, ts->reg, ts->val);
+ tcg_out_movi(s, itype, ts->reg, ts->val);
}
s->reg_to_temp[ts->reg] = args[1];
ts->val_type = TEMP_VAL_REG;
@@ -2130,7 +2133,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOpDef *def,
if (!ots->mem_allocated) {
temp_allocate_frame(s, args[0]);
}
- tcg_out_st(s, type, ts->reg, ots->mem_reg, ots->mem_offset);
+ tcg_out_st(s, otype, ts->reg, ots->mem_reg, ots->mem_offset);
if (IS_DEAD_ARG(1)) {
temp_dead(s, args[1]);
}
@@ -2158,10 +2161,10 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOpDef *def,
/* When allocating a new register, make sure to not spill the
input one. */
tcg_regset_set_reg(allocated_regs, ts->reg);
- ots->reg = tcg_reg_alloc(s, tcg_target_available_regs[type],
+ ots->reg = tcg_reg_alloc(s, tcg_target_available_regs[otype],
allocated_regs);
}
- tcg_out_mov(s, type, ots->reg, ts->reg);
+ tcg_out_mov(s, otype, ots->reg, ts->reg);
}
ots->val_type = TEMP_VAL_REG;
ots->mem_coherent = 0;
--
1.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PULL] tcg bugfix pull
2014-05-14 16:59 [Qemu-devel] [PULL] tcg bugfix pull Richard Henderson
2014-05-14 16:59 ` [Qemu-devel] [PULL] tcg: Fix tcg_reg_alloc_mov vs no-op truncation Richard Henderson
@ 2014-05-15 16:28 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2014-05-15 16:28 UTC (permalink / raw)
To: Richard Henderson; +Cc: QEMU Developers
On 14 May 2014 17:59, Richard Henderson <rth@twiddle.net> wrote:
> Definitely fixes ppc64 host, maybe fixes s390 host.
> Please pull.
>
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-15 16:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-14 16:59 [Qemu-devel] [PULL] tcg bugfix pull Richard Henderson
2014-05-14 16:59 ` [Qemu-devel] [PULL] tcg: Fix tcg_reg_alloc_mov vs no-op truncation Richard Henderson
2014-05-15 16:28 ` [Qemu-devel] [PULL] tcg bugfix pull 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).