diff options
author | Elliott Hughes <enh@google.com> | 2023-01-25 21:31:42 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-01-25 21:31:42 +0000 |
commit | 8a481eb48cf7ace04026cbe776d65492f89a6d7d (patch) | |
tree | 945eb1832687ad5eb97c433013617dbe107718e5 /pl/math/atan_common.h | |
parent | 0bc581b0e4f509c96bffa7af329087ae2b4bfb97 (diff) | |
parent | 8783f524beaad825ac1bddeb93cef35b5f793513 (diff) | |
download | arm-optimized-routines-8a481eb48cf7ace04026cbe776d65492f89a6d7d.tar.gz |
Upgrade ARM-software/optimized-routines to v23.01 am: 62662f115a am: 8783f524be
Original change: https://android-review.googlesource.com/c/platform/external/arm-optimized-routines/+/2402215
Change-Id: Ief5438cf89d86c43e5f52d5e48b882bacb945170
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'pl/math/atan_common.h')
-rw-r--r-- | pl/math/atan_common.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/pl/math/atan_common.h b/pl/math/atan_common.h new file mode 100644 index 0000000..da0da64 --- /dev/null +++ b/pl/math/atan_common.h @@ -0,0 +1,49 @@ +/* + * Double-precision polynomial evaluation function for scalar and vector atan(x) + * and atan2(y,x). + * + * Copyright (c) 2021-2023, Arm Limited. + * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + */ + +#include "math_config.h" +#include "estrin.h" + +#if V_SUPPORTED + +#include "v_math.h" + +#define DBL_T v_f64_t +#define P(i) v_f64 (__atan_poly_data.poly[i]) + +#else + +#define DBL_T double +#define P(i) __atan_poly_data.poly[i] + +#endif + +/* Polynomial used in fast atan(x) and atan2(y,x) implementations + The order 19 polynomial P approximates (atan(sqrt(x))-sqrt(x))/x^(3/2). */ +static inline DBL_T +eval_poly (DBL_T z, DBL_T az, DBL_T shift) +{ + /* Use split Estrin scheme for P(z^2) with deg(P)=19. Use split instead of + full scheme to avoid underflow in x^16. */ + DBL_T z2 = z * z; + DBL_T x2 = z2 * z2; + DBL_T x4 = x2 * x2; + DBL_T x8 = x4 * x4; + DBL_T y + = FMA (ESTRIN_11_ (z2, x2, x4, x8, P, 8), x8, ESTRIN_7 (z2, x2, x4, P)); + + /* Finalize. y = shift + z + z^3 * P(z^2). */ + y = FMA (y, z2 * az, az); + y = y + shift; + + return y; +} + +#undef DBL_T +#undef FMA +#undef P |