From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPzAe-0003ZF-U9 for qemu-devel@nongnu.org; Fri, 27 May 2011 11:41:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPzAe-0001lV-1N for qemu-devel@nongnu.org; Fri, 27 May 2011 11:41:52 -0400 Received: from mail2.shareable.org ([80.68.89.115]:34291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPzAd-0001kn-TW for qemu-devel@nongnu.org; Fri, 27 May 2011 11:41:52 -0400 Date: Fri, 27 May 2011 16:41:40 +0100 From: Jamie Lokier Message-ID: <20110527154140.GW969@shareable.org> References: <97bbf40c055a9949f5fbf185764792679fb8273a.1305889001.git.batuzovk@ispras.ru> <4DD6B4E9.3040501@twiddle.net> <4DDE5C28.4030507@twiddle.net> <4DDEB39F.80609@twiddle.net> <4DDEC29D.6020204@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DDEC29D.6020204@twiddle.net> 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: Richard Henderson Cc: Blue Swirl , mj.mccormack@samsung.com, qemu-devel@nongnu.org, zhur@ispras.ru, Kirill Batuzov Richard Henderson wrote: > On 05/26/2011 01:25 PM, Blue Swirl wrote: > >> I don't see the point. The C99 implementation defined escape hatch > >> exists for weird cpus. Which we won't be supporting as a QEMU host. > > > > Maybe not, but a compiler with this property could arrive. For > > example, GCC developers could decide that since this weirdness is > > allowed by the standard, it may be implemented as well. > > If you like, you can write a configure test for it. But, honestly, > essentially every place in qemu that uses shifts on signed types > would have to be audited. Really. I agree, the chance of qemu ever working, or needing to work, on a non two's complement machine is pretty remote! > The C99 hook exists to efficiently support targets that don't have > arithmetic shift operations. Honestly. If you care, this should be portable without a configure test, as constant folding should have the same behaviour: (((int32_t)-3 >> 1 == (int32_t)-2) ? (int32_t)x >> (int32_t)y : long_winded_portable_shift_right(x, y)) -- Jamie