[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 21/69] target/arm: Handle FPCR.NEP for scalar FABS and FNEG
From: |
Peter Maydell |
Subject: |
[PATCH v2 21/69] target/arm: Handle FPCR.NEP for scalar FABS and FNEG |
Date: |
Sat, 1 Feb 2025 16:39:24 +0000 |
Handle FPCR.NEP merging for scalar FABS and FNEG; this requires
an extra parameter to do_fp1_scalar_int(), since FMOV scalar
does not have the merging behaviour.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/tcg/translate-a64.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index f31ac3b9549..35db806d0b7 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -8437,21 +8437,30 @@ typedef struct FPScalar1Int {
} FPScalar1Int;
static bool do_fp1_scalar_int(DisasContext *s, arg_rr_e *a,
- const FPScalar1Int *f)
+ const FPScalar1Int *f,
+ bool merging)
{
switch (a->esz) {
case MO_64:
if (fp_access_check(s)) {
TCGv_i64 t = read_fp_dreg(s, a->rn);
f->gen_d(t, t);
- write_fp_dreg(s, a->rd, t);
+ if (merging) {
+ write_fp_dreg_merging(s, a->rd, a->rd, t);
+ } else {
+ write_fp_dreg(s, a->rd, t);
+ }
}
break;
case MO_32:
if (fp_access_check(s)) {
TCGv_i32 t = read_fp_sreg(s, a->rn);
f->gen_s(t, t);
- write_fp_sreg(s, a->rd, t);
+ if (merging) {
+ write_fp_sreg_merging(s, a->rd, a->rd, t);
+ } else {
+ write_fp_sreg(s, a->rd, t);
+ }
}
break;
case MO_16:
@@ -8461,7 +8470,11 @@ static bool do_fp1_scalar_int(DisasContext *s, arg_rr_e
*a,
if (fp_access_check(s)) {
TCGv_i32 t = read_fp_hreg(s, a->rn);
f->gen_h(t, t);
- write_fp_sreg(s, a->rd, t);
+ if (merging) {
+ write_fp_hreg_merging(s, a->rd, a->rd, t);
+ } else {
+ write_fp_sreg(s, a->rd, t);
+ }
}
break;
default:
@@ -8475,21 +8488,21 @@ static const FPScalar1Int f_scalar_fmov = {
tcg_gen_mov_i32,
tcg_gen_mov_i64,
};
-TRANS(FMOV_s, do_fp1_scalar_int, a, &f_scalar_fmov)
+TRANS(FMOV_s, do_fp1_scalar_int, a, &f_scalar_fmov, false)
static const FPScalar1Int f_scalar_fabs = {
gen_vfp_absh,
gen_vfp_abss,
gen_vfp_absd,
};
-TRANS(FABS_s, do_fp1_scalar_int, a, &f_scalar_fabs)
+TRANS(FABS_s, do_fp1_scalar_int, a, &f_scalar_fabs, true)
static const FPScalar1Int f_scalar_fneg = {
gen_vfp_negh,
gen_vfp_negs,
gen_vfp_negd,
};
-TRANS(FNEG_s, do_fp1_scalar_int, a, &f_scalar_fneg)
+TRANS(FNEG_s, do_fp1_scalar_int, a, &f_scalar_fneg, true)
typedef struct FPScalar1 {
void (*gen_h)(TCGv_i32, TCGv_i32, TCGv_ptr);
--
2.34.1
- Re: [PATCH v2 08/69] target/arm: Adjust FP behaviour for FPCR.AH = 1, (continued)
- [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, 2025/02/01
- [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 <=
- [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
- [PATCH v2 23/69] target/arm: Handle FPCR.NEP for NEP for FMUL, FMULX scalar by element, Peter Maydell, 2025/02/01
- [PATCH v2 27/69] target/arm: Implement FPCR.AH semantics for FMINP and FMAXP, Peter Maydell, 2025/02/01
- [PATCH v2 28/69] target/arm: Implement FPCR.AH semantics for SVE FMAXV and FMINV, Peter Maydell, 2025/02/01
- [PATCH v2 30/69] target/arm: Implement FPCR.AH semantics for SVE FMIN/FMAX vector, Peter Maydell, 2025/02/01
- [PATCH v2 26/69] target/arm: Implement FPCR.AH semantics for FMAXV and FMINV, Peter Maydell, 2025/02/01
- [PATCH v2 29/69] target/arm: Implement FPCR.AH semantics for SVE FMIN/FMAX immediate, Peter Maydell, 2025/02/01