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~