From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPwyY-0000Pe-25 for qemu-devel@nongnu.org; Tue, 18 Mar 2014 12:34:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPwyO-0005MM-Jt for qemu-devel@nongnu.org; Tue, 18 Mar 2014 12:34:49 -0400 Received: from mail-ee0-x22f.google.com ([2a00:1450:4013:c00::22f]:63856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPwyO-0005LY-CX for qemu-devel@nongnu.org; Tue, 18 Mar 2014 12:34:40 -0400 Received: by mail-ee0-f47.google.com with SMTP id b15so5533689eek.6 for ; Tue, 18 Mar 2014 09:34:39 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5328759B.5010406@redhat.com> Date: Tue, 18 Mar 2014 17:34:35 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <5328564A.8060409@twiddle.net> <53285A90.6040300@twiddle.net> <53285E88.3060407@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: Peter Maydell , Richard Henderson Cc: QEMU Developers Il 18/03/2014 16:01, Peter Maydell ha scritto: > By whether the backend or the frontend has trivial > access to the value to be able to avoid doing bad > things if it's out of range. If either do, they can > do a translate-time check to avoid issues. If neither > does then we need the host CPU architecture to be > OK with the out of range value, or we need to insert > an explicit mask op in the backend (which is likely > to be a duplicate of an explicit mask op already > inserted at the frontend to get the frontend-target > mandated behaviour for out of range ops). Isn't that exactly what SPARC does? But the optimizer should be able to remove a redundant AND (not sure it is able to optimize & 255 & 31 to a single instruction, but it certainly can remove the second AND in "& 31 & 255"). Paolo