From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [PATCH v2 04/11] target/arm: Use neon_element_offset in vfp_reg_offset
Date: Thu, 29 Oct 2020 19:26:11 -0700 [thread overview]
Message-ID: <20201030022618.785675-5-richard.henderson@linaro.org> (raw)
In-Reply-To: <20201030022618.785675-1-richard.henderson@linaro.org>
This seems a bit more readable than using offsetof CPU_DoubleU.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/translate.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/target/arm/translate.c b/target/arm/translate.c
index 88a926d1df..88ded4ac2c 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);
}
}
--
2.25.1
next prev parent reply other threads:[~2020-10-30 2:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 2:26 [PATCH v2 00/11] target/arm: Fix neon reg offsets Richard Henderson
2020-10-30 2:26 ` [PATCH v2 01/11] target/arm: Introduce neon_full_reg_offset Richard Henderson
2020-10-30 2:26 ` [PATCH v2 02/11] target/arm: Move neon_element_offset to translate.c Richard Henderson
2020-10-30 2:26 ` [PATCH v2 03/11] target/arm: Use neon_element_offset in neon_load/store_reg Richard Henderson
2020-10-30 2:26 ` Richard Henderson [this message]
2020-10-30 2:26 ` [PATCH v2 05/11] target/arm: Add read/write_neon_element32 Richard Henderson
2020-10-30 2:26 ` [PATCH v2 06/11] target/arm: Expand read/write_neon_element32 to all MemOp Richard Henderson
2020-10-30 2:26 ` [PATCH v2 07/11] target/arm: Rename neon_load_reg32 to vfp_load_reg32 Richard Henderson
2020-10-30 2:26 ` [PATCH v2 08/11] target/arm: Add read/write_neon_element64 Richard Henderson
2020-10-30 2:26 ` [PATCH v2 09/11] target/arm: Rename neon_load_reg64 to vfp_load_reg64 Richard Henderson
2020-10-30 2:26 ` [PATCH v2 10/11] target/arm: Simplify do_long_3d and do_2scalar_long Richard Henderson
2020-10-30 2:26 ` [PATCH v2 11/11] target/arm: Improve do_prewiden_3d Richard Henderson
2020-10-30 14:07 ` [PATCH v2 00/11] target/arm: Fix neon reg offsets 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=20201030022618.785675-5-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).