From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH v3 10/12] target/arm: Split out FPSCR.QC to a vector field
Date: Fri, 8 Feb 2019 19:38:45 -0800 [thread overview]
Message-ID: <20190209033847.9014-11-richard.henderson@linaro.org> (raw)
In-Reply-To: <20190209033847.9014-1-richard.henderson@linaro.org>
Change the representation of this field such that it is easy
to set from vector code.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/cpu.h | 5 ++++-
target/arm/helper.c | 19 +++++++++++++++----
target/arm/neon_helper.c | 2 +-
target/arm/vec_helper.c | 2 +-
4 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 47238e4245..b96463e8f1 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -577,11 +577,13 @@ typedef struct CPUARMState {
ARMPredicateReg preg_tmp;
#endif
- uint32_t xregs[16];
/* We store these fpcsr fields separately for convenience. */
+ uint32_t qc[4] QEMU_ALIGNED(16);
int vec_len;
int vec_stride;
+ uint32_t xregs[16];
+
/* Scratch space for aa32 neon expansion. */
uint32_t scratch[8];
@@ -1427,6 +1429,7 @@ void vfp_set_fpscr(CPUARMState *env, uint32_t val);
#define FPCR_FZ16 (1 << 19) /* ARMv8.2+, FP16 flush-to-zero */
#define FPCR_FZ (1 << 24) /* Flush-to-zero enable bit */
#define FPCR_DN (1 << 25) /* Default NaN enable bit */
+#define FPCR_QC (1 << 27) /* Cumulative saturation bit */
static inline uint32_t vfp_get_fpsr(CPUARMState *env)
{
diff --git a/target/arm/helper.c b/target/arm/helper.c
index af22274bd9..7ed9933663 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -12585,8 +12585,7 @@ static inline int vfp_exceptbits_from_host(int host_bits)
uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
{
- int i;
- uint32_t fpscr;
+ uint32_t i, fpscr;
fpscr = env->vfp.xregs[ARM_VFP_FPSCR]
| (env->vfp.vec_len << 16)
@@ -12597,8 +12596,11 @@ uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
/* FZ16 does not generate an input denormal exception. */
i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
& ~float_flag_input_denormal);
-
fpscr |= vfp_exceptbits_from_host(i);
+
+ i = env->vfp.qc[0] | env->vfp.qc[1] | env->vfp.qc[2] | env->vfp.qc[3];
+ fpscr |= i ? FPCR_QC : 0;
+
return fpscr;
}
@@ -12645,10 +12647,19 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
* (which are stored in fp_status), and the other RES0 bits
* in between, then we clear all of the low 16 bits.
*/
- env->vfp.xregs[ARM_VFP_FPSCR] = val & 0xffc80000;
+ env->vfp.xregs[ARM_VFP_FPSCR] = val & 0xf7c80000;
env->vfp.vec_len = (val >> 16) & 7;
env->vfp.vec_stride = (val >> 20) & 3;
+ /*
+ * The bit we set within fpscr_q is arbitrary; the register as a
+ * whole being zero/non-zero is what counts.
+ */
+ env->vfp.qc[0] = val & FPCR_QC;
+ env->vfp.qc[1] = 0;
+ env->vfp.qc[2] = 0;
+ env->vfp.qc[3] = 0;
+
changed ^= val;
if (changed & (3 << 22)) {
i = (val >> 22) & 3;
diff --git a/target/arm/neon_helper.c b/target/arm/neon_helper.c
index 3249005b62..ed1c6fc41c 100644
--- a/target/arm/neon_helper.c
+++ b/target/arm/neon_helper.c
@@ -15,7 +15,7 @@
#define SIGNBIT (uint32_t)0x80000000
#define SIGNBIT64 ((uint64_t)1 << 63)
-#define SET_QC() env->vfp.xregs[ARM_VFP_FPSCR] |= CPSR_Q
+#define SET_QC() env->vfp.qc[0] = 1
#define NEON_TYPE1(name, type) \
typedef struct \
diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c
index 37f338732e..65a18af4e0 100644
--- a/target/arm/vec_helper.c
+++ b/target/arm/vec_helper.c
@@ -36,7 +36,7 @@
#define H4(x) (x)
#endif
-#define SET_QC() env->vfp.xregs[ARM_VFP_FPSCR] |= CPSR_Q
+#define SET_QC() env->vfp.qc[0] = 1
static void clear_tail(void *vd, uintptr_t opr_sz, uintptr_t max_sz)
{
--
2.17.2
next prev parent reply other threads:[~2019-02-09 3:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-09 3:38 [Qemu-devel] [PATCH v3 00/12] target/arm: tcg vector cleanups Richard Henderson
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 01/12] target/arm: Rely on optimization within tcg_gen_gvec_or Richard Henderson
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 02/12] target/arm: Use vector minmax expanders for aarch64 Richard Henderson
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 03/12] target/arm: Use vector minmax expanders for aarch32 Richard Henderson
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 04/12] target/arm: Use tcg integer min/max primitives for neon Richard Henderson
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 05/12] target/arm: Remove neon min/max helpers Richard Henderson
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 06/12] target/arm: Fix vfp_gdb_get/set_reg vs FPSCR Richard Henderson
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 07/12] target/arm: Fix arm_cpu_dump_state " Richard Henderson
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 08/12] target/arm: Split out flags setting from vfp compares Richard Henderson
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 09/12] target/arm: Fix set of bits kept in xregs[ARM_VFP_FPSCR] Richard Henderson
2019-02-09 3:38 ` Richard Henderson [this message]
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 11/12] target/arm: Use vector operations for saturation Richard Henderson
2019-02-09 3:38 ` [Qemu-devel] [PATCH v3 12/12] target/arm: Add missing clear_tail calls Richard Henderson
2019-02-09 3:56 ` [Qemu-devel] [PATCH v3 00/12] target/arm: tcg vector cleanups no-reply
2019-02-09 4:00 ` no-reply
2019-02-14 16:12 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190209033847.9014-11-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).