[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 14/69] target/arm: Use FPST_FPCR_AH for BFMLAL*, BFMLSL* insns
From: |
Peter Maydell |
Subject: |
[PATCH v2 14/69] target/arm: Use FPST_FPCR_AH for BFMLAL*, BFMLSL* insns |
Date: |
Sat, 1 Feb 2025 16:39:17 +0000 |
When FPCR.AH is 1, use FPST_FPCR_AH for:
* AdvSIMD BFMLALB, BFMLALT
* SVE BFMLALB, BFMLALT, BFMLSLB, BFMLSLT
so that they get the required behaviour changes.
We do this by making gen_gvec_op4_fpst() take an ARMFPStatusFlavour
rather than a bool is_fp16; existing callsites now select
FPST_FPCR_F16_A64 vs FPST_FPCR_A64 themselves rather than passing in
the boolean.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/tcg/translate-a64.c | 20 +++++++++++++-------
target/arm/tcg/translate-sve.c | 6 ++++--
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index bb32ccabf0e..1da6e2b9456 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -765,10 +765,11 @@ static void gen_gvec_op4_env(DisasContext *s, bool is_q,
int rd, int rn,
* an out-of-line helper.
*/
static void gen_gvec_op4_fpst(DisasContext *s, bool is_q, int rd, int rn,
- int rm, int ra, bool is_fp16, int data,
+ int rm, int ra, ARMFPStatusFlavour fpsttype,
+ int data,
gen_helper_gvec_4_ptr *fn)
{
- TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_A64_F16 : FPST_A64);
+ TCGv_ptr fpst = fpstatus_ptr(fpsttype);
tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, rd),
vec_full_reg_offset(s, rn),
vec_full_reg_offset(s, rm),
@@ -5837,7 +5838,8 @@ static bool trans_BFMLAL_v(DisasContext *s, arg_qrrr_e *a)
}
if (fp_access_check(s)) {
/* Q bit selects BFMLALB vs BFMLALT. */
- gen_gvec_op4_fpst(s, true, a->rd, a->rn, a->rm, a->rd, false, a->q,
+ gen_gvec_op4_fpst(s, true, a->rd, a->rn, a->rm, a->rd,
+ s->fpcr_ah ? FPST_AH : FPST_A64, a->q,
gen_helper_gvec_bfmlal);
}
return true;
@@ -5870,7 +5872,8 @@ static bool trans_FCMLA_v(DisasContext *s, arg_FCMLA_v *a)
}
gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd,
- a->esz == MO_16, a->rot, fn[a->esz]);
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64,
+ a->rot, fn[a->esz]);
return true;
}
@@ -6450,7 +6453,8 @@ static bool do_fmla_vector_idx(DisasContext *s,
arg_qrrx_e *a, bool neg)
}
gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd,
- esz == MO_16, (a->idx << 1) | neg,
+ esz == MO_16 ? FPST_A64_F16 : FPST_A64,
+ (a->idx << 1) | neg,
fns[esz - 1]);
return true;
}
@@ -6585,7 +6589,8 @@ static bool trans_BFMLAL_vi(DisasContext *s, arg_qrrx_e
*a)
}
if (fp_access_check(s)) {
/* Q bit selects BFMLALB vs BFMLALT. */
- gen_gvec_op4_fpst(s, true, a->rd, a->rn, a->rm, a->rd, 0,
+ gen_gvec_op4_fpst(s, true, a->rd, a->rn, a->rm, a->rd,
+ s->fpcr_ah ? FPST_AH : FPST_A64,
(a->idx << 1) | a->q,
gen_helper_gvec_bfmlal_idx);
}
@@ -6614,7 +6619,8 @@ static bool trans_FCMLA_vi(DisasContext *s, arg_FCMLA_vi
*a)
}
if (fp_access_check(s)) {
gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd,
- a->esz == MO_16, (a->idx << 2) | a->rot, fn);
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64,
+ (a->idx << 2) | a->rot, fn);
}
return true;
}
diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c
index be2b5528ba0..e38a49dd31c 100644
--- a/target/arm/tcg/translate-sve.c
+++ b/target/arm/tcg/translate-sve.c
@@ -7117,7 +7117,8 @@ TRANS_FEAT_NONSTREAMING(BFMMLA, aa64_sve_bf16,
gen_gvec_env_arg_zzzz,
static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel)
{
return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal,
- a->rd, a->rn, a->rm, a->ra, sel, FPST_A64);
+ a->rd, a->rn, a->rm, a->ra, sel,
+ s->fpcr_ah ? FPST_AH : FPST_A64);
}
TRANS_FEAT(BFMLALB_zzzw, aa64_sve_bf16, do_BFMLAL_zzzw, a, false)
@@ -7127,7 +7128,8 @@ static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr_esz
*a, bool sel)
{
return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal_idx,
a->rd, a->rn, a->rm, a->ra,
- (a->index << 1) | sel, FPST_A64);
+ (a->index << 1) | sel,
+ s->fpcr_ah ? FPST_AH : FPST_A64);
}
TRANS_FEAT(BFMLALB_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, false)
--
2.34.1
- [PATCH v2 00/69] target/arm: FEAT_AFP and FEAT_RPRES, Peter Maydell, 2025/02/01
- [PATCH v2 01/69] target/i386: Do not raise Invalid for 0 * Inf + QNaN, Peter Maydell, 2025/02/01
- [PATCH v2 02/69] tests/tcg/x86_64/fma: Test some x86 fused-multiply-add cases, Peter Maydell, 2025/02/01
- [PATCH v2 03/69] fpu: Add float_class_denormal, Peter Maydell, 2025/02/01
- [PATCH v2 05/69] fpu: allow flushing of output denormals to be after rounding, Peter Maydell, 2025/02/01
- [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 <=
- [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, 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