diff options
Diffstat (limited to 'libm')
-rw-r--r-- | libm/src/k_cos.c | 12 | ||||
-rw-r--r-- | libm/src/k_sin.c | 11 |
2 files changed, 23 insertions, 0 deletions
diff --git a/libm/src/k_cos.c b/libm/src/k_cos.c index 00916d7..b8cdf8f 100644 --- a/libm/src/k_cos.c +++ b/libm/src/k_cos.c @@ -69,6 +69,17 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ double __kernel_cos(double x, double y) { +#if defined(KRAIT_NEON_OPTIMIZATION) + double hz,z,zz,r,w,k; + + z = x*x; + zz = z*z; + k = x*y; + hz = (float)0.5*z; + r = z*(z*(C1+z*(C2+z*((C3+z*C4)+zz*(C5+z*C6))))); + w = one-hz; + return w + (((one-w)-hz) + (r-k)); +#else double hz,z,r,w; z = x*x; @@ -76,4 +87,5 @@ __kernel_cos(double x, double y) hz = (float)0.5*z; w = one-hz; return w + (((one-w)-hz) + (z*r-x*y)); +#endif } diff --git a/libm/src/k_sin.c b/libm/src/k_sin.c index ae06a9d..ee641d4 100644 --- a/libm/src/k_sin.c +++ b/libm/src/k_sin.c @@ -60,6 +60,16 @@ S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ double __kernel_sin(double x, double y, int iy) { +#if defined(KRAIT_NEON_OPTIMIZATION) + double z,zz,r,v; + + z = x*x; + zz = z*z; + v = z*x; + r = S2+z*((S3+z*S4)+zz*(S5+z*S6)); + if(iy==0) return x+v*(S1+z*r); + else return x-((z*(half*y-v*r)-y)-v*S1); +#else double z,r,v; z = x*x; @@ -67,4 +77,5 @@ __kernel_sin(double x, double y, int iy) r = S2+z*(S3+z*(S4+z*(S5+z*S6))); if(iy==0) return x+v*(S1+z*r); else return x-((z*(half*y-v*r)-y)-v*S1); +#endif } |