From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGdp5-0000Ur-Qd for qemu-devel@nongnu.org; Tue, 25 Sep 2012 18:41:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGdp3-0002Du-TB for qemu-devel@nongnu.org; Tue, 25 Sep 2012 18:41:47 -0400 Received: from hall.aurel32.net ([88.191.126.93]:33779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGdp3-0002Bu-LK for qemu-devel@nongnu.org; Tue, 25 Sep 2012 18:41:45 -0400 Date: Wed, 26 Sep 2012 00:41:34 +0200 From: Aurelien Jarno Message-ID: <20120925224134.GA24473@ohm.aurel32.net> References: <1348256016-5077-1-git-send-email-aurelien@aurel32.net> <1348256016-5077-4-git-send-email-aurelien@aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v2 3/5] target-arm: convert sar, shl and shr helpers to TCG List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org On Tue, Sep 25, 2012 at 02:57:20PM +0100, Peter Maydell wrote: > On 21 September 2012 20:33, Aurelien Jarno wrote: > > +static void gen_sar(TCGv dest, TCGv t0, TCGv t1) > > +{ > > + TCGv tmp1, tmp2, tmp3; > > + tmp1 = tcg_temp_new_i32(); > > + tcg_gen_andi_i32(tmp1, t1, 0xff); > > + tmp2 = tcg_const_i32(0x1f); > > + tmp3 = tcg_const_i32(0); > > + tcg_gen_movcond_i32(TCG_COND_GTU, tmp1, tmp1, tmp2, tmp2, tmp1); > > + tcg_temp_free_i32(tmp3); > > + tcg_temp_free_i32(tmp2); > > + tcg_gen_andi_i32(tmp1, tmp1, 0x1f); > > + tcg_gen_sar_i32(dest, t0, tmp1); > > + tcg_temp_free_i32(tmp1); > > +} > > I don't think you need the "tcg_gen_andi_i32(tmp1, tmp1, 0x1f);" > for sar, do you? The movcond is doing "shift = (shift > 31) ? 31 : shift" > so we know it's going to be in [0..31] and the and will do nothing, > right? > Indeed, that's a leftover from the previous version based on setcond. It should be removed. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net