[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/28] target/arm: Enable FPSCR.QC bit for MVE
From: |
Peter Maydell |
Subject: |
[PULL 17/28] target/arm: Enable FPSCR.QC bit for MVE |
Date: |
Tue, 15 Jun 2021 16:43:54 +0100 |
MVE has an FPSCR.QC bit similar to the A-profile Neon one; when MVE
is implemented make the bit writeable, both in the generic "load and
store FPSCR" helper functions and in the code for handling the NZCVQC
sysreg which we had previously left as "TODO when we implement MVE".
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210614151007.4545-3-peter.maydell@linaro.org
---
target/arm/translate-vfp.c | 30 +++++++++++++++++++++---------
target/arm/vfp_helper.c | 3 ++-
2 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c
index d01e465821b..728856dfd45 100644
--- a/target/arm/translate-vfp.c
+++ b/target/arm/translate-vfp.c
@@ -784,10 +784,17 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int
regno,
{
TCGv_i32 fpscr;
tmp = loadfn(s, opaque);
- /*
- * TODO: when we implement MVE, write the QC bit.
- * For non-MVE, QC is RES0.
- */
+ if (dc_isar_feature(aa32_mve, s)) {
+ /* QC is only present for MVE; otherwise RES0 */
+ TCGv_i32 qc = tcg_temp_new_i32();
+ tcg_gen_andi_i32(qc, tmp, FPCR_QC);
+ /*
+ * The 4 vfp.qc[] fields need only be "zero" vs "non-zero";
+ * here writing the same value into all elements is simplest.
+ */
+ tcg_gen_gvec_dup_i32(MO_32, offsetof(CPUARMState, vfp.qc),
+ 16, 16, qc);
+ }
tcg_gen_andi_i32(tmp, tmp, FPCR_NZCV_MASK);
fpscr = load_cpu_field(vfp.xregs[ARM_VFP_FPSCR]);
tcg_gen_andi_i32(fpscr, fpscr, ~FPCR_NZCV_MASK);
@@ -869,6 +876,11 @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int
regno,
break;
}
+ if (regno == ARM_VFP_FPSCR_NZCVQC && !dc_isar_feature(aa32_mve, s)) {
+ /* QC is RES0 without MVE, so NZCVQC simplifies to NZCV */
+ regno = QEMU_VFP_FPSCR_NZCV;
+ }
+
switch (regno) {
case ARM_VFP_FPSCR:
tmp = tcg_temp_new_i32();
@@ -876,11 +888,11 @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int
regno,
storefn(s, opaque, tmp);
break;
case ARM_VFP_FPSCR_NZCVQC:
- /*
- * TODO: MVE has a QC bit, which we probably won't store
- * in the xregs[] field. For non-MVE, where QC is RES0,
- * we can just fall through to the FPSCR_NZCV case.
- */
+ tmp = tcg_temp_new_i32();
+ gen_helper_vfp_get_fpscr(tmp, cpu_env);
+ tcg_gen_andi_i32(tmp, tmp, FPCR_NZCVQC_MASK);
+ storefn(s, opaque, tmp);
+ break;
case QEMU_VFP_FPSCR_NZCV:
/*
* Read just NZCV; this is a special case to avoid the
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
index 496f0034772..8a716600592 100644
--- a/target/arm/vfp_helper.c
+++ b/target/arm/vfp_helper.c
@@ -220,7 +220,8 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
FPCR_LTPSIZE_LENGTH);
}
- if (arm_feature(env, ARM_FEATURE_NEON)) {
+ if (arm_feature(env, ARM_FEATURE_NEON) ||
+ cpu_isar_feature(aa32_mve, cpu)) {
/*
* The bit we set within fpscr_q is arbitrary; the register as a
* whole being zero/non-zero is what counts.
--
2.20.1
- [PULL 09/28] hw/acpi: Provide stub version of acpi_ghes_record_errors(), (continued)
- [PULL 09/28] hw/acpi: Provide stub version of acpi_ghes_record_errors(), Peter Maydell, 2021/06/15
- [PULL 14/28] hw/arm: gsj add pca9548, Peter Maydell, 2021/06/15
- [PULL 15/28] hw/arm: quanta-q71l add pca954x muxes, Peter Maydell, 2021/06/15
- [PULL 10/28] hw/acpi: Provide function acpi_ghes_present(), Peter Maydell, 2021/06/15
- [PULL 19/28] target/arm: Add handling for PSR.ECI/ICI, Peter Maydell, 2021/06/15
- [PULL 20/28] target/arm: Let vfp_access_check() handle late NOCP checks, Peter Maydell, 2021/06/15
- [PULL 21/28] target/arm: Implement MVE LCTP, Peter Maydell, 2021/06/15
- [PULL 22/28] target/arm: Implement MVE WLSTP insn, Peter Maydell, 2021/06/15
- [PULL 24/28] target/arm: Implement MVE LETP insn, Peter Maydell, 2021/06/15
- [PULL 28/28] include/qemu/int128.h: Add function to create Int128 from int64_t, Peter Maydell, 2021/06/15
- [PULL 17/28] target/arm: Enable FPSCR.QC bit for MVE,
Peter Maydell <=
- [PULL 18/28] target/arm: Handle VPR semantics in existing code, Peter Maydell, 2021/06/15
- [PULL 23/28] target/arm: Implement MVE DLSTP, Peter Maydell, 2021/06/15
- [PULL 16/28] target/arm: Provide and use H8 and H1_8 macros, Peter Maydell, 2021/06/15
- [PULL 26/28] target/arm: Move expand_pred_b() data to vec_helper.c, Peter Maydell, 2021/06/15
- [PULL 27/28] bitops.h: Provide hswap32(), hswap64(), wswap64() swapping operations, Peter Maydell, 2021/06/15
- [PULL 25/28] target/arm: Add framework for MVE decode, Peter Maydell, 2021/06/15