mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 01:43:39 +00:00
softfloat: Define comparison operations for bfloat16
Reviewed-by: LIU Zhiwei <zhiwei_liu@c-sky.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
5ebf5f4be6
commit
c53b107933
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue