From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPrB1-0002xE-3R for qemu-devel@nongnu.org; Fri, 27 May 2011 03:09:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPrB0-0008Kp-AP for qemu-devel@nongnu.org; Fri, 27 May 2011 03:09:43 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:60793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPrB0-0008Kl-6H for qemu-devel@nongnu.org; Fri, 27 May 2011 03:09:42 -0400 Received: by wwj40 with SMTP id 40so1382836wwj.10 for ; Fri, 27 May 2011 00:09:41 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4DDF4E32.2060301@redhat.com> Date: Fri, 27 May 2011 09:09:38 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <97bbf40c055a9949f5fbf185764792679fb8273a.1305889001.git.batuzovk@ispras.ru> <4DD6B4E9.3040501@twiddle.net> <4DDE5C28.4030507@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed 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: Blue Swirl Cc: mj.mccormack@samsung.com, Kirill Batuzov , qemu-devel@nongnu.org, zhur@ispras.ru, Richard Henderson On 05/26/2011 09:14 PM, Blue Swirl wrote: >>>> 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. >> > >> > Technically, yes. In practice, no. GCC, ICC, LLVM, MSVC all know >> > what the user wants here and will implement it "properly". > > Can't this be probed by configure? Then a wrapper could be introduced > for signed shifts. The reason for implementation-defined behavior is basically to allow for non-two's-complement machine, which isn't really practical to support. Paolo