This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/5] sin/cos/sincos cleanups


Hi,

Here is another set of patches to clean up the sin/cos code further.  The focus
of these patches was to consolidate and simplify code in an attempt to reduce
duplicates and introduce some consistency in computation.  For example, there
are places that use fabs(x) and others that use if(x > 0) {... x ...} else {...
 -x ...}.  As a final patch, I inlined all of the support functions.

The cumulative effect of these patches is a 16% improvement in sincos in the
min case and 3% in the mean case in the microbenchmark.  sin regresses by 4% in
the min case and is largely unaffected by the mean case.  cos is faster by 3%
in the min case and unchanged in the mean case.  In addition to the
microbenchmark, I also tested SPEC2006, which gives about a 2% improvement on
aarch64 and similar (about 1.5%) on x86_64.

Tested on x86_64 and aarch64 to verify that there are no regressions.  There is
further scope for consolidation in these functions and I intend to continue
working on them on top of these changes.  While the primary effect will be
readability of the code, I also expect the changes to have a positive impact on
performance, especially for sincos.

Siddhesh

Siddhesh Poyarekar (5):
  Consolidate reduce_and_compute code
  Use fabs(x) instead of branching on signedness of input to sin and cos
  Consolidate input partitioning into do_cos and do_sin
  Use DO_SIN for sin(x) where 0.25 < |x| < 0.855469
  Inline all support functions for sin and cos

 sysdeps/ieee754/dbl-64/s_sin.c | 420 ++++++++++++++++-------------------------
 1 file changed, 158 insertions(+), 262 deletions(-)

-- 
2.7.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]