@samitouri / QOSamiQemu / commits / 1126ebe189

fpu: Use accessors for tininess_before_rounding

Rename get_float_detect_tininess to get_tininess_before_rounding and move to softfloat.c, as there are no external users. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Richard Henderson committed May 1, 2026 at 19:21 UTC 1126ebe189c0b9230fb171efaa682edf6115563a
5 files changed +9 -9
fpu/softfloat-parts.c.inc
+1 -1
@@ -418,7 +418,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
418 exp = 0;
419 fracN(clear)(p);
420 } else {
421 - bool is_tiny = s->tininess_before_rounding || exp < 0;
421 + bool is_tiny = get_tininess_before_rounding(s) || exp < 0;
422 bool has_pseudo_denormals = fmt->has_explicit_bit &&
423 (get_floatx80_behaviour(s) & floatx80_pseudo_denormal_valid);
424
fpu/softfloat-specialize.c.inc
+5
@@ -79,6 +79,11 @@ this code that are retained.
79 * version 2 or later. See the COPYING file in the top-level directory.
80 */
81
82 +static inline bool get_tininess_before_rounding(const float_status *status)
83 +{
84 + return status->tininess_before_rounding;
85 +}
86 +
87 /*----------------------------------------------------------------------------
88 | For the deconstructed floating-point with fraction FRAC, return true
89 | if the fraction represents a signalling NaN; otherwise false.
fpu/softfloat.c
+2 -2
@@ -4923,7 +4923,7 @@ floatx80 roundAndPackFloatx80(FloatX80RoundPrec roundingPrecision, bool zSign,
4923 float_raise(float_flag_output_denormal_flushed, status);
4924 return packFloatx80(zSign, 0, 0);
4925 }
4926 - isTiny = status->tininess_before_rounding
4926 + isTiny = get_tininess_before_rounding(status)
4927 || (zExp < 0 )
4928 || (zSig0 <= zSig0 + roundIncrement);
4929 shift64RightJamming( zSig0, 1 - zExp, &zSig0 );
@@ -4997,7 +4997,7 @@ floatx80 roundAndPackFloatx80(FloatX80RoundPrec roundingPrecision, bool zSign,
4997 return floatx80_default_inf(zSign, status);
4998 }
4999 if ( zExp <= 0 ) {
5000 - isTiny = status->tininess_before_rounding
5000 + isTiny = get_tininess_before_rounding(status)
5001 || (zExp < 0)
5002 || !increment
5003 || (zSig0 < UINT64_C(0xFFFFFFFFFFFFFFFF));
include/fpu/softfloat-helpers.h
-5
@@ -132,11 +132,6 @@ static inline void set_snan_rule(FloatSNaNRule val, float_status *status)
132 status->float_snan_rule = val;
133 }
134
135 -static inline bool get_float_detect_tininess(const float_status *status)
136 -{
137 - return status->tininess_before_rounding;
138 -}
139 -
135 static inline FloatRoundMode get_float_rounding_mode(const float_status *status)
136 {
137 return status->float_rounding_mode;
tests/fp/fp-test.c
+1 -1
@@ -1011,7 +1011,7 @@ void run_test(void)
1011
1012 verCases_tininessCode = 0;
1013 slowfloat_detectTininess = tmode;
1014 - qsf.tininess_before_rounding = sf_tininess_to_qemu(tmode);
1014 + set_float_detect_tininess(sf_tininess_to_qemu(tmode), &qsf);
1015
1016 if (attrs & FUNC_EFF_TININESSMODE ||
1017 ((attrs & FUNC_EFF_TININESSMODE_REDUCEDPREC) &&