From: Torbjorn Granlund <tg@gmplib.org>
To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] Incorrect handling of more PPC64 insns (PATCH)
Date: Tue, 07 May 2013 17:58:45 +0200 [thread overview]
Message-ID: <86fvxypyru.fsf_-_@shell.gmplib.org> (raw)
In-Reply-To: <86a9o7qe3u.fsf_-_@shell.gmplib.org> (Torbjorn Granlund's message of "Tue\, 07 May 2013 12\:27\:33 +0200")
OK, so took to reading some of translate to see how well it agrees with
the PPC architecture definition.
I spotted a bug with cmp, which was repeated 4 times. Somebody decided
that NARROW_MODE should affect the handling of cmp instructions, which
is contrary to the ISA documentation.
The first hunk is just a comment about suspicious code. I don't suggest
to apply that.
Incidentally, this patch makes GMP testing go a bit further, and the
testcase bug-qemu-ppc-again.s works correctly.
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 1a84653..c44b96d 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -665,6 +665,7 @@ static inline void gen_op_cmpi32(TCGv arg0, target_ulong arg1, int s, int crf)
static inline void gen_set_Rc0(DisasContext *ctx, TCGv reg)
{
+// suspicious code -- tege
if (NARROW_MODE(ctx)) {
gen_op_cmpi32(reg, 0, 1, 0);
} else {
@@ -675,7 +676,7 @@ static inline void gen_set_Rc0(DisasContext *ctx, TCGv reg)
/* cmp */
static void gen_cmp(DisasContext *ctx)
{
- if (NARROW_MODE(ctx) || !(ctx->opcode & 0x00200000)) {
+ if (!(ctx->opcode & 0x00200000)) {
gen_op_cmp32(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)],
1, crfD(ctx->opcode));
} else {
@@ -687,7 +688,7 @@ static void gen_cmp(DisasContext *ctx)
/* cmpi */
static void gen_cmpi(DisasContext *ctx)
{
- if (NARROW_MODE(ctx) || !(ctx->opcode & 0x00200000)) {
+ if (!(ctx->opcode & 0x00200000)) {
gen_op_cmpi32(cpu_gpr[rA(ctx->opcode)], SIMM(ctx->opcode),
1, crfD(ctx->opcode));
} else {
@@ -699,7 +700,7 @@ static void gen_cmpi(DisasContext *ctx)
/* cmpl */
static void gen_cmpl(DisasContext *ctx)
{
- if (NARROW_MODE(ctx) || !(ctx->opcode & 0x00200000)) {
+ if (!(ctx->opcode & 0x00200000)) {
gen_op_cmp32(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)],
0, crfD(ctx->opcode));
} else {
@@ -711,7 +712,7 @@ static void gen_cmpl(DisasContext *ctx)
/* cmpli */
static void gen_cmpli(DisasContext *ctx)
{
- if (NARROW_MODE(ctx) || !(ctx->opcode & 0x00200000)) {
+ if (!(ctx->opcode & 0x00200000)) {
gen_op_cmpi32(cpu_gpr[rA(ctx->opcode)], UIMM(ctx->opcode),
0, crfD(ctx->opcode));
} else {
--
Torbjörn
next prev parent reply other threads:[~2013-05-07 15:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-06 17:00 [Qemu-devel] Incorrect handling of PPC64 rldcl insn Torbjorn Granlund
2013-05-06 17:47 ` Alexander Graf
2013-05-06 18:13 ` Torbjorn Granlund
2013-05-06 22:14 ` Alexander Graf
2013-05-06 23:12 ` Aurelien Jarno
2013-05-07 10:27 ` [Qemu-devel] Incorrect handling of more PPC64 insns Torbjorn Granlund
2013-05-07 10:39 ` Peter Maydell
2013-05-07 11:48 ` Torbjorn Granlund
2013-05-07 11:51 ` Peter Maydell
2013-05-07 15:58 ` Torbjorn Granlund [this message]
2013-05-07 17:12 ` [Qemu-devel] [Qemu-ppc] Incorrect handling of more PPC64 insns (PATCH) Alexander Graf
2013-05-07 18:10 ` Torbjorn Granlund
2013-05-07 19:30 ` Torbjorn Granlund
2013-05-07 22:00 ` Alexander Graf
2013-05-08 6:50 ` Aurelien Jarno
2013-05-08 6:52 ` Alexander Graf
2013-05-08 9:20 ` Torbjorn Granlund
2013-05-08 9:32 ` Alexander Graf
2013-05-08 9:57 ` Alexander Graf
2013-05-08 10:07 ` Torbjorn Granlund
2013-05-08 10:45 ` Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86fvxypyru.fsf_-_@shell.gmplib.org \
--to=tg@gmplib.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.