On 17 September 2012 14:36, Laurent Desnogues <laurent.desnog...@gmail.com> wrote: > On Mon, Sep 17, 2012 at 11:43 AM, Peter Maydell > <peter.mayd...@linaro.org> wrote: >> The TCG shift operations are undefined behaviour (not merely >> undefined result) if the shift is >= 32, so we must avoid >> doing that even if we're going to throw away the answer. > > That's odd that it doesn't just state that the result is undefined. > I wonder what "undefined behavior" means. I understand > what undefined behavior (as opposed tu undefined result) > means for divisions by 0, but not for a shift larger than data > type width.
Well, it means anything the implementation likes :-) The only concrete example I could come up with was the old pre-286 behaviour where the 8086 didn't mask the shift count at all, so a variable shift by a large amount would be implemented as that many one-bit-per-cycle shifts and could take an extremely long time. -- PMM