All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: G 3 <programmingkidx@gmail.com>
Cc: "qemu-devel@nongnu.org qemu-devel" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 3/9] Add risu_reginfo_ppc.c file
Date: Tue, 25 Apr 2017 09:17:46 +0100	[thread overview]
Message-ID: <CAFEAcA_PUdFS-gPncf9S6ZGyKGdotang=sM1EkE42M7OKTW16w@mail.gmail.com> (raw)
In-Reply-To: <BD9E8ECB-EB56-45A9-89A4-C1506319A7BD@gmail.com>

On 25 April 2017 at 04:19, G 3 <programmingkidx@gmail.com> wrote:
> Add the risu_reginfo_ppc.c file. It handles operations involving the reginfo
> structure.

> +    /* check each floating point register */
> +    for (i = 0; i < NUMBER_OF_FPR; i++) {
> +        if (r1->fpr[i] != r2->fpr[i]) {
> +            if (!(isnan(r1->fpr[i]) && isnan(r2->fpr[i]))) {
> +                if ( fabs(r1->fpr[i] - r2->fpr[i]) < 0.000001) {
> +                    debug_print("float point register %d mismatch
> detected\n", i);
> +                    return 0;
> +                }

This is definitely wrong. Risu is supposed to check for exact
binary correctness, so you simply want to compare the binary
values of the FP regs, not check whether they're vaguely
close to the right answer.

> +/*
> + * Shows the classification of a floating point value.
> + * Input: floating point value
> + * Output: string description
> + */
> +const char *show_classification(double x) {
> +    switch(fpclassify(x)) {
> +        case FP_INFINITE:  return "Inf";
> +        case FP_NAN:       return "NaN";
> +        case FP_NORMAL:    return "normal";
> +        case FP_SUBNORMAL: return "subnormal";
> +        case FP_ZERO:      return "zero";
> +        default:           return "unknown";
> +    }
> +}

None of the other backends do this. If we want to do it
(and I'm not convinced it's worth the effort) we should
do it consistently everywhere.

thanks
-- PMM

  reply	other threads:[~2017-04-25  8:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25  3:19 [Qemu-devel] [PATCH 3/9] Add risu_reginfo_ppc.c file G 3
2017-04-25  8:17 ` Peter Maydell [this message]
2017-04-25 14:17   ` G 3

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_PUdFS-gPncf9S6ZGyKGdotang=sM1EkE42M7OKTW16w@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=programmingkidx@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.