@samitouri / QOSamiQemu / commits / bffa0bd6af

fpu: Add accessors for rebias_{underflow,overflow}

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Richard Henderson committed May 1, 2026 at 20:52 UTC bffa0bd6affbcf0918272398947551cf9e491a4e
4 files changed +24 -4
fpu/softfloat-parts.c.inc
+2 -2
@@ -358,7 +358,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
358 switch (fmt->exp_max_kind) {
359 case float_expmax_ieee:
360 flags |= float_flag_overflow;
361 - if (s->rebias_overflow) {
361 + if (get_float_rebias_overflow(s)) {
362 exp -= fmt->exp_re_bias;
363 } else if (overflow_norm) {
364 flags |= float_flag_inexact;
@@ -398,7 +398,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
398 }
399 }
400 fracN(shr)(p, frac_shift);
401 - } else if (unlikely(s->rebias_underflow)) {
401 + } else if (unlikely(get_float_rebias_underflow(s))) {
402 flags |= float_flag_underflow;
403 exp += fmt->exp_re_bias;
404 if (p->frac_lo & round_mask) {
fpu/softfloat-specialize.c.inc
+10
@@ -94,6 +94,16 @@ static inline uint8_t get_float_default_nan_pattern(const float_status *status)
94 return status->default_nan_pattern;
95 }
96
97 +static inline bool get_float_rebias_overflow(const float_status *status)
98 +{
99 + return status->rebias_overflow;
100 +}
101 +
102 +static inline bool get_float_rebias_underflow(const float_status *status)
103 +{
104 + return status->rebias_underflow;
105 +}
106 +
107 /*----------------------------------------------------------------------------
108 | For the deconstructed floating-point with fraction FRAC, return true
109 | if the fraction represents a signalling NaN; otherwise false.
include/fpu/softfloat-helpers.h
+10
@@ -131,6 +131,16 @@ static inline void set_snan_rule(FloatSNaNRule val, float_status *status)
131 status->float_snan_rule = val;
132 }
133
134 +static inline void set_float_rebias_overflow(bool val, float_status *status)
135 +{
136 + status->rebias_overflow = val;
137 +}
138 +
139 +static inline void set_float_rebias_underflow(bool val, float_status *status)
140 +{
141 + status->rebias_underflow = val;
142 +}
143 +
144 static inline FloatRoundMode get_float_rounding_mode(const float_status *status)
145 {
146 return status->float_rounding_mode;
target/ppc/cpu.c
+2 -2
@@ -248,8 +248,8 @@ void ppc_store_fpscr(CPUPPCState *env, target_ulong val)
248 val |= FP_FEX;
249 }
250 env->fpscr = val;
251 - env->fp_status.rebias_overflow = (FP_OE & env->fpscr) ? true : false;
252 - env->fp_status.rebias_underflow = (FP_UE & env->fpscr) ? true : false;
251 + set_float_rebias_overflow(FP_OE & env->fpscr, &env->fp_status);
252 + set_float_rebias_underflow(FP_UE & env->fpscr, &env->fp_status);
253 if (tcg_enabled()) {
254 fpscr_set_rounding_mode(env);
255 }