Mess up the "kernel" float trig function .c files with ifdefs so that

they can be #included in other .c files to give inline functions, and
use them to inline the functions in most callers (not in e_lgammaf_r.c).
__kernel_tanf() is too large and complicated for gcc to inline very well.

An athlons, this gives a speed increase under favourable pipeline
conditions of about 10% overall (larger for AXP, smaller for A64).
E.g., on AXP, sinf() on uniformly distributed args in [-2Pi, 2Pi]
now takes 30-56 cycles; it used to take 45-61 cycles; hardware fsin
takes 65-129.
This commit is contained in:
Bruce Evans 2005-11-21 04:57:12 +00:00
parent 9e5e0f978e
commit 4ce5120952
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152647
6 changed files with 25 additions and 0 deletions

View file

@ -14,9 +14,11 @@
* ==================================================== * ====================================================
*/ */
#ifndef INLINE_KERNEL_COSF
#ifndef lint #ifndef lint
static char rcsid[] = "$FreeBSD$"; static char rcsid[] = "$FreeBSD$";
#endif #endif
#endif
#include "math.h" #include "math.h"
#include "math_private.h" #include "math_private.h"
@ -28,6 +30,9 @@ C1 = 0xaaaaa5.0p-28, /* 0.041666645557 */
C2 = -0xb60615.0p-33, /* -0.0013887310633 */ C2 = -0xb60615.0p-33, /* -0.0013887310633 */
C3 = 0xccf47d.0p-39; /* 0.000024432542887 */ C3 = 0xccf47d.0p-39; /* 0.000024432542887 */
#ifdef INLINE_KERNEL_COSF
extern inline
#endif
float float
__kernel_cosf(float x, float y) __kernel_cosf(float x, float y)
{ {

View file

@ -14,9 +14,11 @@
* ==================================================== * ====================================================
*/ */
#ifndef INLINE_KERNEL_SINF
#ifndef lint #ifndef lint
static char rcsid[] = "$FreeBSD$"; static char rcsid[] = "$FreeBSD$";
#endif #endif
#endif
#include "math.h" #include "math.h"
#include "math_private.h" #include "math_private.h"
@ -29,6 +31,9 @@ S2 = 0x8888bb.0p-30, /* 0.0083333803341 */
S3 = -0xd02de1.0p-36, /* -0.00019853517006 */ S3 = -0xd02de1.0p-36, /* -0.00019853517006 */
S4 = 0xbe6dbe.0p-42; /* 0.0000028376084629 */ S4 = 0xbe6dbe.0p-42; /* 0.0000028376084629 */
#ifdef INLINE_KERNEL_SINF
extern inline
#endif
float float
__kernel_sinf(float x, float y, int iy) __kernel_sinf(float x, float y, int iy)
{ {

View file

@ -12,9 +12,11 @@
* ==================================================== * ====================================================
*/ */
#ifndef INLINE_KERNEL_TANF
#ifndef lint #ifndef lint
static char rcsid[] = "$FreeBSD$"; static char rcsid[] = "$FreeBSD$";
#endif #endif
#endif
#include "math.h" #include "math.h"
#include "math_private.h" #include "math_private.h"
@ -32,6 +34,9 @@ T[] = {
0xeaf97e.0p-31, /* 0.0071708550677 */ 0xeaf97e.0p-31, /* 0.0071708550677 */
}; };
#ifdef INLINE_KERNEL_TANF
extern inline
#endif
float float
__kernel_tanf(float x, float y, int iy) __kernel_tanf(float x, float y, int iy)
{ {

View file

@ -18,7 +18,11 @@ static char rcsid[] = "$FreeBSD$";
#endif #endif
#include "math.h" #include "math.h"
#define INLINE_KERNEL_COSF
#define INLINE_KERNEL_SINF
#include "math_private.h" #include "math_private.h"
#include "k_cosf.c"
#include "k_sinf.c"
/* Small multiples of pi/2 rounded to double precision. */ /* Small multiples of pi/2 rounded to double precision. */
static const double static const double

View file

@ -18,7 +18,11 @@ static char rcsid[] = "$FreeBSD$";
#endif #endif
#include "math.h" #include "math.h"
#define INLINE_KERNEL_COSF
#define INLINE_KERNEL_SINF
#include "math_private.h" #include "math_private.h"
#include "k_cosf.c"
#include "k_sinf.c"
/* Small multiples of pi/2 rounded to double precision. */ /* Small multiples of pi/2 rounded to double precision. */
static const double static const double

View file

@ -18,7 +18,9 @@ static char rcsid[] = "$FreeBSD$";
#endif #endif
#include "math.h" #include "math.h"
#define INLINE_KERNEL_TANF
#include "math_private.h" #include "math_private.h"
#include "k_tanf.c"
/* Small multiples of pi/2 rounded to double precision. */ /* Small multiples of pi/2 rounded to double precision. */
static const double static const double