All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] target-ppc: fix nego and subf*o instructions
Date: Mon, 1 Apr 2013 02:31:58 +0200	[thread overview]
Message-ID: <20130401003158.GE6467@hall.aurel32.net> (raw)
In-Reply-To: <CAFEAcA-N2bBa-Lq3=NtJBL7YCi=_6jEU_hSDmmM34B5p4QPOjA@mail.gmail.com>

On Mon, Apr 01, 2013 at 12:50:58AM +0100, Peter Maydell wrote:
> On 1 April 2013 00:19, Richard Henderson <rth@twiddle.net> wrote:
> > On 2013-03-30 16:54, Aurelien Jarno wrote:
> >>
> >> The overflow computation of nego and subf*o instructions has been broken
> >> in commit ffe30937. This patch fixes it.
> >>
> >> With this change the PPC emulation passes the Gwenole Beauchesne
> >> testsuite again.
> >>
> >> Cc: Alexander Graf <agraf@suse.de>
> >> Cc: Richard Henderson <rth@twiddle.net>
> >> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> >> ---
> >>   target-ppc/translate.c |    2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/target-ppc/translate.c b/target-ppc/translate.c
> >> index 5e741d1..062493a 100644
> >> --- a/target-ppc/translate.c
> >> +++ b/target-ppc/translate.c
> >> @@ -749,7 +749,7 @@ static inline void
> >> gen_op_arith_compute_ov(DisasContext *ctx, TCGv arg0,
> >>       tcg_gen_xor_tl(cpu_ov, arg0, arg1);
> >>       tcg_gen_xor_tl(t0, arg1, arg2);
> >>       if (sub) {
> >> -        tcg_gen_and_tl(cpu_ov, cpu_ov, t0);
> >> +        tcg_gen_andc_tl(cpu_ov, t0, cpu_ov);
> >>       } else {
> >>           tcg_gen_andc_tl(cpu_ov, cpu_ov, t0);
> >>       }
> >
> >
> > I'm a bit confused.  This is the exact same algorithm that's used on ARM and
> > i386.  And as far as I can determine, all three platforms have the same
> > definition of "overflow".
> 
> I think it's not quite the same as ARM because the two arguments
> to subtract are reversed for PPC (ie PPC is 'subtract from', not
> 'subtract'). I think that means you want 'xor_tl(cpu_ov, arg0, arg2)'
> for your first xor, maybe? (untested)

Indeed, this way of doing also works, and is also cleaner. I'll send a
new version of the patch. Thanks.

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2013-04-01  0:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-30 23:54 [Qemu-devel] [PATCH] target-ppc: fix nego and subf*o instructions Aurelien Jarno
2013-03-31 23:19 ` Richard Henderson
2013-03-31 23:50   ` Peter Maydell
2013-04-01  0:31     ` Aurelien Jarno [this message]
2013-04-01  1:15     ` Richard Henderson
2013-04-01  0:22   ` Aurelien Jarno

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=20130401003158.GE6467@hall.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=agraf@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.