Re: [PATCH 11/18] fpu: Use accessors for tininess_before_rounding

2026-05-08 Thread Philippe Mathieu-Daudé

On 8/5/26 00:17, Richard Henderson wrote:

Rename get_float_detect_tininess to get_tininess_before_rounding
and move to softfloat.c, as there are no external users.

Signed-off-by: Richard Henderson 
---
  include/fpu/softfloat-helpers.h | 5 -
  fpu/softfloat.c | 4 ++--
  tests/fp/fp-test.c  | 2 +-
  fpu/softfloat-parts.c.inc   | 2 +-
  fpu/softfloat-specialize.c.inc  | 5 +
  5 files changed, 9 insertions(+), 9 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



[PATCH 11/18] fpu: Use accessors for tininess_before_rounding

2026-05-07 Thread Richard Henderson
Rename get_float_detect_tininess to get_tininess_before_rounding
and move to softfloat.c, as there are no external users.

Signed-off-by: Richard Henderson 
---
 include/fpu/softfloat-helpers.h | 5 -
 fpu/softfloat.c | 4 ++--
 tests/fp/fp-test.c  | 2 +-
 fpu/softfloat-parts.c.inc   | 2 +-
 fpu/softfloat-specialize.c.inc  | 5 +
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h
index 95edd22842..395ce67abf 100644
--- a/include/fpu/softfloat-helpers.h
+++ b/include/fpu/softfloat-helpers.h
@@ -132,11 +132,6 @@ static inline void set_snan_rule(FloatSNaNRule val, 
float_status *status)
 status->float_snan_rule = val;
 }
 
-static inline bool get_float_detect_tininess(const float_status *status)
-{
-return status->tininess_before_rounding;
-}
-
 static inline FloatRoundMode get_float_rounding_mode(const float_status 
*status)
 {
 return status->float_rounding_mode;
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 1be90c9c7c..b1c2b0e6e1 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -4911,7 +4911,7 @@ floatx80 roundAndPackFloatx80(FloatX80RoundPrec 
roundingPrecision, bool zSign,
 float_raise(float_flag_output_denormal_flushed, status);
 return packFloatx80(zSign, 0, 0);
 }
-isTiny = status->tininess_before_rounding
+isTiny = get_tininess_before_rounding(status)
   || (zExp < 0 )
   || (zSig0 <= zSig0 + roundIncrement);
 shift64RightJamming( zSig0, 1 - zExp, &zSig0 );
@@ -4985,7 +4985,7 @@ floatx80 roundAndPackFloatx80(FloatX80RoundPrec 
roundingPrecision, bool zSign,
 return floatx80_default_inf(zSign, status);
 }
 if ( zExp <= 0 ) {
-isTiny = status->tininess_before_rounding
+isTiny = get_tininess_before_rounding(status)
   || (zExp < 0)
   || !increment
   || (zSig0 < UINT64_C(0x));
diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c
index 326a1201f3..16ffd36e6f 100644
--- a/tests/fp/fp-test.c
+++ b/tests/fp/fp-test.c
@@ -1011,7 +1011,7 @@ void run_test(void)
 
 verCases_tininessCode = 0;
 slowfloat_detectTininess = tmode;
-qsf.tininess_before_rounding = sf_tininess_to_qemu(tmode);
+set_float_detect_tininess(sf_tininess_to_qemu(tmode), 
&qsf);
 
 if (attrs & FUNC_EFF_TININESSMODE ||
 ((attrs & FUNC_EFF_TININESSMODE_REDUCEDPREC) &&
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
index 38b317c1a7..72bbafcb13 100644
--- a/fpu/softfloat-parts.c.inc
+++ b/fpu/softfloat-parts.c.inc
@@ -428,7 +428,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, 
float_status *s,
 exp = 0;
 fracN(clear)(p);
 } else {
-bool is_tiny = s->tininess_before_rounding || exp < 0;
+bool is_tiny = get_tininess_before_rounding(s) || exp < 0;
 bool has_pseudo_denormals = fmt->has_explicit_bit &&
 (get_floatx80_behaviour(s) & floatx80_pseudo_denormal_valid);
 
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
index 91250bc5a1..ac3fc85138 100644
--- a/fpu/softfloat-specialize.c.inc
+++ b/fpu/softfloat-specialize.c.inc
@@ -79,6 +79,11 @@ this code that are retained.
  * version 2 or later. See the COPYING file in the top-level directory.
  */
 
+static inline bool get_tininess_before_rounding(const float_status *status)
+{
+return status->tininess_before_rounding;
+}
+
 /*
 | For the deconstructed floating-point with fraction FRAC, return true
 | if the fraction represents a signalling NaN; otherwise false.
-- 
2.43.0