[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/19] target/arm: Use float_status in helper_vfp_fcvt{ds,sd}
From: |
Peter Maydell |
Subject: |
[PULL 11/19] target/arm: Use float_status in helper_vfp_fcvt{ds,sd} |
Date: |
Tue, 17 Dec 2024 17:19:29 +0000 |
From: Richard Henderson <richard.henderson@linaro.org>
Pass float_status not env to match other functions.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20241206031952.78776-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/helper.h | 4 ++--
target/arm/tcg/translate-a64.c | 15 ++++++++++-----
target/arm/tcg/translate-vfp.c | 4 ++--
target/arm/vfp_helper.c | 8 ++++----
4 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/target/arm/helper.h b/target/arm/helper.h
index 707a8daabb0..15bad0773c0 100644
--- a/target/arm/helper.h
+++ b/target/arm/helper.h
@@ -143,8 +143,8 @@ DEF_HELPER_3(vfp_cmpeh, void, f16, f16, env)
DEF_HELPER_3(vfp_cmpes, void, f32, f32, env)
DEF_HELPER_3(vfp_cmped, void, f64, f64, env)
-DEF_HELPER_2(vfp_fcvtds, f64, f32, env)
-DEF_HELPER_2(vfp_fcvtsd, f32, f64, env)
+DEF_HELPER_2(vfp_fcvtds, f64, f32, fpst)
+DEF_HELPER_2(vfp_fcvtsd, f32, f64, fpst)
DEF_HELPER_FLAGS_2(bfcvt, TCG_CALL_NO_RWG, i32, f32, fpst)
DEF_HELPER_FLAGS_2(bfcvt_pair, TCG_CALL_NO_RWG, i32, i64, fpst)
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index fda1176b3f4..ecbc46ba55f 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -8502,8 +8502,9 @@ static bool trans_FCVT_s_ds(DisasContext *s, arg_rr *a)
if (fp_access_check(s)) {
TCGv_i32 tcg_rn = read_fp_sreg(s, a->rn);
TCGv_i64 tcg_rd = tcg_temp_new_i64();
+ TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
- gen_helper_vfp_fcvtds(tcg_rd, tcg_rn, tcg_env);
+ gen_helper_vfp_fcvtds(tcg_rd, tcg_rn, fpst);
write_fp_dreg(s, a->rd, tcg_rd);
}
return true;
@@ -8528,8 +8529,9 @@ static bool trans_FCVT_s_sd(DisasContext *s, arg_rr *a)
if (fp_access_check(s)) {
TCGv_i64 tcg_rn = read_fp_dreg(s, a->rn);
TCGv_i32 tcg_rd = tcg_temp_new_i32();
+ TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
- gen_helper_vfp_fcvtsd(tcg_rd, tcg_rn, tcg_env);
+ gen_helper_vfp_fcvtsd(tcg_rd, tcg_rn, fpst);
write_fp_sreg(s, a->rd, tcg_rd);
}
return true;
@@ -9208,7 +9210,9 @@ static void gen_fcvtn_hs(TCGv_i64 d, TCGv_i64 n)
static void gen_fcvtn_sd(TCGv_i64 d, TCGv_i64 n)
{
TCGv_i32 tmp = tcg_temp_new_i32();
- gen_helper_vfp_fcvtsd(tmp, n, tcg_env);
+ TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
+
+ gen_helper_vfp_fcvtsd(tmp, n, fpst);
tcg_gen_extu_i32_i64(d, tmp);
}
@@ -9490,11 +9494,13 @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a)
* The only instruction like this is FCVTL.
*/
int pass;
+ TCGv_ptr fpst;
if (!fp_access_check(s)) {
return true;
}
+ fpst = fpstatus_ptr(FPST_FPCR);
if (a->esz == MO_64) {
/* 32 -> 64 bit fp conversion */
TCGv_i64 tcg_res[2];
@@ -9504,7 +9510,7 @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a)
for (pass = 0; pass < 2; pass++) {
tcg_res[pass] = tcg_temp_new_i64();
read_vec_element_i32(s, tcg_op, a->rn, srcelt + pass, MO_32);
- gen_helper_vfp_fcvtds(tcg_res[pass], tcg_op, tcg_env);
+ gen_helper_vfp_fcvtds(tcg_res[pass], tcg_op, fpst);
}
for (pass = 0; pass < 2; pass++) {
write_vec_element(s, tcg_res[pass], a->rd, pass, MO_64);
@@ -9513,7 +9519,6 @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a)
/* 16 -> 32 bit fp conversion */
int srcelt = a->q ? 4 : 0;
TCGv_i32 tcg_res[4];
- TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
TCGv_i32 ahp = get_ahp_flag();
for (pass = 0; pass < 4; pass++) {
diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c
index c160a86e703..3cbe9a7418d 100644
--- a/target/arm/tcg/translate-vfp.c
+++ b/target/arm/tcg/translate-vfp.c
@@ -2937,7 +2937,7 @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a)
vm = tcg_temp_new_i32();
vd = tcg_temp_new_i64();
vfp_load_reg32(vm, a->vm);
- gen_helper_vfp_fcvtds(vd, vm, tcg_env);
+ gen_helper_vfp_fcvtds(vd, vm, fpstatus_ptr(FPST_FPCR));
vfp_store_reg64(vd, a->vd);
return true;
}
@@ -2963,7 +2963,7 @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a)
vd = tcg_temp_new_i32();
vm = tcg_temp_new_i64();
vfp_load_reg64(vm, a->vm);
- gen_helper_vfp_fcvtsd(vd, vm, tcg_env);
+ gen_helper_vfp_fcvtsd(vd, vm, fpstatus_ptr(FPST_FPCR));
vfp_store_reg32(vd, a->vd);
return true;
}
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
index 8a56936751b..fc20a567530 100644
--- a/target/arm/vfp_helper.c
+++ b/target/arm/vfp_helper.c
@@ -400,14 +400,14 @@ FLOAT_CONVS(ui, d, float64, 64, u)
#undef FLOAT_CONVS
/* floating point conversion */
-float64 VFP_HELPER(fcvtd, s)(float32 x, CPUARMState *env)
+float64 VFP_HELPER(fcvtd, s)(float32 x, float_status *status)
{
- return float32_to_float64(x, &env->vfp.fp_status);
+ return float32_to_float64(x, status);
}
-float32 VFP_HELPER(fcvts, d)(float64 x, CPUARMState *env)
+float32 VFP_HELPER(fcvts, d)(float64 x, float_status *status)
{
- return float64_to_float32(x, &env->vfp.fp_status);
+ return float64_to_float32(x, status);
}
uint32_t HELPER(bfcvt)(float32 x, float_status *status)
--
2.34.1
- [PULL 03/19] target/arm: Convert helper-a64.c to fpst alias, (continued)
- [PULL 03/19] target/arm: Convert helper-a64.c to fpst alias, Peter Maydell, 2024/12/17
- [PULL 02/19] target/arm: Convert vfp_helper.c to fpst alias, Peter Maydell, 2024/12/17
- [PULL 01/19] target/arm: remove redundant code, Peter Maydell, 2024/12/17
- [PULL 07/19] target/arm: Convert sme_helper.c to fpst alias, Peter Maydell, 2024/12/17
- [PULL 05/19] target/arm: Convert neon_helper.c to fpst alias, Peter Maydell, 2024/12/17
- [PULL 04/19] target/arm: Convert vec_helper.c to fpst alias, Peter Maydell, 2024/12/17
- [PULL 06/19] target/arm: Convert sve_helper.c to fpst alias, Peter Maydell, 2024/12/17
- [PULL 09/19] target/arm: Convert neon_helper.c to use env alias, Peter Maydell, 2024/12/17
- [PULL 10/19] target/arm: Use float_status in helper_fcvtx_f64_to_f32, Peter Maydell, 2024/12/17
- [PULL 08/19] target/arm: Convert vec_helper.c to use env alias, Peter Maydell, 2024/12/17
- [PULL 11/19] target/arm: Use float_status in helper_vfp_fcvt{ds,sd},
Peter Maydell <=
- [PULL 15/19] target/arm: Add decodetree entry for DSB nXS variant, Peter Maydell, 2024/12/17
- [PULL 18/19] hw/intc/arm_gicv3_its: Zero initialize local DTEntry etc structs, Peter Maydell, 2024/12/17
- [PULL 13/19] target/arm: Add ARM_CP_ADD_TLBI_NXS type flag for NXS insns, Peter Maydell, 2024/12/17
- [PULL 19/19] tests/functional: update sbsa-ref firmware used in test, Peter Maydell, 2024/12/17
- [PULL 14/19] target/arm: Add ARM_CP_ADD_TLBI_NXS type flag to TLBI insns, Peter Maydell, 2024/12/17
- [PULL 16/19] target/arm: Enable FEAT_XS for the max cpu, Peter Maydell, 2024/12/17
- [PULL 12/19] target/arm: Implement fine-grained-trap handling for FEAT_XS, Peter Maydell, 2024/12/17
- [PULL 17/19] tests/tcg/aarch64: add system test for FEAT_XS, Peter Maydell, 2024/12/17
- Re: [PULL 00/19] target-arm queue, Stefan Hajnoczi, 2024/12/19