[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 0/3] Add and use bit rotate functions
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 0/3] Add and use bit rotate functions |
Date: |
Thu, 12 Sep 2013 12:23:51 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 |
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~
- [Qemu-devel] [PATCH 0/3] Add and use bit rotate functions, Stefan Weil, 2013/09/12
- [Qemu-devel] [PATCH 1/3] tci: Add implementation of rotl_i64, rotr_i64, Stefan Weil, 2013/09/12
- [Qemu-devel] [PATCH 3/3] misc: Use new rotate functions, Stefan Weil, 2013/09/12
- [Qemu-devel] [PATCH 2/3] bitops: Add rotate functions (rol8, ror8, ...), Stefan Weil, 2013/09/12
- Re: [Qemu-devel] [PATCH 0/3] Add and use bit rotate functions,
Richard Henderson <=