qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 3/5] target-arm: convert sar, shl and shr hel


From: Aurelien Jarno
Subject: Re: [Qemu-devel] [PATCH v2 3/5] target-arm: convert sar, shl and shr helpers to TCG
Date: Wed, 26 Sep 2012 00:41:34 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Sep 25, 2012 at 02:57:20PM +0100, Peter Maydell wrote:
> On 21 September 2012 20:33, Aurelien Jarno <address@hidden> 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
address@hidden                 http://www.aurel32.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]