Drop FloatFTZDetection and use #defines, like we do for
tininess_before_rounding. Rename get_float_ftz_detection
to get_ftz_before_rounding and move to softfloat.c, as
there are no external users.
Signed-off-by: Richard Henderson
---
include/fpu/softfloat-helpers.h | 10 ++
include/fpu/softfloat-types.h | 8 +++-
fpu/softfloat-parts.c.inc | 5 ++---
fpu/softfloat-specialize.c.inc | 5 +
4 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h
index 395ce67abf..d36e3a24b1 100644
--- a/include/fpu/softfloat-helpers.h
+++ b/include/fpu/softfloat-helpers.h
@@ -116,10 +116,9 @@ static inline void set_flush_inputs_to_zero(bool val,
float_status *status)
status->flush_inputs_to_zero = val;
}
-static inline void set_float_ftz_detection(FloatFTZDetection d,
- float_status *status)
+static inline void set_float_ftz_detection(bool val, float_status *status)
{
-status->ftz_detection = d;
+status->ftz_before_rounding = val;
}
static inline void set_default_nan_mode(bool val, float_status *status)
@@ -198,9 +197,4 @@ static inline FloatSNaNRule get_snan_rule(float_status
*status)
return status->float_snan_rule;
}
-static inline FloatFTZDetection get_float_ftz_detection(const float_status
*status)
-{
-return status->ftz_detection;
-}
-
#endif /* SOFTFLOAT_HELPERS_H */
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
index b8ce8ff78e..b83f67defc 100644
--- a/include/fpu/softfloat-types.h
+++ b/include/fpu/softfloat-types.h
@@ -341,10 +341,8 @@ typedef enum __attribute__((__packed__)) {
* configure it matches the default for tininess_before_rounding
* (i.e. "after rounding").
*/
-typedef enum __attribute__((__packed__)) {
-float_ftz_after_rounding = 0,
-float_ftz_before_rounding = 1,
-} FloatFTZDetection;
+#define float_ftz_after_rounding false
+#define float_ftz_before_rounding true
/*
* floatx80 is primarily used by x86 and m68k, and there are
@@ -416,7 +414,7 @@ typedef struct float_status {
/* should denormalised results go to zero and set output_denormal_flushed?
*/
bool flush_to_zero;
/* do we detect and flush denormal results before or after rounding? */
-FloatFTZDetection ftz_detection;
+bool ftz_before_rounding;
/* should denormalised inputs go to zero and set input_denormal_flushed? */
bool flush_inputs_to_zero;
bool default_nan_mode;
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
index ddef8cc089..22c11171f3 100644
--- a/fpu/softfloat-parts.c.inc
+++ b/fpu/softfloat-parts.c.inc
@@ -421,8 +421,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p,
float_status *s,
p->frac_lo &= ~round_mask;
}
fracN(shr)(p, frac_shift);
-} else if (get_flush_to_zero(s) &&
- s->ftz_detection == float_ftz_before_rounding) {
+} else if (get_flush_to_zero(s) && get_ftz_before_rounding(s)) {
flags |= float_flag_output_denormal_flushed;
p->cls = float_class_zero;
exp = 0;
@@ -473,7 +472,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p,
float_status *s,
if (is_tiny) {
if (get_flush_to_zero(s)) {
-assert(s->ftz_detection == float_ftz_after_rounding);
+assert(!get_ftz_before_rounding(s));
flags |= float_flag_output_denormal_flushed;
p->cls = float_class_zero;
exp = 0;
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
index ac3fc85138..bde68aa0ec 100644
--- a/fpu/softfloat-specialize.c.inc
+++ b/fpu/softfloat-specialize.c.inc
@@ -84,6 +84,11 @@ static inline bool get_tininess_before_rounding(const
float_status *status)
return status->tininess_before_rounding;
}
+static inline bool get_ftz_before_rounding(const float_status *status)
+{
+return status->ftz_before_rounding;
+}
+
/*
| For the deconstructed floating-point with fraction FRAC, return true
| if the fraction represents a signalling NaN; otherwise false.
--
2.43.0