qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Aleksandar Markovic <amarkovic@wavecomp.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Mateja Marjanovic" <mateja.marjanovic@rt-rk.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"aurelien@aurel32.net" <aurelien@aurel32.net>,
	"Aleksandar Rikalo" <arikalo@wavecomp.com>
Subject: Re: [Qemu-devel] [PATCH] target/mips: Fix minor bug in FPU
Date: Mon, 11 Mar 2019 14:48:50 +0000	[thread overview]
Message-ID: <CAFEAcA-osjnv83OL+uma-YekZvhCFGP8JpgZUzUniZHrQG2WFA@mail.gmail.com> (raw)
In-Reply-To: <BN6PR2201MB12515708748670C8F930B088C6480@BN6PR2201MB1251.namprd22.prod.outlook.com>

On Mon, 11 Mar 2019 at 14:35, Aleksandar Markovic
<amarkovic@wavecomp.com> wrote:
> I'll doublecheck, but I think "infzero" here is a misnomer.
>
> The variable/argument "infzero" actually denotes the cases:
>
>    - "Inf * Zero +/- NaN"
>    - "Inf * Zero +/- NaN"
>    - "Zero * Inf +/- NaN"
>    - "Zero * Inf +/- NaN"
>
> "Inf * Zero +/- !NaN (let's say, normal fp)" is handled
> somewhere else.
>
> Therefore, "infzero" should be rather called "infzeronan".
> This is from what I remember, but I will reanalyse the
> relevant softfloat code one more time.

Yes; we don't ask the target-dependent code to pick a NaN
in the case of 0 * inf + not-a-NaN because the IEEE spec
entirely defines the behaviour there (you get the default
NaN and Invalid is set), so that case is handled in the
generic softfloat code. (The flag is called 'infzero'
probably because in the calling code it indicates all
the inf * zero cases, not just the info * zero + nan ones).

It's specifically the (0,inf,qnan) and (inf,0,qnan) cases
where the spec allows the implementation to decide whether
they raise Invalid or not (and what qnan to return if they
do), so this is why we pass that flag through to the
pick-a-NaN routine.

It looks like this part of the MIPS-specific code was
incorrectly copied from the Arm implementation (which does
return the default NaN here).


As well as what the right NaN value should be, the other
question for this function for the (0, inf, qnan) case is
"should we raise Invalid?" -- what does the MIPS spec
require here?

thanks
-- PMM

  reply	other threads:[~2019-03-11 14:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 17:10 [Qemu-devel] [PATCH] target/mips: Fix minor bug in FPU Mateja Marjanovic
2019-03-07 17:10 ` Mateja Marjanovic
2019-03-07 17:32   ` Alex Bennée
2019-03-07 17:43     ` Aleksandar Markovic
2019-03-07 18:25       ` Alex Bennée
2019-03-11 11:52 ` Aleksandar Markovic
2019-03-11 12:50   ` Peter Maydell
2019-03-11 13:58     ` Aleksandar Markovic
2019-03-11 14:18       ` Alex Bennée
2019-03-11 14:35         ` Aleksandar Markovic
2019-03-11 14:48           ` Peter Maydell [this message]
2019-03-11 15:18           ` Alex Bennée

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-osjnv83OL+uma-YekZvhCFGP8JpgZUzUniZHrQG2WFA@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=amarkovic@wavecomp.com \
    --cc=arikalo@wavecomp.com \
    --cc=aurelien@aurel32.net \
    --cc=mateja.marjanovic@rt-rk.com \
    --cc=qemu-devel@nongnu.org \
    /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).