From: Chao Liu <chao.liu@processmission.com>
To: Max Chou <max.chou@sifive.com>
Cc: "Chao Liu" <chao.liu@processmission.com>,
qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Alistair Francis" <Alistair.Francis@wdc.com>,
"Daniel Henrique Barboza" <daniel.barboza@oss.qualcomm.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Weiwei Li" <liwei1518@gmail.com>,
"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>
Subject: Re: [RFC PATCH 01/38] fpu/softfloat: Support OCP(Open Compute Project) OFP8 checking functions
Date: Tue, 10 Nov 2026 22:04:04 +0800 [thread overview]
Message-ID: <20261110140407.29506-1-chao.liu@processmission.com> (raw)
In-Reply-To: <20261104194155.679241-2-max.chou@sifive.com>
On Thu, 5 Nov 2026 03:41:16 +0800 Max Chou <max.chou@sifive.com> wrote:
> Include following checking functions liked other fp types:
> - *_nan_is_snan
> - *_is_quiet_nan
> - *_is_signaling_nan
> - *_is_any_nan
> - *_is_neg
> - *_is_infinity
> - *_is_zero
> - *_is_zero_or_denormal
> - *_is_normal
>
> Signed-off-by: Max Chou <max.chou@sifive.com>
Reviewed-by: Chao Liu <chao.liu@processmission.com>
Thanks,
Chao
> ---
> fpu/softfloat-specialize.c.inc | 55 ++++++++++++++++++++++++++
> include/fpu/softfloat.h | 70 ++++++++++++++++++++++++++++++++++
> 2 files changed, 125 insertions(+)
>
> diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
> index 8b765ef623f..22a3188f99b 100644
> --- a/fpu/softfloat-specialize.c.inc
> +++ b/fpu/softfloat-specialize.c.inc
> @@ -255,6 +255,61 @@ floatx80 floatx80_default_inf(bool zSign, float_status *status)
> return packFloatx80(zSign, 0x7fff, z ? 0 : (1ULL << 63));
> }
>
> +/*----------------------------------------------------------------------------
> +| Determine if a OCP FP8 E4M3 NaN is signaling NaN.
> +| E4M3 has only one NaN encoding, so classification is policy-based.
> +*----------------------------------------------------------------------------*/
> +
> +static bool float8_e4m3_nan_is_snan(float8_e4m3 a, float_status *status)
> +{
> + return get_float_e4m3_nan_is_snan(status);
> +}
> +
> +/*----------------------------------------------------------------------------
> +| Returns 1 if the OCP FP8 E4M3 value `a' is a quiet NaN; otherwise returns 0.
> +*----------------------------------------------------------------------------*/
> +
> +bool float8_e4m3_is_quiet_nan(float8_e4m3 a_, float_status *status)
> +{
> + return float8_e4m3_is_any_nan(a_) && !float8_e4m3_nan_is_snan(a_, status);
> +}
> +
> +/*----------------------------------------------------------------------------
> +| Returns 1 if the OCP FP8 E4M3 value `a' is a signaling NaN; otherwise 0.
> +*----------------------------------------------------------------------------*/
> +
> +bool float8_e4m3_is_signaling_nan(float8_e4m3 a_, float_status *status)
> +{
> + return float8_e4m3_is_any_nan(a_) && float8_e4m3_nan_is_snan(a_, status);
> +}
> +
> +/*----------------------------------------------------------------------------
> +| Determine if a OCP FP8 E5M2 NaN is signaling NaN.
> +*----------------------------------------------------------------------------*/
> +
> +static bool float8_e5m2_nan_is_snan(float8_e5m2 a, float_status *status)
> +{
> + return frac_msb_is_snan((a >> 1) & 1, status);
> +}
> +
> +/*----------------------------------------------------------------------------
> +| Returns 1 if the OCP FP8 E5M2 value `a' is a quiet NaN; otherwise returns 0.
> +*----------------------------------------------------------------------------*/
> +
> +bool float8_e5m2_is_quiet_nan(float8_e5m2 a_, float_status *status)
> +{
> + return float8_e5m2_is_any_nan(a_) && !float8_e5m2_nan_is_snan(a_, status);
> +}
> +
> +/*----------------------------------------------------------------------------
> +| Returns 1 if the OCP FP8 E5M2 value `a' is a signaling NaN; otherwise 0.
> +*----------------------------------------------------------------------------*/
> +
> +bool float8_e5m2_is_signaling_nan(float8_e5m2 a_, float_status *status)
> +{
> + return float8_e5m2_is_any_nan(a_) && float8_e5m2_nan_is_snan(a_, status);
> +}
> +
> /*----------------------------------------------------------------------------
> | Determine if a float16 NaN is signaling NaN.
> *----------------------------------------------------------------------------*/
> diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
> index d48fc6b0437..4d91599e25d 100644
> --- a/include/fpu/softfloat.h
> +++ b/include/fpu/softfloat.h
> @@ -222,6 +222,76 @@ bfloat16 float8_e5m2_to_bfloat16(float8_e5m2, float_status *status);
> float8_e5m2 bfloat16_to_float8_e5m2(bfloat16, bool sat, float_status *status);
> float8_e5m2 float32_to_float8_e5m2(float32, bool sat, float_status *status);
>
> +/*----------------------------------------------------------------------------
> +| OCP FP{4,8} classify operations.
> +*----------------------------------------------------------------------------*/
> +
> +bool float8_e4m3_is_quiet_nan(float8_e4m3, float_status *status);
> +bool float8_e4m3_is_signaling_nan(float8_e4m3, float_status *status);
> +bool float8_e5m2_is_quiet_nan(float8_e5m2, float_status *status);
> +bool float8_e5m2_is_signaling_nan(float8_e5m2, float_status *status);
> +
> +static inline bool float8_e4m3_is_any_nan(float8_e4m3 a)
> +{
> + return ((a & ~0x80) == 0x7f);
> +}
> +
> +static inline bool float8_e5m2_is_any_nan(float8_e5m2 a)
> +{
> + return ((a & ~0x80) > 0x7c);
> +}
> +
> +static inline bool float8_e4m3_is_neg(float8_e4m3 a)
> +{
> + return a >> 7;
> +}
> +
> +static inline bool float8_e5m2_is_neg(float8_e5m2 a)
> +{
> + return a >> 7;
> +}
> +
> +static inline bool float8_e4m3_is_infinity(float8_e4m3 a)
> +{
> + return false;
> +}
> +
> +static inline bool float8_e5m2_is_infinity(float8_e5m2 a)
> +{
> + return (a & 0x7f) == 0x7c;
> +}
> +
> +static inline bool float8_e4m3_is_zero(float8_e4m3 a)
> +{
> + return (a & 0x7f) == 0;
> +}
> +
> +static inline bool float8_e5m2_is_zero(float8_e5m2 a)
> +{
> + return (a & 0x7f) == 0;
> +}
> +
> +static inline bool float8_e4m3_is_zero_or_denormal(float8_e4m3 a)
> +{
> + return (a & 0x78) == 0;
> +}
> +
> +static inline bool float8_e5m2_is_zero_or_denormal(float8_e5m2 a)
> +{
> + return (a & 0x7c) == 0;
> +}
> +
> +static inline bool float8_e4m3_is_normal(float8_e4m3 a)
> +{
> + uint8_t em = a & 0x7f;
> + return em >= 0x8 && em <= 0x7e;
> +}
> +
> +static inline bool float8_e5m2_is_normal(float8_e5m2 a)
> +{
> + return (((a >> 2) + 1) & 0x1f) >= 2;
> +}
> +
> /*----------------------------------------------------------------------------
> | Software half-precision conversion routines.
> *----------------------------------------------------------------------------*/
> --
> 2.56.0
>
>
>
Sent using hkml (https://github.com/sjp38/hackermail)
next prev parent reply other threads:[~2026-11-10 14:05 UTC|newest]
Thread overview: 117+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 19:41 [RFC PATCH 00/38] target/riscv: Add Zvdota/Zvbdota families of dot-product extensions Max Chou
2026-11-04 19:41 ` [RFC PATCH 01/38] fpu/softfloat: Support OCP(Open Compute Project) OFP8 checking functions Max Chou
2026-11-09 19:53 ` Daniel Henrique Barboza
2026-11-10 14:04 ` Chao Liu [this message]
2026-11-04 19:41 ` [RFC PATCH 02/38] target/riscv: Introduce riscv_init_fp_status Max Chou
2026-11-09 19:53 ` Daniel Henrique Barboza
2026-11-10 14:07 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 03/38] target/riscv: rvv: Introduce RVBNA algorithm for Zvdota/Zvbdota extensions Max Chou
2026-11-09 19:56 ` Daniel Henrique Barboza
2026-11-10 14:56 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 04/38] target/riscv: Add cfg property for Zvqwdota8i extension Max Chou
2026-11-09 19:56 ` Daniel Henrique Barboza
2026-11-10 14:57 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 05/38] target/riscv: Add implied rules " Max Chou
2026-11-09 19:57 ` Daniel Henrique Barboza
2026-11-10 15:03 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 06/38] target/riscv: rvv: Implement Zvqwdota8i instructions Max Chou
2026-11-09 19:57 ` Daniel Henrique Barboza
2026-11-10 15:05 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 07/38] disas/riscv: Support Zvqwdota8i extension Max Chou
2026-11-09 19:58 ` Daniel Henrique Barboza
2026-11-10 15:07 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 08/38] target/riscv: Add Zvqwdota16i cpu property Max Chou
2026-11-09 19:58 ` Daniel Henrique Barboza
2026-11-10 15:09 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 09/38] target/riscv: Add Zvqwdota16i dependency imply rule Max Chou
2026-11-09 19:59 ` Daniel Henrique Barboza
2026-11-10 15:15 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 10/38] target/riscv: rvv: Implement Zvqwdota16i instructions Max Chou
2026-11-09 20:03 ` Daniel Henrique Barboza
2026-11-11 4:48 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 11/38] target/riscv: Add cfg property for Zvfwdota16bf extension Max Chou
2026-11-09 20:03 ` Daniel Henrique Barboza
2026-11-11 4:51 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 12/38] target/riscv: Add implied rules " Max Chou
2026-11-09 20:04 ` Daniel Henrique Barboza
2026-11-11 4:55 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 13/38] target/riscv: rvv: Implement Zvfwdota16bf instruction Max Chou
2026-11-09 20:15 ` Daniel Henrique Barboza
2026-11-10 12:59 ` Max Chou
2026-11-11 5:29 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 14/38] disas/riscv: Support Zvfwdota16bf extension Max Chou
2026-11-09 20:15 ` Daniel Henrique Barboza
2026-11-11 5:33 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 15/38] target/riscv: Add cfg property for Zvfqwdota8f extension Max Chou
2026-11-09 20:15 ` Daniel Henrique Barboza
2026-11-11 5:37 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 16/38] target/riscv: Add implied rules " Max Chou
2026-11-09 20:16 ` Daniel Henrique Barboza
2026-11-11 5:52 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 17/38] target/riscv: rvv: Implement Zvfqwdota8f instructions Max Chou
2026-11-09 20:20 ` Daniel Henrique Barboza
2026-11-11 6:51 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 18/38] disas/riscv: Support Zvfqwdota8f extension Max Chou
2026-11-09 20:20 ` Daniel Henrique Barboza
2026-11-11 6:52 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 19/38] target/riscv: Add cfg property for Zvqwbdota8i extension Max Chou
2026-11-09 20:20 ` Daniel Henrique Barboza
2026-11-11 6:55 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 20/38] target/riscv: Add implied rules " Max Chou
2026-11-09 20:20 ` Daniel Henrique Barboza
2026-11-11 6:57 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 21/38] target/riscv: rvv: Implement Zvqwbdota8i instructions Max Chou
2026-11-09 20:32 ` Daniel Henrique Barboza
2026-11-11 7:00 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 22/38] disas/riscv: Support Zvqwbdota8i extension Max Chou
2026-11-09 20:32 ` Daniel Henrique Barboza
2026-11-11 7:05 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 23/38] target/riscv: Add cfg property for Zvqwbdota16i extension Max Chou
2026-11-09 20:33 ` Daniel Henrique Barboza
2026-11-11 7:06 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 24/38] target/riscv: Add implied rules " Max Chou
2026-11-09 20:33 ` Daniel Henrique Barboza
2026-11-11 7:10 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 25/38] target/riscv: rvv: Implement Zvqwbdota16i instructions Max Chou
2026-11-09 20:38 ` Daniel Henrique Barboza
2026-11-11 8:03 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 26/38] target/riscv: Add cfg property for Zvfwbdota16bf extension Max Chou
2026-11-09 20:39 ` Daniel Henrique Barboza
2026-11-11 8:07 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 27/38] target/riscv: Add implied rules " Max Chou
2026-11-09 20:39 ` Daniel Henrique Barboza
2026-11-11 8:15 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 28/38] target/riscv: rvv: Implement Zvfwbdota16bf instruction Max Chou
2026-11-09 20:40 ` Daniel Henrique Barboza
2026-11-11 8:19 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 29/38] disas/riscv: Support Zvfwbdota16bf extension Max Chou
2026-11-09 20:41 ` Daniel Henrique Barboza
2026-11-11 8:20 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 30/38] target/riscv: Add cfg property for Zvfqwbdota8f extension Max Chou
2026-11-09 20:41 ` Daniel Henrique Barboza
2026-11-11 8:21 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 31/38] target/riscv: Add implied rules " Max Chou
2026-11-09 20:41 ` Daniel Henrique Barboza
2026-11-11 8:22 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 32/38] target/riscv: rvv: Implement Zvfqwbdota8f instructions Max Chou
2026-11-09 20:41 ` Daniel Henrique Barboza
2026-11-11 8:24 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 33/38] disas/riscv: Support Zvfqwbdota8f extension Max Chou
2026-11-09 20:42 ` Daniel Henrique Barboza
2026-11-11 8:35 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 34/38] target/riscv: Add cfg property for Zvfbdota32f extension Max Chou
2026-11-09 20:42 ` Daniel Henrique Barboza
2026-11-11 8:36 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 35/38] target/riscv: Add implied rules " Max Chou
2026-11-09 20:42 ` Daniel Henrique Barboza
2026-11-11 8:36 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 36/38] target/riscv: rvv: Implement Zvfbdota32f instructions Max Chou
2026-11-09 20:43 ` Daniel Henrique Barboza
2026-11-11 9:17 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 37/38] disas/riscv: Support Zvfbdota32f extension Max Chou
2026-11-09 20:43 ` Daniel Henrique Barboza
2026-11-11 9:53 ` Chao Liu
2026-11-04 19:41 ` [RFC PATCH 38/38] tests/tcg/riscv64: Add test for Zvdota/Zvbdota extensions Max Chou
2026-11-09 20:47 ` Daniel Henrique Barboza
2026-11-11 9:54 ` Chao Liu
2026-11-10 14:12 ` [RFC PATCH 00/38] target/riscv: Add Zvdota/Zvbdota families of dot-product extensions Chao Liu
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=20261110140407.29506-1-chao.liu@processmission.com \
--to=chao.liu@processmission.com \
--cc=Alistair.Francis@wdc.com \
--cc=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=daniel.barboza@oss.qualcomm.com \
--cc=liwei1518@gmail.com \
--cc=max.chou@sifive.com \
--cc=palmer@dabbelt.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/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.