fpu: Use {get,set}_flush_inputs_to_zero everywhere
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:15 UTC
6967da87c63009b00b166012e1cf2ec79cbef1ae
5 files changed
+12
-11
fpu/softfloat-parts.c.inc
+1
-1
@@ -218,7 +218,7 @@ static void partsN(canonicalize)(FloatPartsN *p, float_status *status,
218
if (unlikely(p->exp == 0)) {
219
if (likely(fracN(eqz)(p))) {
220
p->cls = float_class_zero;
221
- } else if (status->flush_inputs_to_zero) {
221
+ } else if (get_flush_inputs_to_zero(status)) {
222
float_raise(float_flag_input_denormal_flushed, status);
223
p->cls = float_class_zero;
224
fracN(clear)(p);
fpu/softfloat.c
+7
-7
@@ -141,7 +141,7 @@ GEN_INPUT_FLUSH__NOCHECK(float64_input_flush__nocheck, float64)
141
#define GEN_INPUT_FLUSH1(name, soft_t) \
142
static inline void name(soft_t *a, float_status *s) \
143
{ \
144
- if (likely(!s->flush_inputs_to_zero)) { \
144
+ if (likely(!get_flush_inputs_to_zero(s))) { \
145
return; \
146
} \
147
soft_t ## _input_flush__nocheck(a, s); \
@@ -154,7 +154,7 @@ GEN_INPUT_FLUSH1(float64_input_flush1, float64)
154
#define GEN_INPUT_FLUSH2(name, soft_t) \
155
static inline void name(soft_t *a, soft_t *b, float_status *s) \
156
{ \
157
- if (likely(!s->flush_inputs_to_zero)) { \
157
+ if (likely(!get_flush_inputs_to_zero(s))) { \
158
return; \
159
} \
160
soft_t ## _input_flush__nocheck(a, s); \
@@ -168,7 +168,7 @@ GEN_INPUT_FLUSH2(float64_input_flush2, float64)
168
#define GEN_INPUT_FLUSH3(name, soft_t) \
169
static inline void name(soft_t *a, soft_t *b, soft_t *c, float_status *s) \
170
{ \
171
- if (likely(!s->flush_inputs_to_zero)) { \
171
+ if (likely(!get_flush_inputs_to_zero(s))) { \
172
return; \
173
} \
174
soft_t ## _input_flush__nocheck(a, s); \
@@ -4764,7 +4764,7 @@ static bool parts_squash_denormal(FloatParts64 p, float_status *status)
4764
4765
float16 float16_squash_input_denormal(float16 a, float_status *status)
4766
{
4767
- if (status->flush_inputs_to_zero) {
4767
+ if (get_flush_inputs_to_zero(status)) {
4768
FloatParts64 p = unpack_raw64(&float16_params, a);
4769
4770
if (parts_squash_denormal(p, status)) {
@@ -4776,7 +4776,7 @@ float16 float16_squash_input_denormal(float16 a, float_status *status)
4776
4777
float32 float32_squash_input_denormal(float32 a, float_status *status)
4778
{
4779
- if (status->flush_inputs_to_zero) {
4779
+ if (get_flush_inputs_to_zero(status)) {
4780
FloatParts64 p = unpack_raw64(&float32_params, a);
4781
4782
if (parts_squash_denormal(p, status)) {
@@ -4788,7 +4788,7 @@ float32 float32_squash_input_denormal(float32 a, float_status *status)
4788
4789
float64 float64_squash_input_denormal(float64 a, float_status *status)
4790
{
4791
- if (status->flush_inputs_to_zero) {
4791
+ if (get_flush_inputs_to_zero(status)) {
4792
FloatParts64 p = unpack_raw64(&float64_params, a);
4793
4794
if (parts_squash_denormal(p, status)) {
@@ -4800,7 +4800,7 @@ float64 float64_squash_input_denormal(float64 a, float_status *status)
4800
4801
bfloat16 bfloat16_squash_input_denormal(bfloat16 a, float_status *status)
4802
{
4803
- if (status->flush_inputs_to_zero) {
4803
+ if (get_flush_inputs_to_zero(status)) {
4804
FloatParts64 p = unpack_raw64(&bfloat16_params, a);
4805
4806
if (parts_squash_denormal(p, status)) {
target/alpha/fpu_helper.c
+1
-1
@@ -151,7 +151,7 @@ void helper_ieee_input_cmp(CPUAlphaState *env, uint64_t val)
151
void helper_ieee_input_s(CPUAlphaState *env, uint64_t val)
152
{
153
if (unlikely(2 * val - 1 < 0x1fffffffffffffull)
154
- && !env->fp_status.flush_inputs_to_zero) {
154
+ && !get_flush_inputs_to_zero(&env->fp_status)) {
155
arith_excp(env, GETPC(), EXC_M_INV | EXC_M_SWC, 0);
156
}
157
}
target/alpha/helper.c
+2
-1
@@ -24,6 +24,7 @@
24
#include "exec/page-protection.h"
25
#include "exec/target_page.h"
26
#include "fpu/softfloat-types.h"
27
+#include "fpu/softfloat-helpers.h"
28
#include "exec/helper-proto.h"
29
#include "qemu/qemu-print.h"
30
#include "system/memory.h"
@@ -80,7 +81,7 @@ void cpu_alpha_store_fpcr(CPUAlphaState *env, uint64_t val)
81
env->fpcr_exc_enable = ~t & FPCR_STATUS_MASK;
82
83
env->fpcr_dyn_round = rm_map[(fpcr & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT];
83
- env->fp_status.flush_inputs_to_zero = (fpcr & FPCR_DNZ) != 0;
84
+ set_flush_inputs_to_zero(fpcr & FPCR_DNZ, &env->fp_status);
85
86
t = (fpcr & FPCR_UNFD) && (fpcr & FPCR_UNDZ);
87
#ifdef CONFIG_USER_ONLY
tests/fp/fp-bench.c
+1
-1
@@ -672,7 +672,7 @@ static void parse_args(int argc, char *argv[])
672
tester = val;
673
break;
674
case 'z':
675
- soft_status.flush_inputs_to_zero = 1;
675
+ set_flush_inputs_to_zero(true, &soft_status);
676
break;
677
case 'Z':
678
set_flush_to_zero(true, &soft_status);