Message ID | 20241025141254.2141506-15-peter.maydell@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | softfloat: Set 2-NaN propagation rule in float_status, not at compile time | expand |
On Fri, Oct 25, 2024 at 7:13 AM Peter Maydell <peter.maydell@linaro.org> wrote: > > Set the NaN propagation rule explicitly in xtensa_use_first_nan(). > > (When we convert the softfloat pickNaNMulAdd routine to also > select a NaN propagation rule at runtime, we will be able to > remove the use_first_nan flag because the propagation rules > will handle everything.) > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> > --- > target/xtensa/fpu_helper.c | 2 ++ > fpu/softfloat-specialize.c.inc | 12 +----------- > 2 files changed, 3 insertions(+), 11 deletions(-) Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
On 25/10/24 11:12, Peter Maydell wrote: > Set the NaN propagation rule explicitly in xtensa_use_first_nan(). > > (When we convert the softfloat pickNaNMulAdd routine to also > select a NaN propagation rule at runtime, we will be able to > remove the use_first_nan flag because the propagation rules > will handle everything.) > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> > --- > target/xtensa/fpu_helper.c | 2 ++ > fpu/softfloat-specialize.c.inc | 12 +----------- > 2 files changed, 3 insertions(+), 11 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
On 10/25/24 15:12, Peter Maydell wrote: > Set the NaN propagation rule explicitly in xtensa_use_first_nan(). > > (When we convert the softfloat pickNaNMulAdd routine to also > select a NaN propagation rule at runtime, we will be able to > remove the use_first_nan flag because the propagation rules > will handle everything.) > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> > --- > target/xtensa/fpu_helper.c | 2 ++ > fpu/softfloat-specialize.c.inc | 12 +----------- > 2 files changed, 3 insertions(+), 11 deletions(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
diff --git a/target/xtensa/fpu_helper.c b/target/xtensa/fpu_helper.c index 50a5efa65e2..f2d212d05df 100644 --- a/target/xtensa/fpu_helper.c +++ b/target/xtensa/fpu_helper.c @@ -60,6 +60,8 @@ static const struct { void xtensa_use_first_nan(CPUXtensaState *env, bool use_first) { set_use_first_nan(use_first, &env->fp_status); + set_float_2nan_prop_rule(use_first ? float_2nan_prop_ab : float_2nan_prop_ba, + &env->fp_status); } void HELPER(wur_fpu2k_fcr)(CPUXtensaState *env, uint32_t v) diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 8bc95187178..b050c5eb04a 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -405,18 +405,8 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \ || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) \ || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) \ - || defined(TARGET_SPARC) + || defined(TARGET_SPARC) || defined(TARGET_XTENSA) g_assert_not_reached(); -#elif defined(TARGET_XTENSA) - /* - * Xtensa has two NaN propagation modes. - * Which one is active is controlled by float_status::use_first_nan. - */ - if (status->use_first_nan) { - rule = float_2nan_prop_ab; - } else { - rule = float_2nan_prop_ba; - } #else rule = float_2nan_prop_x87; #endif
Set the NaN propagation rule explicitly in xtensa_use_first_nan(). (When we convert the softfloat pickNaNMulAdd routine to also select a NaN propagation rule at runtime, we will be able to remove the use_first_nan flag because the propagation rules will handle everything.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- target/xtensa/fpu_helper.c | 2 ++ fpu/softfloat-specialize.c.inc | 12 +----------- 2 files changed, 3 insertions(+), 11 deletions(-)