From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Laurent Vivier" <laurent@vivier.eu>
Subject: Re: [PATCH 01/10] fpu: Make targets specify floatx80 default Inf at runtime
Date: Fri, 21 Feb 2025 15:42:51 +0100 [thread overview]
Message-ID: <fa37f960-ff1c-49d5-a0d3-06cd2f0421e5@linaro.org> (raw)
In-Reply-To: <20250217125055.160887-2-peter.maydell@linaro.org>
On 17/2/25 13:50, Peter Maydell wrote:
> Currently we hardcode at compile time whether the floatx80 default
> Infinity value has the explicit integer bit set or not (x86 sets it;
> m68k does not). To be able to compile softfloat once for all targets
> we'd like to move this setting to runtime.
>
> Define a new FloatX80Behaviour enum which is a set of flags that
> define the target's floatx80 handling. Initially we define just one
> flag, for whether the default Infinity has the Integer bit set or
> not, but we will expand this in future commits to cover the other
> floatx80 target specifics that we currently make compile-time
> settings.
>
> Define a new function floatx80_default_inf() which returns the
> appropriate default Infinity value of the given sign, and use it in
> the code that was previously directly using the compile-time constant
> floatx80_infinity_{low,high} values when packing an infinity into a
> floatx80.
>
> Since floatx80 is highly unlikely to be supported in any new
> architecture, and the existing code is generally written as "default
> to like x87, with an ifdef for m68k", we make the default value for
> the floatx80 behaviour flags be "what x87 does". This means we only
> need to change the m68k target to specify the behaviour flags.
>
> (Other users of floatx80 are the Arm NWFPE emulation, which is
> obsolete and probably not actually doing the right thing anyway, and
> the PPC xsrqpxp insn. Making the default be "like x87" avoids our
> needing to review and test for behaviour changes there.)
>
> We will clean up the remaining uses of the floatx80_infinity global
> constant in subsequent commits.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> include/fpu/softfloat-helpers.h | 12 ++++++++++++
> include/fpu/softfloat-types.h | 13 +++++++++++++
> include/fpu/softfloat.h | 1 +
> fpu/softfloat.c | 7 +++----
> target/m68k/cpu.c | 6 ++++++
> fpu/softfloat-specialize.c.inc | 10 ++++++++++
> 6 files changed, 45 insertions(+), 4 deletions(-)
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index f4fed9bfda9..b12ad2b42a9 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -1860,7 +1860,8 @@ static floatx80 floatx80_round_pack_canonical(FloatParts128 *p,
>
> case float_class_inf:
> /* x86 and m68k differ in the setting of the integer bit. */
> - frac = floatx80_infinity_low;
> + frac = s->floatx80_behaviour & floatx80_default_inf_int_bit_is_zero ?
> + 0 : (1ULL << 63);
Indent off, otherwise:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
next prev parent reply other threads:[~2025-02-21 14:43 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 12:50 [PATCH 00/10] fpu: Remove remaining target ifdefs and build only once Peter Maydell
2025-02-17 12:50 ` [PATCH 01/10] fpu: Make targets specify floatx80 default Inf at runtime Peter Maydell
2025-02-17 18:09 ` Richard Henderson
2025-02-21 14:42 ` Philippe Mathieu-Daudé [this message]
2025-02-21 15:16 ` Peter Maydell
2025-02-17 12:50 ` [PATCH 02/10] target/m68k: Avoid using floatx80_infinity global const Peter Maydell
2025-02-17 18:10 ` Richard Henderson
2025-02-21 13:51 ` Philippe Mathieu-Daudé
2025-02-17 12:50 ` [PATCH 03/10] target/i386: " Peter Maydell
2025-02-17 18:10 ` Richard Henderson
2025-02-21 13:40 ` Philippe Mathieu-Daudé
2025-02-17 12:50 ` [PATCH 04/10] fpu: Make targets specify whether floatx80 Inf can have Int bit clear Peter Maydell
2025-02-17 18:13 ` Richard Henderson
2025-02-21 13:12 ` Philippe Mathieu-Daudé
2025-02-17 12:50 ` [PATCH 05/10] fpu: Make floatx80 invalid encoding settable at runtime Peter Maydell
2025-02-17 18:45 ` Richard Henderson
2025-02-21 13:14 ` Philippe Mathieu-Daudé
2025-02-17 12:50 ` [PATCH 06/10] fpu: Move m68k_denormal fmt flag into floatx80_behaviour Peter Maydell
2025-02-17 19:14 ` Richard Henderson
2025-02-20 17:12 ` Peter Maydell
2025-02-20 18:39 ` Richard Henderson
2025-02-20 18:54 ` Peter Maydell
2025-02-21 14:14 ` Philippe Mathieu-Daudé
2025-02-21 22:24 ` Richard Henderson
2025-02-17 12:50 ` [PATCH 07/10] fpu: Always decide no_signaling_nans() at runtime Peter Maydell
2025-02-17 13:13 ` Philippe Mathieu-Daudé
2025-02-17 19:25 ` Richard Henderson
2025-02-17 12:50 ` [PATCH 08/10] fpu: Always decide snan_bit_is_one() " Peter Maydell
2025-02-17 13:15 ` Philippe Mathieu-Daudé
2025-02-17 19:26 ` Richard Henderson
2025-02-17 12:50 ` [PATCH 09/10] fpu: Don't compile-time disable hardfloat for PPC targets Peter Maydell
2025-02-17 19:27 ` Richard Henderson
2025-02-17 12:50 ` [PATCH 10/10] fpu: Build only once Peter Maydell
2025-02-17 19:28 ` Richard Henderson
2025-02-20 8:48 ` [PATCH 00/10] fpu: Remove remaining target ifdefs and build " Philippe Mathieu-Daudé
2025-02-20 9:00 ` Philippe Mathieu-Daudé
2025-02-21 10:48 ` Philippe Mathieu-Daudé
2025-02-21 13:05 ` Philippe Mathieu-Daudé
2025-02-21 13:28 ` Peter Maydell
2025-02-21 13:48 ` Philippe Mathieu-Daudé
2025-02-21 14:41 ` Philippe Mathieu-Daudé
2025-02-21 15:19 ` Peter Maydell
2025-02-21 16:21 ` Philippe Mathieu-Daudé
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=fa37f960-ff1c-49d5-a0d3-06cd2f0421e5@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=eduardo@habkost.net \
--cc=laurent@vivier.eu \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).