This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][ppc] merge in powerpc version of slowpow.c
- From: Andreas Jaeger <aj at suse dot com>
- To: libc-alpha at sourceware dot org
- Date: Thu, 03 Jan 2013 11:07:33 +0100
- Subject: Re: [PATCH][ppc] merge in powerpc version of slowpow.c
- References: <20130103092025.GD5345@spoyarek.pnq.redhat.com>
On 01/03/2013 10:20 AM, Siddhesh Poyarekar wrote:
Hi,
The powerpc version of slowpow.c adds an extra pass with the long
double functions, which reduces the number of values that fall back
into the slow mpa phase. This should be useful for other
Do you have some examples that still fall in the slow mpa phase?
architectures as well if they have support for a larger long double.
Attached patch merges in the powerpc slowpow.c logic into the globally
used code and removes the former. I have verified that the test suite
does not regress on powerpc 32 and 64-bit as well as on x86_64.
The test cases in http://entropymine.com/imageworsener/slowpow/ are
now useless since all of those values get computed correctly using
long double and return in a flash. The powerpc performance with this
So, for x86-64 this is a great improvement - thanks!
change has improved by about 1%, which should be due to the favourable
branch prediction, which is biased towards finding an accurate result
using long double.
Siddhesh
* sysdeps/ieee754/dbl-64/slowpow.c (__slowpow)
[!NO_LONG_DOUBLE]: Try computing pow using long double.
* sysdeps/powerpc/powerpc32/power4/fpu/slowpow.c: Remove.
* sysdeps/powerpc/powerpc64/power4/fpu/slowpow.c: Likewise.
diff --git a/sysdeps/ieee754/dbl-64/slowpow.c b/sysdeps/ieee754/dbl-64/slowpow.c
index c303eaa..eafd6e1 100644
--- a/sysdeps/ieee754/dbl-64/slowpow.c
+++ b/sysdeps/ieee754/dbl-64/slowpow.c
@@ -47,13 +47,33 @@ double
SECTION
__slowpow(double x, double y, double z) {
double res,res1;
+
+ res = __halfulp (x, y); /* halfulp() returns -10 or x^y */
+ if (res >= 0)
+ return res; /* if result was really computed by halfulp */
+ /* else, if result was not really computed by halfulp */
+
+#ifndef NO_LONG_DOUBLE
+ long double ldw, ldz, ldpp;
+ static const long double ldeps = 0x4.0p-96;
Is that constant correct for all the various long double formats we have?
+
+ /* Compute pow as long double, 106 bits */
The comment 106 bits is not correct and needs updating,
Andreas
> [...]
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126