From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: bharata@linux.ibm.com, alex.bennee@linaro.org, david@redhat.com
Subject: [PATCH v2 10/10] softfloat: Use ppc64 assembly for {add, sub}{192, 256}
Date: Fri, 25 Sep 2020 08:20:47 -0700 [thread overview]
Message-ID: <20200925152047.709901-11-richard.henderson@linaro.org> (raw)
In-Reply-To: <20200925152047.709901-1-richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/fpu/softfloat-macros.h | 14 ++++++++++++++
fpu/softfloat.c | 27 +++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/include/fpu/softfloat-macros.h b/include/fpu/softfloat-macros.h
index 969a486fd2..d26cfaf267 100644
--- a/include/fpu/softfloat-macros.h
+++ b/include/fpu/softfloat-macros.h
@@ -449,6 +449,13 @@ static inline void
: "=&r"(*z0Ptr), "=&r"(*z1Ptr), "=&r"(*z2Ptr)
: "rZ"(a0), "rZ"(a1), "rZ"(a2), "rZ"(b0), "rZ"(b1), "rZ"(b2)
: "cc");
+#elif defined(__powerpc64__)
+ asm("addc %2, %5, %8\n\t"
+ "adde %1, %4, %7\n\t"
+ "adde %0, %3, %6"
+ : "=r"(*z0Ptr), "=&r"(*z1Ptr), "=&r"(*z2Ptr)
+ : "r"(a0), "r"(a1), "r"(a2), "r"(b0), "r"(b1), "r"(b2)
+ : "ca");
#else
uint64_t z0, z1, z2;
int8_t carry0, carry1;
@@ -521,6 +528,13 @@ static inline void
: "=&r"(*z0Ptr), "=&r"(*z1Ptr), "=&r"(*z2Ptr)
: "rZ"(a0), "rZ"(a1), "rZ"(a2), "rZ"(b0), "rZ"(b1), "rZ"(b2)
: "cc");
+#elif defined(__powerpc64__)
+ asm("subfc %2, %8, %5\n\t"
+ "subfe %1, %7, %4\n\t"
+ "subfe %0, %6, %3"
+ : "=&r"(*z0Ptr), "=&r"(*z1Ptr), "=&r"(*z2Ptr)
+ : "r"(a0), "r"(a1), "r"(a2), "r"(b0), "r"(b1), "r"(b2)
+ : "ca");
#else
uint64_t z0, z1, z2;
int8_t borrow0, borrow1;
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 07dc17caad..9af75b9146 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -7370,6 +7370,18 @@ static void sub256(UInt256 *r, UInt256 *a, UInt256 *b)
[b0] "rZ"(b->w[0]), [b1] "rZ"(b->w[1]),
[b2] "rZ"(b->w[2]), [b3] "rZ"(b->w[3])
: "cc");
+#elif defined(__powerpc64__)
+ asm("subfc %[r3], %[b3], %[a3]\n\t"
+ "subfe %[r2], %[b2], %[a2]\n\t"
+ "subfe %[r1], %[b1], %[a1]\n\t"
+ "subfe %[r0], %[b0], %[a0]"
+ : [r0] "=&r"(r->w[0]), [r1] "=&r"(r->w[1]),
+ [r2] "=&r"(r->w[2]), [r3] "=&r"(r->w[3])
+ : [a0] "r"(a->w[0]), [a1] "r"(a->w[1]),
+ [a2] "r"(a->w[2]), [a3] "r"(a->w[3]),
+ [b0] "r"(b->w[0]), [b1] "r"(b->w[1]),
+ [b2] "r"(b->w[2]), [b3] "r"(b->w[3])
+ : "ca");
#else
bool borrow = false;
@@ -7407,6 +7419,13 @@ static void neg256(UInt256 *a)
"ngc %0, %0"
: "+r"(a->w[0]), "+r"(a->w[1]), "+r"(a->w[2]), "+r"(a->w[3])
: : "cc");
+#elif defined(__powerpc64__)
+ asm("subfic %3, %3, 0\n\t"
+ "subfze %2, %2\n\t"
+ "subfze %1, %1\n\t"
+ "subfze %0, %0"
+ : "+r"(a->w[0]), "+r"(a->w[1]), "+r"(a->w[2]), "+r"(a->w[3])
+ : : "ca");
#else
/*
* Recall that -X - 1 = ~X, and that since this is negation,
@@ -7457,6 +7476,14 @@ static void add256(UInt256 *a, UInt256 *b)
: "+r"(a->w[0]), "+r"(a->w[1]), "+r"(a->w[2]), "+r"(a->w[3])
: "rZ"(b->w[0]), "rZ"(b->w[1]), "rZ"(b->w[2]), "rZ"(b->w[3])
: "cc");
+#elif defined(__powerpc64__)
+ asm("addc %3, %3, %7\n\t"
+ "adde %2, %2, %6\n\t"
+ "adde %1, %1, %5\n\t"
+ "adde %0, %0, %4"
+ : "+r"(a->w[0]), "+r"(a->w[1]), "+r"(a->w[2]), "+r"(a->w[3])
+ : "r"(b->w[0]), "r"(b->w[1]), "r"(b->w[2]), "r"(b->w[3])
+ : "ca");
#else
bool carry = false;
--
2.25.1
next prev parent reply other threads:[~2020-09-25 15:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-25 15:20 [PATCH v2 00/10] softfloat: Implement float128_muladd Richard Henderson
2020-09-25 15:20 ` [PATCH v2 01/10] softfloat: Use mulu64 for mul64To128 Richard Henderson
2020-10-15 19:08 ` Alex Bennée
2020-09-25 15:20 ` [PATCH v2 02/10] softfloat: Use int128.h for some operations Richard Henderson
2020-10-15 19:10 ` Alex Bennée
2020-09-25 15:20 ` [PATCH v2 03/10] softfloat: Tidy a * b + inf return Richard Henderson
2020-10-16 9:40 ` Alex Bennée
2020-10-16 17:04 ` Philippe Mathieu-Daudé
2020-09-25 15:20 ` [PATCH v2 04/10] softfloat: Add float_cmask and constants Richard Henderson
2020-10-16 9:44 ` Alex Bennée
2020-09-25 15:20 ` [PATCH v2 05/10] softfloat: Inline pick_nan_muladd into its caller Richard Henderson
2020-10-16 16:20 ` Alex Bennée
2020-10-16 16:36 ` Richard Henderson
2020-10-18 21:06 ` [PATCH] softfpu: Generalize pick_nan_muladd to opaque structures Richard Henderson
2020-10-19 9:57 ` Alex Bennée
2020-09-25 15:20 ` [PATCH v2 06/10] softfloat: Implement float128_muladd Richard Henderson
2020-10-16 16:31 ` Alex Bennée
2020-10-16 16:55 ` Richard Henderson
2020-09-25 15:20 ` [PATCH v2 07/10] softfloat: Use x86_64 assembly for {add, sub}{192, 256} Richard Henderson
2020-09-25 15:20 ` [PATCH v2 08/10] softfloat: Use x86_64 assembly for sh[rl]_double Richard Henderson
2020-09-25 15:20 ` [PATCH v2 09/10] softfloat: Use aarch64 assembly for {add, sub}{192, 256} Richard Henderson
2020-09-25 15:20 ` Richard Henderson [this message]
2020-10-15 17:23 ` [PATCH v2 00/10] softfloat: Implement float128_muladd Richard Henderson
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=20200925152047.709901-11-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=bharata@linux.ibm.com \
--cc=david@redhat.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).