Received: from eggs.gnu.org ([208.118.235.92]:50693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMSfN-00030w-87 for qemu-devel@nongnu.org; Sun, 31 Mar 2013 20:32:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UMSfK-0003Je-7H for qemu-devel@nongnu.org; Sun, 31 Mar 2013 20:32:05 -0400 Received: from hall.aurel32.net ([2001:470:1f15:c4f::1]:49389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMSfJ-0003JN-Vy for qemu-devel@nongnu.org; Sun, 31 Mar 2013 20:32:02 -0400 Date: Mon, 1 Apr 2013 02:31:58 +0200 From: Aurelien Jarno Message-ID: <20130401003158.GE6467@hall.aurel32.net> References: <1364687686-6006-1-git-send-email-aurelien@aurel32.net> <5158C491.4010509@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: Sender: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] target-ppc: fix nego and subf*o instructions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Alexander Graf , qemu-devel@nongnu.org, Richard Henderson On Mon, Apr 01, 2013 at 12:50:58AM +0100, Peter Maydell wrote: > On 1 April 2013 00:19, Richard Henderson 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 > >> Cc: Richard Henderson > >> Signed-off-by: Aurelien Jarno > >> --- > >> 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