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