From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKCUm-00066s-EY for qemu-devel@nongnu.org; Thu, 12 Sep 2013 15:24:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKCUe-0005yT-1I for qemu-devel@nongnu.org; Thu, 12 Sep 2013 15:24:04 -0400 Received: from mail-ob0-x22b.google.com ([2607:f8b0:4003:c01::22b]:42595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKCUd-0005yL-SP for qemu-devel@nongnu.org; Thu, 12 Sep 2013 15:23:55 -0400 Received: by mail-ob0-f171.google.com with SMTP id wm4so247004obc.30 for ; Thu, 12 Sep 2013 12:23:55 -0700 (PDT) Sender: Richard Henderson Message-ID: <523214C7.4090303@twiddle.net> Date: Thu, 12 Sep 2013 12:23:51 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1379013193-20691-1-git-send-email-sw@weilnetz.de> In-Reply-To: <1379013193-20691-1-git-send-email-sw@weilnetz.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/3] Add and use bit rotate functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: Peter Maydell , qemu-devel On 09/12/2013 12:13 PM, Stefan Weil wrote: > The first patch was already sent to qemu-devel and is only included > here because patch 3 is based on it. Only patch 1 is needed for qemu-stable. > > It looks like shift values of 0 or 32/64 work as expected because > the compiler "knows" the pattern used to implement the rotate operation, > so the code does not need special handling of some shift values. Thinking about this closer, the only two behaviors I know of for x >> n, n >= w, w = width of x, are: shift modulo w, or zero. Both cases work for this usage: x << 0 | x >> 32 = x | (x >> 0) modulo = x | x = x = x | 0 zero = x AFAIK we never actually observe missile launch as a side effect of an out of range shift. And with that in mind, I think the existing implementation of rotate is fine. r~