mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
target/sparc: Initialize local scratch float_status from env->fp_status
In the helper functions flcmps and flcmpd we use a scratch float_status so that we don't change the CPU state if the comparison raises any floating point exception flags. Instead of zero-initializing this scratch float_status, initialize it as a copy of env->fp_status. This avoids the need to explicitly initialize settings like the NaN propagation rule or others we might add to softfloat in future. To do this we need to pass the CPU env pointer in to the helper. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20241202131347.498124-33-peter.maydell@linaro.org
This commit is contained in:
parent
ca81533e94
commit
5edd92d6c3
3 changed files with 8 additions and 8 deletions
|
@ -490,13 +490,13 @@ uint32_t helper_fcmpeq(CPUSPARCState *env, Int128 src1, Int128 src2)
|
|||
return finish_fcmp(env, r, GETPC());
|
||||
}
|
||||
|
||||
uint32_t helper_flcmps(float32 src1, float32 src2)
|
||||
uint32_t helper_flcmps(CPUSPARCState *env, float32 src1, float32 src2)
|
||||
{
|
||||
/*
|
||||
* FLCMP never raises an exception nor modifies any FSR fields.
|
||||
* Perform the comparison with a dummy fp environment.
|
||||
*/
|
||||
float_status discard = { };
|
||||
float_status discard = env->fp_status;
|
||||
FloatRelation r;
|
||||
|
||||
set_float_2nan_prop_rule(float_2nan_prop_s_ba, &discard);
|
||||
|
@ -518,9 +518,9 @@ uint32_t helper_flcmps(float32 src1, float32 src2)
|
|||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
uint32_t helper_flcmpd(float64 src1, float64 src2)
|
||||
uint32_t helper_flcmpd(CPUSPARCState *env, float64 src1, float64 src2)
|
||||
{
|
||||
float_status discard = { };
|
||||
float_status discard = env->fp_status;
|
||||
FloatRelation r;
|
||||
|
||||
set_float_2nan_prop_rule(float_2nan_prop_s_ba, &discard);
|
||||
|
|
|
@ -51,8 +51,8 @@ DEF_HELPER_FLAGS_3(fcmpd, TCG_CALL_NO_WG, i32, env, f64, f64)
|
|||
DEF_HELPER_FLAGS_3(fcmped, TCG_CALL_NO_WG, i32, env, f64, f64)
|
||||
DEF_HELPER_FLAGS_3(fcmpq, TCG_CALL_NO_WG, i32, env, i128, i128)
|
||||
DEF_HELPER_FLAGS_3(fcmpeq, TCG_CALL_NO_WG, i32, env, i128, i128)
|
||||
DEF_HELPER_FLAGS_2(flcmps, TCG_CALL_NO_RWG_SE, i32, f32, f32)
|
||||
DEF_HELPER_FLAGS_2(flcmpd, TCG_CALL_NO_RWG_SE, i32, f64, f64)
|
||||
DEF_HELPER_FLAGS_3(flcmps, TCG_CALL_NO_RWG_SE, i32, env, f32, f32)
|
||||
DEF_HELPER_FLAGS_3(flcmpd, TCG_CALL_NO_RWG_SE, i32, env, f64, f64)
|
||||
DEF_HELPER_2(raise_exception, noreturn, env, int)
|
||||
|
||||
DEF_HELPER_FLAGS_3(faddd, TCG_CALL_NO_WG, f64, env, f64, f64)
|
||||
|
|
|
@ -5584,7 +5584,7 @@ static bool trans_FLCMPs(DisasContext *dc, arg_FLCMPs *a)
|
|||
|
||||
src1 = gen_load_fpr_F(dc, a->rs1);
|
||||
src2 = gen_load_fpr_F(dc, a->rs2);
|
||||
gen_helper_flcmps(cpu_fcc[a->cc], src1, src2);
|
||||
gen_helper_flcmps(cpu_fcc[a->cc], tcg_env, src1, src2);
|
||||
return advance_pc(dc);
|
||||
}
|
||||
|
||||
|
@ -5601,7 +5601,7 @@ static bool trans_FLCMPd(DisasContext *dc, arg_FLCMPd *a)
|
|||
|
||||
src1 = gen_load_fpr_D(dc, a->rs1);
|
||||
src2 = gen_load_fpr_D(dc, a->rs2);
|
||||
gen_helper_flcmpd(cpu_fcc[a->cc], src1, src2);
|
||||
gen_helper_flcmpd(cpu_fcc[a->cc], tcg_env, src1, src2);
|
||||
return advance_pc(dc);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue