aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2020-11-02 16:52:13 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-11-02 16:52:13 +0000
commitd8719785fde2f5041986853a314c05c6f567d3cb (patch)
tree2eca052d650d8be4ba7a1b05d932f452563660a9
parent0f2cdc82276a723ee58562b56b9d537a4bd7bfef (diff)
downloadqemu-d8719785fde2f5041986853a314c05c6f567d3cb.zip
qemu-d8719785fde2f5041986853a314c05c6f567d3cb.tar.gz
qemu-d8719785fde2f5041986853a314c05c6f567d3cb.tar.bz2
target/arm: Use neon_element_offset in vfp_reg_offset
This seems a bit more readable than using offsetof CPU_DoubleU. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20201030022618.785675-5-richard.henderson@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--target/arm/translate.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/target/arm/translate.c b/target/arm/translate.c
index 88a926d..88ded4a 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -1122,18 +1122,13 @@ static long neon_element_offset(int reg, int element, MemOp size)
return neon_full_reg_offset(reg) + ofs;
}
-static inline long vfp_reg_offset(bool dp, unsigned reg)
+/* Return the offset of a VFP Dreg (dp = true) or VFP Sreg (dp = false). */
+static long vfp_reg_offset(bool dp, unsigned reg)
{
if (dp) {
- return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]);
+ return neon_element_offset(reg, 0, MO_64);
} else {
- long ofs = offsetof(CPUARMState, vfp.zregs[reg >> 2].d[(reg >> 1) & 1]);
- if (reg & 1) {
- ofs += offsetof(CPU_DoubleU, l.upper);
- } else {
- ofs += offsetof(CPU_DoubleU, l.lower);
- }
- return ofs;
+ return neon_element_offset(reg >> 1, reg & 1, MO_32);
}
}