[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 19/69] target/arm: Handle FPCR.NEP for 1-input scalar operatio
From: |
Peter Maydell |
Subject: |
[PATCH v2 19/69] target/arm: Handle FPCR.NEP for 1-input scalar operations |
Date: |
Sat, 1 Feb 2025 16:39:22 +0000 |
Handle FPCR.NEP for the 1-input scalar operations.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/tcg/translate-a64.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index 030c5d99d78..21e68878c48 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -8520,17 +8520,17 @@ static bool do_fp1_scalar_with_fpsttype(DisasContext
*s, arg_rr_e *a,
case MO_64:
t64 = read_fp_dreg(s, a->rn);
f->gen_d(t64, t64, fpst);
- write_fp_dreg(s, a->rd, t64);
+ write_fp_dreg_merging(s, a->rd, a->rd, t64);
break;
case MO_32:
t32 = read_fp_sreg(s, a->rn);
f->gen_s(t32, t32, fpst);
- write_fp_sreg(s, a->rd, t32);
+ write_fp_sreg_merging(s, a->rd, a->rd, t32);
break;
case MO_16:
t32 = read_fp_hreg(s, a->rn);
f->gen_h(t32, t32, fpst);
- write_fp_sreg(s, a->rd, t32);
+ write_fp_hreg_merging(s, a->rd, a->rd, t32);
break;
default:
g_assert_not_reached();
@@ -8651,7 +8651,7 @@ static bool trans_FCVT_s_ds(DisasContext *s, arg_rr *a)
TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
gen_helper_vfp_fcvtds(tcg_rd, tcg_rn, fpst);
- write_fp_dreg(s, a->rd, tcg_rd);
+ write_fp_dreg_merging(s, a->rd, a->rd, tcg_rd);
}
return true;
}
@@ -8664,8 +8664,8 @@ static bool trans_FCVT_s_hs(DisasContext *s, arg_rr *a)
TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp);
- /* write_fp_sreg is OK here because top half of result is zero */
- write_fp_sreg(s, a->rd, tmp);
+ /* write_fp_hreg_merging is OK here because top half of result is zero
*/
+ write_fp_hreg_merging(s, a->rd, a->rd, tmp);
}
return true;
}
@@ -8678,7 +8678,7 @@ static bool trans_FCVT_s_sd(DisasContext *s, arg_rr *a)
TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
gen_helper_vfp_fcvtsd(tcg_rd, tcg_rn, fpst);
- write_fp_sreg(s, a->rd, tcg_rd);
+ write_fp_sreg_merging(s, a->rd, a->rd, tcg_rd);
}
return true;
}
@@ -8692,8 +8692,8 @@ static bool trans_FCVT_s_hd(DisasContext *s, arg_rr *a)
TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
gen_helper_vfp_fcvt_f64_to_f16(tcg_rd, tcg_rn, fpst, ahp);
- /* write_fp_sreg is OK here because top half of tcg_rd is zero */
- write_fp_sreg(s, a->rd, tcg_rd);
+ /* write_fp_hreg_merging is OK here because top half of tcg_rd is zero
*/
+ write_fp_hreg_merging(s, a->rd, a->rd, tcg_rd);
}
return true;
}
@@ -8707,7 +8707,7 @@ static bool trans_FCVT_s_sh(DisasContext *s, arg_rr *a)
TCGv_i32 tcg_ahp = get_ahp_flag();
gen_helper_vfp_fcvt_f16_to_f32(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp);
- write_fp_sreg(s, a->rd, tcg_rd);
+ write_fp_sreg_merging(s, a->rd, a->rd, tcg_rd);
}
return true;
}
@@ -8721,7 +8721,7 @@ static bool trans_FCVT_s_dh(DisasContext *s, arg_rr *a)
TCGv_i32 tcg_ahp = get_ahp_flag();
gen_helper_vfp_fcvt_f16_to_f64(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp);
- write_fp_dreg(s, a->rd, tcg_rd);
+ write_fp_dreg_merging(s, a->rd, a->rd, tcg_rd);
}
return true;
}
@@ -8969,7 +8969,9 @@ static bool do_fcvt_f(DisasContext *s, arg_fcvt *a,
do_fcvt_scalar(s, a->esz | (is_signed ? MO_SIGN : 0),
a->esz, tcg_int, a->shift, a->rn, rmode);
- clear_vec(s, a->rd);
+ if (!s->fpcr_nep) {
+ clear_vec(s, a->rd);
+ }
write_vec_element(s, tcg_int, a->rd, 0, a->esz);
return true;
}
--
2.34.1
- [PATCH v2 06/69] target/arm: Define FPCR AH, FIZ, NEP bits, (continued)
- [PATCH v2 06/69] target/arm: Define FPCR AH, FIZ, NEP bits, Peter Maydell, 2025/02/01
- [PATCH v2 04/69] fpu: Implement float_flag_input_denormal_used, Peter Maydell, 2025/02/01
- [PATCH v2 11/69] target/arm: Set up float_status to use for FPCR.AH=1 behaviour, Peter Maydell, 2025/02/01
- [PATCH v2 07/69] target/arm: Implement FPCR.FIZ handling, Peter Maydell, 2025/02/01
- [PATCH v2 14/69] target/arm: Use FPST_FPCR_AH for BFMLAL*, BFMLSL* insns, Peter Maydell, 2025/02/01
- [PATCH v2 08/69] target/arm: Adjust FP behaviour for FPCR.AH = 1, Peter Maydell, 2025/02/01
- [PATCH v2 09/69] target/arm: Adjust exception flag handling for AH = 1, Peter Maydell, 2025/02/01
- [PATCH v2 10/69] target/arm: Add FPCR.AH to tbflags, Peter Maydell, 2025/02/01
- [PATCH v2 13/69] target/arm: Use FPST_FPCR_AH for BFCVT* insns, Peter Maydell, 2025/02/01
- [PATCH v2 19/69] target/arm: Handle FPCR.NEP for 1-input scalar operations,
Peter Maydell <=
- [PATCH v2 17/69] target/arm: Handle FPCR.NEP for 3-input scalar operations, Peter Maydell, 2025/02/01
- [PATCH v2 16/69] target/arm: Define and use new write_fp_*reg_merging() functions, Peter Maydell, 2025/02/01
- [PATCH v2 15/69] target/arm: Add FPCR.NEP to TBFLAGS, Peter Maydell, 2025/02/01
- [PATCH v2 12/69] target/arm: Use FPST_FPCR_AH for FRECPE, FRECPS, FRECPX, FRSQRTE, FRSQRTS, Peter Maydell, 2025/02/01
- [PATCH v2 18/69] target/arm: Handle FPCR.NEP for BFCVT scalar, Peter Maydell, 2025/02/01
- [PATCH v2 21/69] target/arm: Handle FPCR.NEP for scalar FABS and FNEG, Peter Maydell, 2025/02/01
- [PATCH v2 24/69] target/arm: Implement FPCR.AH semantics for scalar FMIN/FMAX, Peter Maydell, 2025/02/01
- [PATCH v2 25/69] target/arm: Implement FPCR.AH semantics for vector FMIN/FMAX, Peter Maydell, 2025/02/01
- [PATCH v2 22/69] target/arm: Handle FPCR.NEP for FCVTXN (scalar), Peter Maydell, 2025/02/01
- [PATCH v2 20/69] target/arm: Handle FPCR.NEP in do_cvtf_scalar(), Peter Maydell, 2025/02/01