* [PATCH] softfloat: Define comparison operations for bfloat16
@ 2020-08-28 17:53 Richard Henderson
2020-08-29 15:05 ` LIU Zhiwei
0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2020-08-28 17:53 UTC (permalink / raw)
To: qemu-devel; +Cc: zhiwei_liu
These operations were missed in Zhiwei's bfloat16 implementation.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/fpu/softfloat.h | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
index 1233f98014..78ad5ca738 100644
--- a/include/fpu/softfloat.h
+++ b/include/fpu/softfloat.h
@@ -479,6 +479,47 @@ static inline bfloat16 bfloat16_set_sign(bfloat16 a, int sign)
return (a & 0x7fff) | (sign << 15);
}
+static inline bool bfloat16_eq(bfloat16 a, bfloat16 b, float_status *s)
+{
+ return bfloat16_compare(a, b, s) == float_relation_equal;
+}
+
+static inline bool bfloat16_le(bfloat16 a, bfloat16 b, float_status *s)
+{
+ return bfloat16_compare(a, b, s) <= float_relation_equal;
+}
+
+static inline bool bfloat16_lt(bfloat16 a, bfloat16 b, float_status *s)
+{
+ return bfloat16_compare(a, b, s) < float_relation_equal;
+}
+
+static inline bool bfloat16_unordered(bfloat16 a, bfloat16 b, float_status *s)
+{
+ return bfloat16_compare(a, b, s) == float_relation_unordered;
+}
+
+static inline bool bfloat16_eq_quiet(bfloat16 a, bfloat16 b, float_status *s)
+{
+ return bfloat16_compare_quiet(a, b, s) == float_relation_equal;
+}
+
+static inline bool bfloat16_le_quiet(bfloat16 a, bfloat16 b, float_status *s)
+{
+ return bfloat16_compare_quiet(a, b, s) <= float_relation_equal;
+}
+
+static inline bool bfloat16_lt_quiet(bfloat16 a, bfloat16 b, float_status *s)
+{
+ return bfloat16_compare_quiet(a, b, s) < float_relation_equal;
+}
+
+static inline bool bfloat16_unordered_quiet(bfloat16 a, bfloat16 b,
+ float_status *s)
+{
+ return bfloat16_compare_quiet(a, b, s) == float_relation_unordered;
+}
+
#define bfloat16_zero 0
#define bfloat16_half 0x3f00
#define bfloat16_one 0x3f80
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] softfloat: Define comparison operations for bfloat16
2020-08-28 17:53 [PATCH] softfloat: Define comparison operations for bfloat16 Richard Henderson
@ 2020-08-29 15:05 ` LIU Zhiwei
0 siblings, 0 replies; 2+ messages in thread
From: LIU Zhiwei @ 2020-08-29 15:05 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2853 bytes --]
On 2020/8/29 1:53, Richard Henderson wrote:
> These operations were missed in Zhiwei's bfloat16 implementation.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> include/fpu/softfloat.h | 41 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
> index 1233f98014..78ad5ca738 100644
> --- a/include/fpu/softfloat.h
> +++ b/include/fpu/softfloat.h
> @@ -479,6 +479,47 @@ static inline bfloat16 bfloat16_set_sign(bfloat16 a, int sign)
> return (a & 0x7fff) | (sign << 15);
> }
>
> +static inline bool bfloat16_eq(bfloat16 a, bfloat16 b, float_status *s)
> +{
> + return bfloat16_compare(a, b, s) == float_relation_equal;
> +}
> +
> +static inline bool bfloat16_le(bfloat16 a, bfloat16 b, float_status *s)
> +{
> + return bfloat16_compare(a, b, s) <= float_relation_equal;
> +}
> +
> +static inline bool bfloat16_lt(bfloat16 a, bfloat16 b, float_status *s)
> +{
> + return bfloat16_compare(a, b, s) < float_relation_equal;
> +}
> +
> +static inline bool bfloat16_unordered(bfloat16 a, bfloat16 b, float_status *s)
> +{
> + return bfloat16_compare(a, b, s) == float_relation_unordered;
> +}
> +
> +static inline bool bfloat16_eq_quiet(bfloat16 a, bfloat16 b, float_status *s)
> +{
> + return bfloat16_compare_quiet(a, b, s) == float_relation_equal;
> +}
> +
> +static inline bool bfloat16_le_quiet(bfloat16 a, bfloat16 b, float_status *s)
> +{
> + return bfloat16_compare_quiet(a, b, s) <= float_relation_equal;
> +}
> +
> +static inline bool bfloat16_lt_quiet(bfloat16 a, bfloat16 b, float_status *s)
> +{
> + return bfloat16_compare_quiet(a, b, s) < float_relation_equal;
> +}
> +
> +static inline bool bfloat16_unordered_quiet(bfloat16 a, bfloat16 b,
> + float_status *s)
Indentation.
> +{
> + return bfloat16_compare_quiet(a, b, s) == float_relation_unordered;
> +}
> +
Hi Richard,
If you have already applied the bfloat16 patch set, I am afraid you
have to remove these lines.
-int bfloat16_unordered_quiet(bfloat16, bfloat16, float_status *status);
-int bfloat16_le(bfloat16, bfloat16, float_status *status);
-int bfloat16_lt(bfloat16, bfloat16, float_status *status);
-int bfloat16_eq_quiet(bfloat16, bfloat16, float_status *status);
The corresponding float16 interfaces have been removed in the master
branch when I sent the bfloat16 patch set.
So I deleted the implementations. But I forgot to remove the declarations.
I see you have applied float16 comparison interfaces from Kito, and the
corresponding bfloat16
interfaces have all been defined here. After remove the redundant
declarations,
Reviewed-by: LIU Zhiwei <zhiwei_liu@c-sky.com>
> #define bfloat16_zero 0
> #define bfloat16_half 0x3f00
> #define bfloat16_one 0x3f80
[-- Attachment #2: Type: text/html, Size: 3740 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-29 15:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-28 17:53 [PATCH] softfloat: Define comparison operations for bfloat16 Richard Henderson
2020-08-29 15:05 ` LIU Zhiwei
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).