qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 5/6] Do constant folding for shift operations.


From: Kirill Batuzov
Subject: Re: [Qemu-devel] [PATCH 5/6] Do constant folding for shift operations.
Date: Thu, 26 May 2011 16:36:11 +0400 (MSD)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)


On Fri, 20 May 2011, Richard Henderson wrote:

> 
> On 05/20/2011 05:39 AM, Kirill Batuzov wrote:
> > +    case INDEX_op_sar_i32:
> > +#if TCG_TARGET_REG_BITS == 64
> > +        x &= 0xffffffff;
> > +        y &= 0xffffffff;
> > +#endif
> > +        r = x & 0x80000000;
> > +        x &= ~0x80000000;
> > +        x >>= y;
> > +        r |= r - (r >> y);
> > +        x |= r;
> > +        return x;
> > +
> 
> Any reason you're emulating the 32-bit shift by
> hand, rather than letting the compiler do it?  I.e.
> 
>   x = (int32_t)x >> (int32_t)y;
>
This expression has an implementation-defined behavior accroding to
C99 6.5.7 so we decided to emulate signed shifts by hand.

----
  Kirill.



reply via email to

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