Skip to content

Commit

Permalink
target/mips: Set set_default_nan_mode with set_snan_bit_is_one
Browse files Browse the repository at this point in the history
This behavior is currently hard-coded in parts_silence_nan,
but setting this bit properly will allow this to be cleaned up.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed May 16, 2021
1 parent 57547c6 commit e9e5534
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions target/mips/fpu_helper.h
Expand Up @@ -27,8 +27,14 @@ static inline void restore_flush_mode(CPUMIPSState *env)

static inline void restore_snan_bit_mode(CPUMIPSState *env)
{
set_snan_bit_is_one((env->active_fpu.fcr31 & (1 << FCR31_NAN2008)) == 0,
&env->active_fpu.fp_status);
bool nan2008 = env->active_fpu.fcr31 & (1 << FCR31_NAN2008);

/*
* With nan2008, SNaNs are silenced in the usual way.
* Before that, SNaNs are not silenced; default nans are produced.
*/
set_snan_bit_is_one(!nan2008, &env->active_fpu.fp_status);
set_default_nan_mode(!nan2008, &env->active_fpu.fp_status);
}

static inline void restore_fp_status(CPUMIPSState *env)
Expand Down

0 comments on commit e9e5534

Please sign in to comment.