From: David Gibson <david@gibson.dropbear.id.au>
To: James Clarke <jrtc27@jrtc27.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] target-ppc: mcrfs should always update FEX/VX and only clear exception bits
Date: Fri, 29 Jan 2016 14:17:17 +1100 [thread overview]
Message-ID: <20160129031717.GJ23043@voom.redhat.com> (raw)
In-Reply-To: <1453650086-92705-3-git-send-email-jrtc27@jrtc27.com>
[-- Attachment #1: Type: text/plain, Size: 4000 bytes --]
On Sun, Jan 24, 2016 at 03:41:26PM +0000, James Clarke wrote:
> Signed-off-by: James Clarke <jrtc27@jrtc27.com>
So, first, for a patch making a subtle behavioural change like this a
detailed commit message is absolutely essential. In this case I can
take the description from 0/2, but in future please include
rationale's like that in the individual patches, so they'll appear in
the git history without extra work on my part.
But.. there's a more serious bug here, so I've backed this out of
ppc-for-2.6...
[snip]
> @@ -2501,17 +2501,24 @@ static void gen_mcrfs(DisasContext *ctx)
> {
> TCGv tmp = tcg_temp_new();
> int bfa;
> + int nibble;
> + int shift;
>
> if (unlikely(!ctx->fpu_enabled)) {
> gen_exception(ctx, POWERPC_EXCP_FPU);
> return;
> }
> - bfa = 4 * (7 - crfS(ctx->opcode));
> - tcg_gen_shri_tl(tmp, cpu_fpscr, bfa);
> + bfa = crfS(ctx->opcode);
> + nibble = 7 - bfa;
> + shift = 4 * nibble;
> + tcg_gen_shri_tl(tmp, cpu_fpscr, shift);
> tcg_gen_trunc_tl_i32(cpu_crf[crfD(ctx->opcode)], tmp);
> - tcg_temp_free(tmp);
> tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)], 0xf);
> - tcg_gen_andi_tl(cpu_fpscr, cpu_fpscr, ~(0xF << bfa));
> + /* Only the exception bits (including FX) should be cleared if read */
> + tcg_gen_andi_tl(tmp, cpu_fpscr, ~((0xF << shift) & FP_EX_CLEAR_BITS));
> + /* FEX and VX need to be updated, so don't set fpscr directly */
> + gen_helper_store_fpscr(cpu_env, tmp, 1 << nibble);
This doesn't compile. For 64-bit targets we get:
CC ppc64-softmmu/target-ppc/translate.o
/home/dwg/src/qemu/target-ppc/translate.c: In function ‘gen_mcrfs’:
/home/dwg/src/qemu/target-ppc/translate.c:2520:42: error: passing argument 3 of ‘gen_helper_store_fpscr’ makes pointe
r from integer without a cast [-Werror=int-conversion]
gen_helper_store_fpscr(cpu_env, tmp, 1 << nibble);
^
In file included from /home/dwg/src/qemu/include/exec/helper-gen.h:59:0,
from /home/dwg/src/qemu/tcg/tcg-op.h:27,
from /home/dwg/src/qemu/target-ppc/translate.c:23:
/home/dwg/src/qemu/target-ppc/helper.h:56:58: note: expected ‘TCGv_i32 {aka struct TCGv_i32_d *}’ but argument is of
type ‘int’
For 32-bit targets it's worse:
CC ppcemb-softmmu/target-ppc/translate.o
/home/dwg/src/qemu/target-ppc/translate.c: In function ‘gen_mcrfs’:
/home/dwg/src/qemu/target-ppc/translate.c:2520:37: error: passing argument 2 of ‘gen_helper_store_fpscr’ from incompa
tible pointer type [-Werror=incompatible-pointer-types]
gen_helper_store_fpscr(cpu_env, tmp, 1 << nibble);
^
In file included from /home/dwg/src/qemu/include/exec/helper-gen.h:59:0,
from /home/dwg/src/qemu/tcg/tcg-op.h:27,
from /home/dwg/src/qemu/target-ppc/translate.c:23:
/home/dwg/src/qemu/target-ppc/helper.h:56:58: note: expected ‘TCGv_i64 {aka struct TCGv_i64_d *}’ but argument is of
type ‘TCGv_i32 {aka struct TCGv_i32_d *}’
/home/dwg/src/qemu/target-ppc/translate.c:2520:42: error: passing argument 3 of ‘gen_helper_store_fpscr’ makes pointe
r from integer without a cast [-Werror=int-conversion]
gen_helper_store_fpscr(cpu_env, tmp, 1 << nibble);
^
In file included from /home/dwg/src/qemu/include/exec/helper-gen.h:59:0,
from /home/dwg/src/qemu/tcg/tcg-op.h:27,
from /home/dwg/src/qemu/target-ppc/translate.c:23:
/home/dwg/src/qemu/target-ppc/helper.h:56:58: note: expected ‘TCGv_i32 {aka struct TCGv_i32_d *}’ but argument is of
type ‘int’
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-01-29 4:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-24 15:41 [Qemu-devel] [PATCH 0/2] PPC handles mcrfs incorrectly James Clarke
2016-01-24 15:41 ` [Qemu-devel] [PATCH 1/2] target-ppc: Make every FPSCR_ macro have a corresponding FP_ macro James Clarke
2016-01-24 15:41 ` [Qemu-devel] [PATCH 2/2] target-ppc: mcrfs should always update FEX/VX and only clear exception bits James Clarke
2016-01-29 3:17 ` David Gibson [this message]
2016-01-29 3:04 ` [Qemu-devel] [Qemu-ppc] [PATCH 0/2] PPC handles mcrfs incorrectly David Gibson
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=20160129031717.GJ23043@voom.redhat.com \
--to=david@gibson.dropbear.id.au \
--cc=jrtc27@jrtc27.com \
--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.