From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>,
Paul Brook <paul@codesourcery.com>,
Aurelien Jarno <aurelien@aurel32.net>,
patches@linaro.org
Subject: [Qemu-devel] [PATCH 2/6] target-arm: Add helper function to generate code to get fpstatus pointer
Date: Wed, 25 May 2011 17:00:11 +0100 [thread overview]
Message-ID: <1306339215-1228-3-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1306339215-1228-1-git-send-email-peter.maydell@linaro.org>
Add and use a helper function which returns a TCGv which is a pointer
to the fp_status for either Neon or VFP operations.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target-arm/translate.c | 40 ++++++++++++++++------------------------
1 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 9a22f50..a1ec459 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -893,6 +893,19 @@ static inline void gen_add_datah_offset(DisasContext *s, unsigned int insn,
}
}
+static TCGv get_fpstatus_ptr(int neon)
+{
+ TCGv statusptr = tcg_temp_new_i32();
+ int offset;
+ if (neon) {
+ offset = offsetof(CPUState, vfp.standard_fp_status);
+ } else {
+ offset = offsetof(CPUState, vfp.fp_status);
+ }
+ tcg_gen_addi_i32(statusptr, cpu_env, offset);
+ return statusptr;
+}
+
#define VFP_OP2(name) \
static inline void gen_vfp_##name(int dp) \
{ \
@@ -980,14 +993,7 @@ static inline void gen_vfp_F1_ld0(int dp)
#define VFP_GEN_ITOF(name) \
static inline void gen_vfp_##name(int dp, int neon) \
{ \
- TCGv statusptr = tcg_temp_new_i32(); \
- int offset; \
- if (neon) { \
- offset = offsetof(CPUState, vfp.standard_fp_status); \
- } else { \
- offset = offsetof(CPUState, vfp.fp_status); \
- } \
- tcg_gen_addi_i32(statusptr, cpu_env, offset); \
+ TCGv statusptr = get_fpstatus_ptr(neon); \
if (dp) { \
gen_helper_vfp_##name##d(cpu_F0d, cpu_F0s, statusptr); \
} else { \
@@ -1003,14 +1009,7 @@ VFP_GEN_ITOF(sito)
#define VFP_GEN_FTOI(name) \
static inline void gen_vfp_##name(int dp, int neon) \
{ \
- TCGv statusptr = tcg_temp_new_i32(); \
- int offset; \
- if (neon) { \
- offset = offsetof(CPUState, vfp.standard_fp_status); \
- } else { \
- offset = offsetof(CPUState, vfp.fp_status); \
- } \
- tcg_gen_addi_i32(statusptr, cpu_env, offset); \
+ TCGv statusptr = get_fpstatus_ptr(neon); \
if (dp) { \
gen_helper_vfp_##name##d(cpu_F0s, cpu_F0d, statusptr); \
} else { \
@@ -1029,14 +1028,7 @@ VFP_GEN_FTOI(tosiz)
static inline void gen_vfp_##name(int dp, int shift, int neon) \
{ \
TCGv tmp_shift = tcg_const_i32(shift); \
- TCGv statusptr = tcg_temp_new_i32(); \
- int offset; \
- if (neon) { \
- offset = offsetof(CPUState, vfp.standard_fp_status); \
- } else { \
- offset = offsetof(CPUState, vfp.fp_status); \
- } \
- tcg_gen_addi_i32(statusptr, cpu_env, offset); \
+ TCGv statusptr = get_fpstatus_ptr(neon); \
if (dp) { \
gen_helper_vfp_##name##d(cpu_F0d, cpu_F0d, tmp_shift, statusptr); \
} else { \
--
1.7.1
next prev parent reply other threads:[~2011-05-25 16:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-25 16:00 [Qemu-devel] [PATCH 0/6] target-arm: reduce usage of global env Peter Maydell
2011-05-25 16:00 ` [Qemu-devel] [PATCH 1/6] Revert "target-arm: Use global env in iwmmxt_helper.c helpers" Peter Maydell
2011-05-25 16:00 ` Peter Maydell [this message]
2011-05-25 16:00 ` [Qemu-devel] [PATCH 3/6] target-arm: Make VFP binop helpers take pointer to fpstatus, not CPUState Peter Maydell
2011-05-25 16:00 ` [Qemu-devel] [PATCH 4/6] target-arm: Pass fp status pointer explicitly to neon fp helpers Peter Maydell
2011-05-25 16:00 ` [Qemu-devel] [PATCH 5/6] Revert "target-arm: Use global env in neon_helper.c helpers" Peter Maydell
2011-05-25 16:00 ` [Qemu-devel] [PATCH 6/6] Revert "Makefile.target: Allow target helpers to be in any *_helper.c file" Peter Maydell
2011-05-26 19:01 ` [Qemu-devel] [PATCH 0/6] target-arm: reduce usage of global env Blue Swirl
2011-05-26 19:34 ` Peter Maydell
2011-05-26 19:46 ` 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=1306339215-1228-3-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=patches@linaro.org \
--cc=paul@codesourcery.com \
--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).