qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] target-i386: guest variable shift by 0 provokes shift b


From: Peter Maydell
Subject: Re: [Qemu-devel] target-i386: guest variable shift by 0 provokes shift by -1
Date: Tue, 18 Mar 2014 14:47:15 +0000

On 18 March 2014 14:39, Richard Henderson <address@hidden> wrote:
> On 03/18/2014 07:25 AM, Peter Maydell wrote:
>> Why do you think this? tcg/README says out of
>> range shifts are undefined behaviour. That means we
>> mustn't execute them, and this code doesn't attempt
>> to branch around or otherwise avoid the shift by -1.
>
> Bah.  Stuff and nonsense.  None of our backends are so
> stupid as to start WWIII with an out of range input.

Then we should document that this case is an
unspecified-result, not use the same term we
do for division-by-zero or division-overflow (which
really can cause things to blow up).

> For most backends, the shift count gets (partially)
> masked as it is inserted into the immediate field.

The interesting question is not immediate shifts
but variable ones. It's trivially easy for the frontend
to avoid passing out of range immediate values
and for the backend to screen them out. This
case is a variable shift TCG op.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]