qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Richard Henderson <rth@twiddle.net>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] target-i386: guest variable shift by 0 provokes shift by -1
Date: Tue, 18 Mar 2014 14:47:15 +0000	[thread overview]
Message-ID: <CAFEAcA9A08VbLSReW9h+QX7fy=x05FpQ63PqL++DazmS-ar9DQ@mail.gmail.com> (raw)
In-Reply-To: <53285A90.6040300@twiddle.net>

On 18 March 2014 14:39, Richard Henderson <rth@twiddle.net> 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	other threads:[~2014-03-18 14:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18 12:33 [Qemu-devel] target-i386: guest variable shift by 0 provokes shift by -1 Peter Maydell
2014-03-18 14:20 ` Richard Henderson
2014-03-18 14:25   ` Peter Maydell
2014-03-18 14:39     ` Richard Henderson
2014-03-18 14:47       ` Peter Maydell [this message]
2014-03-18 14:52         ` Peter Maydell
2014-03-18 14:56         ` Richard Henderson
2014-03-18 15:01           ` Peter Maydell
2014-03-18 15:19             ` Richard Henderson
2014-03-18 16:34             ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFEAcA9A08VbLSReW9h+QX7fy=x05FpQ63PqL++DazmS-ar9DQ@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).