softfloat: Add float_round_nearest_even_max
authorRichard Henderson <richard.henderson@linaro.org>
Sun, 8 Dec 2024 14:54:41 +0000 (08:54 -0600)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 24 Dec 2024 16:32:15 +0000 (08:32 -0800)
This rounding mode is used by Hexagon.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
fpu/softfloat-parts.c.inc
include/fpu/softfloat-types.h

index a724f317c5fcb5ea400af98815742227f9823a25..37d046cfe984e5e439ed4b3e1005d8bae2805a4c 100644 (file)
@@ -241,6 +241,9 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
     int exp, flags = 0;
 
     switch (s->float_rounding_mode) {
+    case float_round_nearest_even_max:
+        overflow_norm = true;
+        /* fall through */
     case float_round_nearest_even:
         if (N > 64 && frac_lsb == 0) {
             inc = ((p->frac_hi & 1) || (p->frac_lo & round_mask) != frac_lsbm1
index 79ca44dcc3089d91f34cf60cec167766bba25b6b..9d37cdfaa8e3dcd762b2e1dc2d64913a33c15aa2 100644 (file)
@@ -140,6 +140,8 @@ typedef enum __attribute__((__packed__)) {
     float_round_to_odd       = 5,
     /* Not an IEEE rounding mode: round to closest odd, overflow to inf */
     float_round_to_odd_inf   = 6,
+    /* Not an IEEE rounding mode: round to nearest even, overflow to max */
+    float_round_nearest_even_max = 7,
 } FloatRoundMode;
 
 /*