* [Qemu-devel] [PATCH] target-ppc: fix evmergelo and evmergelohi
@ 2009-06-04 20:46 Nathan Froyd
2009-06-23 19:48 ` Nathan Froyd
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Nathan Froyd @ 2009-06-04 20:46 UTC (permalink / raw)
To: qemu-devel
For 32-bit PPC targets, we translated:
evmergelo rX, rX, rY
as:
rX-lo = rY-lo
rX-hi = rX-lo
which is wrong, because we should be transferring rX-lo first. This
problem is fixed by swapping the order in which we write the parts of
rX.
Similarly, we translated:
evmergelohi rX, rX, rY
as:
rX-lo = rY-hi
rX-hi = rX-lo
In this case, we can't swap the assignment statements, because that
would just cause problems for:
evmergelohi rX, rY, rX
Instead, we detect the first case and save rX-lo in a temporary
variable:
tmp = rX-lo
rX-lo = rY-hi
rX-hi = tmp
These problems don't occur on PPC64 targets because we don't split the
SPE registers into hi/lo parts for such targets.
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
---
target-ppc/translate.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 24c78d1..c61667a 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -7018,8 +7018,8 @@ static always_inline void gen_evmergelo (DisasContext *ctx)
tcg_temp_free(t0);
tcg_temp_free(t1);
#else
- tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]);
tcg_gen_mov_i32(cpu_gprh[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
+ tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]);
#endif
}
static always_inline void gen_evmergehilo (DisasContext *ctx)
@@ -7056,8 +7056,16 @@ static always_inline void gen_evmergelohi (DisasContext *ctx)
tcg_temp_free(t0);
tcg_temp_free(t1);
#else
- tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]);
- tcg_gen_mov_i32(cpu_gprh[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
+ if (rD(ctx->opcode) == rA(ctx->opcode)) {
+ TCGv_i32 tmp = tcg_temp_new_i32();
+ tcg_gen_mov_i32(tmp, cpu_gpr[rA(ctx->opcode)]);
+ tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]);
+ tcg_gen_mov_i32(cpu_gprh[rD(ctx->opcode)], tmp);
+ tcg_temp_free_i32(tmp);
+ } else {
+ tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]);
+ tcg_gen_mov_i32(cpu_gprh[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
+ }
#endif
}
static always_inline void gen_evsplati (DisasContext *ctx)
--
1.6.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] target-ppc: fix evmergelo and evmergelohi
2009-06-04 20:46 [Qemu-devel] [PATCH] target-ppc: fix evmergelo and evmergelohi Nathan Froyd
@ 2009-06-23 19:48 ` Nathan Froyd
2009-07-07 16:04 ` Nathan Froyd
2009-07-12 21:38 ` Aurelien Jarno
2 siblings, 0 replies; 4+ messages in thread
From: Nathan Froyd @ 2009-06-23 19:48 UTC (permalink / raw)
To: qemu-devel
On Thu, Jun 04, 2009 at 01:46:41PM -0700, Nathan Froyd wrote:
> For 32-bit PPC targets, we translated:
>
> evmergelo rX, rX, rY
>
> as:
>
> rX-lo = rY-lo
> rX-hi = rX-lo
>
> which is wrong, because we should be transferring rX-lo first. This
> problem is fixed by swapping the order in which we write the parts of
> rX.
>
> Similarly, we translated:
>
> evmergelohi rX, rX, rY
>
> as:
>
> rX-lo = rY-hi
> rX-hi = rX-lo
>
> In this case, we can't swap the assignment statements, because that
> would just cause problems for:
>
> evmergelohi rX, rY, rX
>
> Instead, we detect the first case and save rX-lo in a temporary
> variable:
>
> tmp = rX-lo
> rX-lo = rY-hi
> rX-hi = tmp
>
> These problems don't occur on PPC64 targets because we don't split the
> SPE registers into hi/lo parts for such targets.
Ping.
-Nathan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] target-ppc: fix evmergelo and evmergelohi
2009-06-04 20:46 [Qemu-devel] [PATCH] target-ppc: fix evmergelo and evmergelohi Nathan Froyd
2009-06-23 19:48 ` Nathan Froyd
@ 2009-07-07 16:04 ` Nathan Froyd
2009-07-12 21:38 ` Aurelien Jarno
2 siblings, 0 replies; 4+ messages in thread
From: Nathan Froyd @ 2009-07-07 16:04 UTC (permalink / raw)
To: qemu-devel
On Thu, Jun 04, 2009 at 01:46:41PM -0700, Nathan Froyd wrote:
> For 32-bit PPC targets, we translated:
>
> evmergelo rX, rX, rY
>
> as:
>
> rX-lo = rY-lo
> rX-hi = rX-lo
>
> which is wrong, because we should be transferring rX-lo first. This
> problem is fixed by swapping the order in which we write the parts of
> rX.
>
> Similarly, we translated:
>
> evmergelohi rX, rX, rY
>
> as:
>
> rX-lo = rY-hi
> rX-hi = rX-lo
>
> In this case, we can't swap the assignment statements, because that
> would just cause problems for:
>
> evmergelohi rX, rY, rX
>
> Instead, we detect the first case and save rX-lo in a temporary
> variable:
>
> tmp = rX-lo
> rX-lo = rY-hi
> rX-hi = tmp
>
> These problems don't occur on PPC64 targets because we don't split the
> SPE registers into hi/lo parts for such targets.
Ping again.
-Nathan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] target-ppc: fix evmergelo and evmergelohi
2009-06-04 20:46 [Qemu-devel] [PATCH] target-ppc: fix evmergelo and evmergelohi Nathan Froyd
2009-06-23 19:48 ` Nathan Froyd
2009-07-07 16:04 ` Nathan Froyd
@ 2009-07-12 21:38 ` Aurelien Jarno
2 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2009-07-12 21:38 UTC (permalink / raw)
To: Nathan Froyd; +Cc: qemu-devel
On Thu, Jun 04, 2009 at 01:46:41PM -0700, Nathan Froyd wrote:
> For 32-bit PPC targets, we translated:
>
> evmergelo rX, rX, rY
>
> as:
>
> rX-lo = rY-lo
> rX-hi = rX-lo
>
> which is wrong, because we should be transferring rX-lo first. This
> problem is fixed by swapping the order in which we write the parts of
> rX.
>
> Similarly, we translated:
>
> evmergelohi rX, rX, rY
>
> as:
>
> rX-lo = rY-hi
> rX-hi = rX-lo
>
> In this case, we can't swap the assignment statements, because that
> would just cause problems for:
>
> evmergelohi rX, rY, rX
>
> Instead, we detect the first case and save rX-lo in a temporary
> variable:
>
> tmp = rX-lo
> rX-lo = rY-hi
> rX-hi = tmp
>
> These problems don't occur on PPC64 targets because we don't split the
> SPE registers into hi/lo parts for such targets.
>
Thanks, applied.
Sorry for the delay I was away from QEMU for a few months. I am now
(slowly) start to work again on it. Don't hesitate to ping for other
patches I may have forget.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-12 21:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-04 20:46 [Qemu-devel] [PATCH] target-ppc: fix evmergelo and evmergelohi Nathan Froyd
2009-06-23 19:48 ` Nathan Froyd
2009-07-07 16:04 ` Nathan Froyd
2009-07-12 21:38 ` Aurelien Jarno
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).