From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2lh4-0005Fr-MY for qemu-devel@nongnu.org; Thu, 03 Jul 2014 14:25:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2lh3-0003Ig-Qr for qemu-devel@nongnu.org; Thu, 03 Jul 2014 14:25:14 -0400 Received: from zeniv.linux.org.uk ([2002:c35c:fd02::1]:51385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2lh3-0003IL-KN for qemu-devel@nongnu.org; Thu, 03 Jul 2014 14:25:13 -0400 Date: Thu, 3 Jul 2014 19:25:01 +0100 From: Al Viro Message-ID: <20140703182501.GQ18016@ZenIV.linux.org.uk> References: <53B1AEEF.8010108@twiddle.net> <20140630205635.GG18016@ZenIV.linux.org.uk> <53B2E9CA.4040802@twiddle.net> <20140701175036.GJ18016@ZenIV.linux.org.uk> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140703065104.GP18016@ZenIV.linux.org.uk> 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: Richard Henderson Cc: Peter Maydell , QEMU Developers On Thu, Jul 03, 2014 at 07:51:04AM +0100, Al Viro wrote: > FWIW, why not just generate > trunc_i64_i32 tmp, va > trunc_i64_i32 tmp2, vb > muls2_i32 tmp2, tmp, tmp, tmp2 > ext32s_i64 vc, tmp2 > maybe_overflow_32 tmp > where maybe_overflow throws IOV unless tmp is 0 or -1? > to suffice for mull/v. mulq/v would be > muls2_i64 vc, tmp, va, vb > maybe_overflow_64 tmp > addl/v: > trunc_i64_i32 tmp, va > trunc_i64_i32 tmp2, vb > add2_i32 tmp2, tmp, tmp, zero, tmp2, zero > ext32s_i64 vc, tmp2 > maybe_overflow_32 tmp > etc. Grr... Wrong check, obviously - we want to check that tmp + MSB(tmp2) is 0. Something like setcond_32 tmp2, tmp2, zero, TCG_COND_LT add_i32 tmp, tmp2, tmp call helper_IOV_if_not_zero tmp for 32bit ones and setcond_64 tmp2, vc, zero, TCG_COND_LT add_i64 tmp, tmp2, tmp call helper_IOV_if_not_zero tmp for 64bit ones, or would it be better just to pass both arguments to helper and let it deal with the check? I'm not familiar enough with TCG, sorry...