From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPvIs-0003wz-6p for qemu-devel@nongnu.org; Tue, 18 Mar 2014 10:47:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPvIn-0000FG-5X for qemu-devel@nongnu.org; Tue, 18 Mar 2014 10:47:42 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:61730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPvIm-0000FC-Uw for qemu-devel@nongnu.org; Tue, 18 Mar 2014 10:47:37 -0400 Received: by mail-la0-f50.google.com with SMTP id y1so4762120lam.23 for ; Tue, 18 Mar 2014 07:47:35 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <53285A90.6040300@twiddle.net> References: <5328564A.8060409@twiddle.net> <53285A90.6040300@twiddle.net> From: Peter Maydell Date: Tue, 18 Mar 2014 14:47:15 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] target-i386: guest variable shift by 0 provokes shift by -1 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: QEMU Developers On 18 March 2014 14:39, Richard Henderson wrote: > On 03/18/2014 07:25 AM, Peter Maydell wrote: >> Why do you think this? tcg/README says out of >> range shifts are undefined behaviour. That means we >> mustn't execute them, and this code doesn't attempt >> to branch around or otherwise avoid the shift by -1. > > Bah. Stuff and nonsense. None of our backends are so > stupid as to start WWIII with an out of range input. Then we should document that this case is an unspecified-result, not use the same term we do for division-by-zero or division-overflow (which really can cause things to blow up). > For most backends, the shift count gets (partially) > masked as it is inserted into the immediate field. The interesting question is not immediate shifts but variable ones. It's trivially easy for the frontend to avoid passing out of range immediate values and for the backend to screen them out. This case is a variable shift TCG op. thanks -- PMM