qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [RFC PATCH] softfloat: Allow runtime choice of default NaN value
Date: Thu, 28 Nov 2024 12:13:05 -0600	[thread overview]
Message-ID: <bd910b04-b05c-4325-a82e-ed864fe46d82@linaro.org> (raw)
In-Reply-To: <20241128145455.3742294-1-peter.maydell@linaro.org>

On 11/28/24 08:54, Peter Maydell wrote:
> Currently we hardcode the default NaN value in parts64_default_nan()
> using a compile-time ifdef ladder. This is awkward for two cases:
>   * for single-QEMU-binary we can't hard-code target-specifics like this
>   * for Arm FEAT_AFP the default NaN value depends on FPCR.AH
>     (specifically the sign bit is different)
> 
> Add a field to float_status to specify the default NaN value; fall
> back to the old ifdef behaviour if these are not set.
> 
> The default NaN value is specified by setting a uint8_t to a
> pattern corresponding to the sign and upper fraction parts of
> the NaN; the lower bits of the fraction are set from bit 0 of
> the pattern.
> 
> This is an RFC to ask for opinions on whether this is the right
> way to let the target set its default NaN. I can't decide whether
> I think encoding it into a uint8_t like that is clever, or merely
> too clever :-)

I think that's perfectly fine.

>   #elif defined(TARGET_HEXAGON)
> -    sign = 1;
> -    frac = ~0ULL;
> +        /*
> +         * Sign bit set, all frac bits set. This is an odd special case,
> +         * where our value doesn't match up with the snan_bit_is_one setting.
> +         * This is because for Hexagon the returned value is always -1,
> +         * not a real NaN value.
> +         */
> +        dnan_pattern = 0b11111111;

It's a real (signalling) nan value -- the oddity is that the default nan is not quiet.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


      reply	other threads:[~2024-11-28 18:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28 14:54 [RFC PATCH] softfloat: Allow runtime choice of default NaN value Peter Maydell
2024-11-28 18:13 ` Richard Henderson [this message]

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=bd910b04-b05c-4325-a82e-ed864fe46d82@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@linaro.org \
    --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).