cvs commit: src/lib/msun/src e_rem_pio2f.c math_private.h s_cosf.c s_sinf.c s_tanf.c

Bruce Evans bde at FreeBSD.org
Mon Feb 25 13:33:21 UTC 2008


bde         2008-02-25 13:33:20 UTC

  FreeBSD src repository

  Modified files:
    lib/msun/src         e_rem_pio2f.c math_private.h s_cosf.c 
                         s_sinf.c s_tanf.c 
  Log:
  Change __ieee754_rem_pio2f() to return double instead of float so that
  this function and its callers cosf(), sinf() and tanf() don't waste time
  converting values from doubles to floats and back for |x| > 9pi/4.
  All these functions were optimized a few years ago to mostly use doubles
  internally and across the __kernel*() interfaces but not across the
  __ieee754_rem_pio2f() interface.
  
  This saves about 40 cycles in cosf(), sinf() and tanf() for |x| > 9pi/4
  on amd64 (A64), and about 20 cycles on i386 (A64) (except for cosf()
  and sinf() in the upper range).  40 cycles is about 35% for |x| < 9pi/4
  <= 2**19pi/2 and about 5% for |x| > 2**19pi/2.  The saving is much
  larger on amd64 than on i386 since the conversions are not easy to
  optimize except on i386 where some of them are automatic and others
  are optimized invalidly.  amd64 is still about 10% slower in cosf()
  and tanf() in the lower range due to conversion overhead.
  
  This also gives a tiny speedup for |x| <= 9pi/4 on amd64 (by simplifying
  the code).  It also avoids compiler bugs and/or additional slowness
  in the conversions on (not yet supported) machines where double_t !=
  double.
  
  Revision  Changes    Path
  1.26      +8 -11     src/lib/msun/src/e_rem_pio2f.c
  1.26      +1 -1      src/lib/msun/src/math_private.h
  1.17      +6 -6      src/lib/msun/src/s_cosf.c
  1.16      +6 -6      src/lib/msun/src/s_sinf.c
  1.16      +3 -3      src/lib/msun/src/s_tanf.c


More information about the cvs-src mailing list