From: luoyonggang@gmail.com
To: qemu-devel@nongnu.org
Cc: richard.henderson@linaro.org,
Yonggang Luo <luoyonggang@gmail.com>,
qemu-ppc@nongnu.org
Subject: [PATCH] ppc: Use hard-float in ppc fp_hlper as early as possible. This would increase the performance better than enable hard-float it in soft-float.c; Just using fadd fsub fmul fdiv as a simple bench demo. With this patch, performance are increased 2x. and 1.3x than the one enable hard-float in soft-float.c Both version are not considerate inexact fp exception yet.
Date: Tue, 5 May 2020 03:29:54 +0800 [thread overview]
Message-ID: <20200504192954.1387-1-luoyonggang@gmail.com> (raw)
From: Yonggang Luo <luoyonggang@gmail.com>
Just post as an idea to improve PPC fp performance.
With this idea, we have no need to adjust the helper orders.
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
target/ppc/fpu_helper.c | 44 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index 2bd49a2cdf..79051e4540 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -926,6 +926,17 @@ static void float_invalid_op_addsub(CPUPPCState *env, bool set_fpcc,
/* fadd - fadd. */
float64 helper_fadd(CPUPPCState *env, float64 arg1, float64 arg2)
{
+ CPU_DoubleU u1, u2;
+
+ u1.d = arg1;
+ u2.d = arg2;
+ CPU_DoubleU retDouble;
+ retDouble.nd = u1.nd + u2.nd;
+ if (likely(float64_is_zero_or_normal(retDouble.d)))
+ {
+ /* TODO: Handling inexact */
+ return retDouble.d;
+ }
float64 ret = float64_add(arg1, arg2, &env->fp_status);
int status = get_float_exception_flags(&env->fp_status);
@@ -941,6 +952,17 @@ float64 helper_fadd(CPUPPCState *env, float64 arg1, float64 arg2)
/* fsub - fsub. */
float64 helper_fsub(CPUPPCState *env, float64 arg1, float64 arg2)
{
+ CPU_DoubleU u1, u2;
+
+ u1.d = arg1;
+ u2.d = arg2;
+ CPU_DoubleU retDouble;
+ retDouble.nd = u1.nd - u2.nd;
+ if (likely(float64_is_zero_or_normal(retDouble.d)))
+ {
+ /* TODO: Handling inexact */
+ return retDouble.d;
+ }
float64 ret = float64_sub(arg1, arg2, &env->fp_status);
int status = get_float_exception_flags(&env->fp_status);
@@ -967,6 +989,17 @@ static void float_invalid_op_mul(CPUPPCState *env, bool set_fprc,
/* fmul - fmul. */
float64 helper_fmul(CPUPPCState *env, float64 arg1, float64 arg2)
{
+ CPU_DoubleU u1, u2;
+
+ u1.d = arg1;
+ u2.d = arg2;
+ CPU_DoubleU retDouble;
+ retDouble.nd = u1.nd * u2.nd;
+ if (likely(float64_is_zero_or_normal(retDouble.d)))
+ {
+ /* TODO: Handling inexact */
+ return retDouble.d;
+ }
float64 ret = float64_mul(arg1, arg2, &env->fp_status);
int status = get_float_exception_flags(&env->fp_status);
@@ -997,6 +1030,17 @@ static void float_invalid_op_div(CPUPPCState *env, bool set_fprc,
/* fdiv - fdiv. */
float64 helper_fdiv(CPUPPCState *env, float64 arg1, float64 arg2)
{
+ CPU_DoubleU u1, u2;
+
+ u1.d = arg1;
+ u2.d = arg2;
+ CPU_DoubleU retDouble;
+ retDouble.nd = u1.nd / u2.nd;
+ if (likely(float64_is_zero_or_normal(retDouble.d)))
+ {
+ /* TODO: Handling inexact */
+ return retDouble.d;
+ }
float64 ret = float64_div(arg1, arg2, &env->fp_status);
int status = get_float_exception_flags(&env->fp_status);
--
2.23.0.windows.1
next reply other threads:[~2020-05-04 19:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-04 19:29 luoyonggang [this message]
2020-05-04 20:02 ` [PATCH] ppc: Use hard-float in ppc fp_hlper as early as possible. This would increase the performance better than enable hard-float it in soft-float.c; Just using fadd fsub fmul fdiv as a simple bench demo. With this patch, performance are increased 2x. and 1.3x than the one enable hard-float in soft-float.c Both version are not considerate inexact fp exception yet 罗勇刚(Yonggang Luo)
2020-05-04 22:10 ` [PATCH] ppc: Use hard-float in ppc fp_hlper as early as possible Richard Henderson
2020-05-04 23:03 ` [PATCH] ppc: Use hard-float in ppc fp_hlper as early as possible. This would increase the performance better than enable hard-float it in soft-float.c; Just using fadd fsub fmul fdiv as a simple bench demo. With this patch, performance are increased 2x. and 1.3x than the one enable hard-float in soft-float.c Both version are not considerate inexact fp exception yet Aleksandar Markovic
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=20200504192954.1387-1-luoyonggang@gmail.com \
--to=luoyonggang@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.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).