qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	qemu-devel <qemu-devel@nongnu.org>, Avi Kivity <avi@redhat.com>,
	Laurent Desnogues <laurent.desnogues@gmail.com>,
	Mulyadi Santosa <mulyadi.santosa@gmail.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] tcg: Remove stack protection from helper functions
Date: Tue, 27 Sep 2011 08:58:04 +0100	[thread overview]
Message-ID: <CAFEAcA-strBsPpz7G59cEWK2HExP4AzJ4sxaHNDbZ3COBdCYBQ@mail.gmail.com> (raw)
In-Reply-To: <m2sjniip5a.fsf@firstfloor.org>

On 27 September 2011 05:29, Andi Kleen <andi@firstfloor.org> wrote:
> Peter Maydell <peter.maydell@linaro.org> writes:
>> The answer is that the edge cases basically never match. No CPU
>> architecture does handling of NaNs and input denormals and output
>> denormals and underflow checks and all the rest of it in exactly
>> the same way as anybody else. (In particular x86 is pretty crazy,
>
> Can you clarify this?
>
> IEEE754 is pretty strict on how all these things are handled
> and to my knowledge all serious x86 are fully IEEE compliant.
> Or are you refering to the x87 80bits expansion? While useful
> that's not used anymore with SSE.

IEEE leaves some leeway for implementations. Just off the top
of my head:
 * if two NaNs are passed to an op then which one is propagated
   is implementation defined
 * value of the 'default NaN' is imp-def
 * whether the msbit of the significand is 1 or 0 to indicate
   an SNaN is imp-def
 * how an SNaN is converted to a QNaN is imp-def
 * tininess can be detected either before or after rounding

which different architectures vary on (and some are better at
documenting their choices than others).

Also implementations often have extra non-IEEE modes (which
may even be the default, for speed):
 * squashing denormal outputs to zero
 * squashing denormal inputs to zero
and there's even less agreement here.

Common-but-not-officially-ieee ops like 'max' and 'min'
can also vary: for instance Intel's SSE MAXSD/MINSD etc
have very weird behaviour for the special cases: if both
operands are 0.0s of any sign you always get the second
operand, so max(-0,+0) != max(+0,-0), and if only one operand
is a NaN then the second operand is returned whether it is
the NaN or not (so max(NaN, 3) != max(3, NaN).

> On the other hand qemu is not very good at it, e.g. with x87
> it doesn't even pass paranoia.

This is only because nobody cares much about x86 TCG. ARM floating
point emulation is (now) bit-for-bit correct apart from a handful
of operations which don't set the right set of exception flags.

-- PMM

  reply	other threads:[~2011-09-27  7:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-26  7:46 [Qemu-devel] [PATCH] tcg: Remove stack protection from helper functions Jan Kiszka
2011-09-26  8:01 ` Mulyadi Santosa
2011-09-26  8:15   ` Laurent Desnogues
2011-09-26 17:41     ` Avi Kivity
2011-09-26 19:43       ` Richard Henderson
2011-09-26 19:52         ` Avi Kivity
2011-09-26 19:53           ` Richard Henderson
2011-09-26 20:20             ` Avi Kivity
2011-09-26 20:19           ` Peter Maydell
2011-09-26 20:26             ` Avi Kivity
2011-09-27  4:29             ` Andi Kleen
2011-09-27  7:58               ` Peter Maydell [this message]
2011-09-26 10:51 ` [Qemu-devel] [PATCH v2] " Jan Kiszka
2011-09-26 11:33   ` Peter Maydell
2011-09-26 11:43     ` Jan Kiszka
2011-09-26 11:56       ` Peter Maydell
2011-09-26 17:22         ` Blue Swirl
2011-09-26 17:33           ` Jan Kiszka
2011-09-26 18:20             ` Blue Swirl
2011-09-26 18:25               ` Jan Kiszka
2011-09-26 18:40                 ` Blue Swirl
2011-09-26 19:08               ` Peter Maydell

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=CAFEAcA-strBsPpz7G59cEWK2HExP4AzJ4sxaHNDbZ3COBdCYBQ@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=laurent.desnogues@gmail.com \
    --cc=mulyadi.santosa@gmail.com \
    --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).