On 5/17/21 7:27 AM, David Hildenbrand wrote:
With Richard's softfloat rework, the float128 implementation is
straight-forward. Unfortuantely, we don't have any tests we can simply
adjust/unlock.
Cc: Aurelien Jarno <aurel...@aurel32.net>
Cc: Peter Maydell <peter.mayd...@linaro.org>
Cc: "Alex Bennée" <alex.ben...@linaro.org>
Cc: Richard Henderson <richard.hender...@linaro.org>
Signed-off-by: David Hildenbrand <da...@redhat.com>
Queueing this into my softfloat rework. Thanks,
r~
---
fpu/softfloat.c | 17 +++++++++++++++++
include/fpu/softfloat.h | 6 ++++++
2 files changed, 23 insertions(+)
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 7376b3470c..bfe5a6b975 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -3893,6 +3893,22 @@ static float64 float64_minmax(float64 a, float64 b,
float_status *s, int flags)
return which ? b : a;
}
+static float128 float128_minmax(float128 a, float128 b, float_status *s,
+ int flags)
+{
+ FloatParts128 pa, pb;
+ int which;
+
+ float128_unpack_canonical(&pa, a, s);
+ float128_unpack_canonical(&pb, b, s);
+ which = parts_minmax(&pa, &pb, s, flags, &float64_params);
+ if (unlikely(which < 0)) {
+ /* Some sort of nan, need to repack default and silenced nans. */
+ return float128_round_pack_canonical(&pa, s);
+ }
+ return which ? b : a;
+}
+
#define MINMAX_1(type, name, flags) \
type type##_##name(type a, type b, float_status *s) \
{ return type##_minmax(a, b, s, flags); }
@@ -3909,6 +3925,7 @@ MINMAX_2(float16)
MINMAX_2(bfloat16)
MINMAX_2(float32)
MINMAX_2(float64)
+MINMAX_2(float128)
#undef MINMAX_1
#undef MINMAX_2
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
index 94f7841b9f..ec7dca0960 100644
--- a/include/fpu/softfloat.h
+++ b/include/fpu/softfloat.h
@@ -1204,6 +1204,12 @@ float128 float128_rem(float128, float128, float_status
*status);
float128 float128_sqrt(float128, float_status *status);
FloatRelation float128_compare(float128, float128, float_status *status);
FloatRelation float128_compare_quiet(float128, float128, float_status
*status);
+float128 float128_min(float128, float128, float_status *status);
+float128 float128_max(float128, float128, float_status *status);
+float128 float128_minnum(float128, float128, float_status *status);
+float128 float128_maxnum(float128, float128, float_status *status);
+float128 float128_minnummag(float128, float128, float_status *status);
+float128 float128_maxnummag(float128, float128, float_status *status);
bool float128_is_quiet_nan(float128, float_status *status);
bool float128_is_signaling_nan(float128, float_status *status);
float128 float128_silence_nan(float128, float_status *status);