From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2qKQ-0006xf-V8 for qemu-devel@nongnu.org; Thu, 03 Jul 2014 19:22:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2qKQ-0006lI-5W for qemu-devel@nongnu.org; Thu, 03 Jul 2014 19:22:10 -0400 Received: from zeniv.linux.org.uk ([2002:c35c:fd02::1]:53268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2qKP-0006jo-Tr for qemu-devel@nongnu.org; Thu, 03 Jul 2014 19:22:10 -0400 Date: Fri, 4 Jul 2014 00:22:08 +0100 From: Al Viro Message-ID: <20140703232208.GS18016@ZenIV.linux.org.uk> References: <53B2FE3B.6050306@twiddle.net> <20140702040508.GK18016@ZenIV.linux.org.uk> <53B41E36.30906@twiddle.net> <20140702152027.GN18016@ZenIV.linux.org.uk> <20140703065104.GP18016@ZenIV.linux.org.uk> <20140703182501.GQ18016@ZenIV.linux.org.uk> <53B5BAC7.1010603@twiddle.net> <20140703224704.GR18016@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Subject: Re: [Qemu-devel] [RFC] alpha qemu arithmetic exceptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Richard Henderson On Fri, Jul 04, 2014 at 12:05:37AM +0100, Peter Maydell wrote: > On 3 July 2014 23:47, Al Viro wrote: > > How can that be correct? Suppose a = b = 0. We get > > tcg_gen_eqv_i64(tmp, va, vb); -> tmp = -1 > > tcg_gen_mov_i64(tmp2, va); -> tmp2 = 0 > > tcg_gen_add_i64(vc, va, vb); -> c = 0 > > tcg_gen_xor_i64(tmp2, tmp2, vc);-> tmp2 = 0 > > tcg_gen_and_i64(tmp, tmp, tmp2);-> tmp = -1 > > tmp2 here is 0, so the result of this AND is 0, not -1... Doh. Misread it as tcg_gen_add_i64, sorry. Hmm... So it's ((a ^ ~b) & (a ^ c) < 0 as overflow condition, IOW MSB(a) == MSB(b) && MSB(c) != MSB(a). OK, that works; might deserve a comment, though...