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 3/6] target-arm: Make VFP binop helpers take pointer to fpstatus, not CPUState
Date: Wed, 25 May 2011 17:00:12 +0100 [thread overview]
Message-ID: <1306339215-1228-4-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1306339215-1228-1-git-send-email-peter.maydell@linaro.org>
Make the VFP binop helper functions take a pointer to the fp status, not
the entire CPUState. This will allow us to use them for Neon operations too.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target-arm/helper.c | 10 ++++++----
target-arm/helper.h | 16 ++++++++--------
target-arm/translate.c | 11 +++++++----
3 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 1cc492d..b26ffd6 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -2452,13 +2452,15 @@ void vfp_set_fpscr(CPUState *env, uint32_t val)
#define VFP_HELPER(name, p) HELPER(glue(glue(vfp_,name),p))
#define VFP_BINOP(name) \
-float32 VFP_HELPER(name, s)(float32 a, float32 b, CPUState *env) \
+float32 VFP_HELPER(name, s)(float32 a, float32 b, void *fpstp) \
{ \
- return float32_ ## name (a, b, &env->vfp.fp_status); \
+ float_status *fpst = fpstp; \
+ return float32_ ## name(a, b, fpst); \
} \
-float64 VFP_HELPER(name, d)(float64 a, float64 b, CPUState *env) \
+float64 VFP_HELPER(name, d)(float64 a, float64 b, void *fpstp) \
{ \
- return float64_ ## name (a, b, &env->vfp.fp_status); \
+ float_status *fpst = fpstp; \
+ return float64_ ## name(a, b, fpst); \
}
VFP_BINOP(add)
VFP_BINOP(sub)
diff --git a/target-arm/helper.h b/target-arm/helper.h
index 44800b1..40b4677 100644
--- a/target-arm/helper.h
+++ b/target-arm/helper.h
@@ -74,14 +74,14 @@ DEF_HELPER_2(set_user_reg, void, i32, i32)
DEF_HELPER_1(vfp_get_fpscr, i32, env)
DEF_HELPER_2(vfp_set_fpscr, void, env, i32)
-DEF_HELPER_3(vfp_adds, f32, f32, f32, env)
-DEF_HELPER_3(vfp_addd, f64, f64, f64, env)
-DEF_HELPER_3(vfp_subs, f32, f32, f32, env)
-DEF_HELPER_3(vfp_subd, f64, f64, f64, env)
-DEF_HELPER_3(vfp_muls, f32, f32, f32, env)
-DEF_HELPER_3(vfp_muld, f64, f64, f64, env)
-DEF_HELPER_3(vfp_divs, f32, f32, f32, env)
-DEF_HELPER_3(vfp_divd, f64, f64, f64, env)
+DEF_HELPER_3(vfp_adds, f32, f32, f32, ptr)
+DEF_HELPER_3(vfp_addd, f64, f64, f64, ptr)
+DEF_HELPER_3(vfp_subs, f32, f32, f32, ptr)
+DEF_HELPER_3(vfp_subd, f64, f64, f64, ptr)
+DEF_HELPER_3(vfp_muls, f32, f32, f32, ptr)
+DEF_HELPER_3(vfp_muld, f64, f64, f64, ptr)
+DEF_HELPER_3(vfp_divs, f32, f32, f32, ptr)
+DEF_HELPER_3(vfp_divd, f64, f64, f64, ptr)
DEF_HELPER_1(vfp_negs, f32, f32)
DEF_HELPER_1(vfp_negd, f64, f64)
DEF_HELPER_1(vfp_abss, f32, f32)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index a1ec459..ce9c770 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -909,10 +909,13 @@ static TCGv get_fpstatus_ptr(int neon)
#define VFP_OP2(name) \
static inline void gen_vfp_##name(int dp) \
{ \
- if (dp) \
- gen_helper_vfp_##name##d(cpu_F0d, cpu_F0d, cpu_F1d, cpu_env); \
- else \
- gen_helper_vfp_##name##s(cpu_F0s, cpu_F0s, cpu_F1s, cpu_env); \
+ TCGv fpst = get_fpstatus_ptr(0); \
+ if (dp) { \
+ gen_helper_vfp_##name##d(cpu_F0d, cpu_F0d, cpu_F1d, fpst); \
+ } else { \
+ gen_helper_vfp_##name##s(cpu_F0s, cpu_F0s, cpu_F1s, fpst); \
+ } \
+ tcg_temp_free_i32(fpst); \
}
VFP_OP2(add)
--
1.7.1
next prev parent reply other threads:[~2011-05-25 16:26 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 ` [Qemu-devel] [PATCH 2/6] target-arm: Add helper function to generate code to get fpstatus pointer Peter Maydell
2011-05-25 16:00 ` Peter Maydell [this message]
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-4-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).