From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNUZp-0000cJ-7j for qemu-devel@nongnu.org; Fri, 20 May 2011 14:37:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QNUZo-0003Ns-IL for qemu-devel@nongnu.org; Fri, 20 May 2011 14:37:33 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:46793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNUZo-0003Nn-B2 for qemu-devel@nongnu.org; Fri, 20 May 2011 14:37:32 -0400 Received: by pwi6 with SMTP id 6so2282680pwi.4 for ; Fri, 20 May 2011 11:37:31 -0700 (PDT) Sender: Richard Henderson Message-ID: <4DD6B4E9.3040501@twiddle.net> Date: Fri, 20 May 2011 11:37:29 -0700 From: Richard Henderson MIME-Version: 1.0 References: <97bbf40c055a9949f5fbf185764792679fb8273a.1305889001.git.batuzovk@ispras.ru> In-Reply-To: <97bbf40c055a9949f5fbf185764792679fb8273a.1305889001.git.batuzovk@ispras.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/6] Do constant folding for shift operations. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kirill Batuzov Cc: mj.mccormack@samsung.com, qemu-devel@nongnu.org, zhur@ispras.ru 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; r~