On Thu, 5 Nov 2026 03:41:17 +0800 Max Chou <[email protected]> wrote:
> Create a function to set all default controls for the float_status. > And set e4m3_nan_is_snan to false to follow the RISC-V isa extensions. > > Signed-off-by: Max Chou <[email protected]> Reviewed-by: Chao Liu <[email protected]> Thanks, Chao > --- > target/riscv/cpu.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c > index 362e5618091..53ecce8c398 100644 > --- a/target/riscv/cpu.c > +++ b/target/riscv/cpu.c > @@ -978,6 +978,14 @@ static bool riscv_cpu_has_work(CPUState *cs) > } > #endif /* !CONFIG_USER_ONLY */ > > +static void riscv_init_fp_status(float_status *s) > +{ > + set_default_nan_mode(1, s); > + /* Default NaN value: sign bit clear, frac msb set */ > + set_float_default_nan_pattern(0b01000000, s); > + set_float_e4m3_nan_is_snan(false, s); > +} > + > static void riscv_cpu_reset_hold(Object *obj, ResetType type) > { > CPUState *cs = CPU(obj); > @@ -1095,11 +1103,10 @@ static void riscv_cpu_reset_hold(Object *obj, > ResetType type) > env->xl = riscv_cpu_mxl(env); > cs->exception_index = RISCV_EXCP_NONE; > env->load_res = -1; > - set_default_nan_mode(1, &env->fp_status); > - /* Default NaN value: sign bit clear, frac msb set */ > - set_float_default_nan_pattern(0b01000000, &env->fp_status); > env->vill = true; > > + riscv_init_fp_status(&env->fp_status); > + > #ifndef CONFIG_USER_ONLY > #ifdef CONFIG_TCG > env->debug_mode = false; > -- > 2.56.0 > > > Sent using hkml (https://github.com/sjp38/hackermail)
