This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.26.9000-925-g91c318e
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 5 Dec 2017 16:48:35 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.26.9000-925-g91c318e
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 91c318e7b91467984bf68014ef37539d084a34ab (commit)
from c7e882b70563289ac441f2a3565846221e111d00 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=91c318e7b91467984bf68014ef37539d084a34ab
commit 91c318e7b91467984bf68014ef37539d084a34ab
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Dec 5 08:32:19 2017 -0800
s_sinf.c: Replace floor with simple casts
Since s_sinf.c either assigns the return value of floor to integer or
passes double converted from integer to floor, this patch replaces
floor with simple casts.
Also since long == int for 32-bit targets, we can use long instead of
int to avoid 64-bit integer for 64-bit targets.
On Skylake, bench-sinf reports performance improvement:
Before After Improvement
max 130.566 129.564 30%
min 7.704 7.706 0%
mean 21.8188 19.1363 30%
* sysdeps/ieee754/flt-32/s_sinf.c (reduced): Replace long with
int.
(SINF_FUNC): Likewise. Replace floor with simple casts.
diff --git a/ChangeLog b/ChangeLog
index f36d934..5636a57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/ieee754/flt-32/s_sinf.c (reduced): Replace long with
+ int.
+ (SINF_FUNC): Likewise. Replace floor with simple casts.
+
2017-12-05 Mike FABIAN <mfabian@redhat.com>
[BZ #22517]
diff --git a/sysdeps/ieee754/flt-32/s_sinf.c b/sysdeps/ieee754/flt-32/s_sinf.c
index 40d3d19..0b76477 100644
--- a/sysdeps/ieee754/flt-32/s_sinf.c
+++ b/sysdeps/ieee754/flt-32/s_sinf.c
@@ -85,8 +85,8 @@ static const int ones[] = { +1, -1 };
SIGNBIT is used to add the correct sign after the Chebyshev
polynomial is computed. */
static inline float
-reduced (const double theta, const unsigned long int n,
- const unsigned long int signbit)
+reduced (const double theta, const unsigned int n,
+ const unsigned int signbit)
{
double sx;
const double theta2 = theta * theta;
@@ -162,14 +162,14 @@ SINF_FUNC (float x)
}
else /* |x| >= Pi/4. */
{
- unsigned long int signbit = (x < 0);
+ unsigned int signbit = (x < 0);
if (abstheta < 9 * M_PI_4) /* |x| < 9*Pi/4. */
{
/* There are cases where FE_UPWARD rounding mode can
produce a result of abstheta * inv_PI_4 == 9,
where abstheta < 9pi/4, so the domain for
pio2_table must go to 5 (9 / 2 + 1). */
- unsigned long int n = (abstheta * inv_PI_4) + 1;
+ unsigned int n = (abstheta * inv_PI_4) + 1;
theta = abstheta - pio2_table[n / 2];
return reduced (theta, n, signbit);
}
@@ -177,8 +177,8 @@ SINF_FUNC (float x)
{
if (abstheta < 0x1p+23) /* |x| < 2^23. */
{
- unsigned long int n = __floor (abstheta * inv_PI_4) + 1.0;
- double x = __floor (n / 2.0);
+ unsigned int n = ((unsigned int) (abstheta * inv_PI_4)) + 1;
+ double x = n / 2;
theta = x * PI_2_lo + (x * PI_2_hi + abstheta);
/* Argument reduction needed. */
return reduced (theta, n, signbit);
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 ++++++
sysdeps/ieee754/flt-32/s_sinf.c | 12 ++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
hooks/post-receive
--
GNU C Library master sources