34 #define ELEMENT_COUNT(x) c7x::element_count_of<x>::value
36 #define ELEMENT_TYPE(x) typename c7x::element_type_of<x>::type
54 template <
typename vecType>
static inline vecType
divspMod_atan_i(vecType a, vecType b);
55 template <
typename vecType>
static inline vecType
atan2f_sr1i_atan_i(vecType g1, vecType s, vecType an);
58 template <
typename vecType>
static inline vecType
divspMod_atan_i(vecType a, vecType b)
60 vecType res, r0, d0, d1, p0, p1, Two;
76 template <
typename vecType,
typename vecBool>
83 vecType coef, negativeCoef, pih, pol, Zero, g2, g4, g6, g8, g10, g12, tmp1, tmp2, c1, c2, c3, c4, c5, c6, c7, c8,
84 res, res_minus, res_plus;
90 pih = (vecType) 1.57079632679;
92 c1 = (vecType) 0.00230158202;
93 c2 = (vecType) -0.01394551000;
94 c3 = (vecType) 0.03937087815;
95 c4 = (vecType) -0.07235669163;
96 c5 = (vecType) 0.10521499322;
97 c6 = (vecType) -0.14175076797;
98 c7 = (vecType) 0.19989300877;
99 c8 = (vecType) -0.33332930041;
108 __vpred cmp_swap = __cmp_eq_pred(s,
FALSE);
109 coef = __select(cmp_swap, Zero, coef);
115 negativeCoef = -coef;
116 __vpred cmp_sign = __cmp_eq_pred(an,
FALSE);
117 coef = __select(cmp_sign, coef, negativeCoef);
127 tmp1 = ((c5 * g8) + (c6 * g6)) + ((c7 * g4) + (c8 * g2));
128 tmp2 = ((((c1 * g4) + (c2 * g2)) + c3) * g12) + (c4 * g10);
131 pol = (pol * g1) + g1;
134 res_minus = coef - pol;
135 res_plus = coef + pol;
136 __vpred cmp_res = __cmp_eq_pred(s,
FALSE);
137 res = __select(cmp_res, res_plus, res_minus);
148 size_t numBlocks = 0;
149 size_t remNumBlocks = 0;
152 typedef typename c7x::make_full_vector<T>::type vec;
154 __SE_TEMPLATE_v1 se0Params = __gen_SE_TEMPLATE_v1();
155 __SA_TEMPLATE_v1 sa0Params = __gen_SA_TEMPLATE_v1();
163 numBlocks = length / c7x::element_count_of<vec>::value;
164 remNumBlocks = length % c7x::element_count_of<vec>::value;
175 vec g, res, b, x_abs, One, Zero;
178 TRUE = (c7x::char_vec) 1;
179 FALSE = (c7x::char_vec) 0;
184 for (
size_t i = 0; i < numBlocks; i++) {
185 vec inVec = c7x::strm_eng<0, vec>::get();
187 s = (c7x::char_vec) 0;
189 x_abs = __abs(inVec);
192 __vpred cmp_flag = __cmp_lt_pred(inVec, Zero);
201 vec a = c7x::strm_eng<0, vec>::get_adv();
203 __vpred cmp_div = __cmp_lt_pred(One, x_abs);
204 b = __select(cmp_div, a, b);
205 a = __select(cmp_div, One, a);
206 s = __select(cmp_div,
TRUE, s);
211 g = divspMod_atan_i<vec>(a, b);
216 res = atan2f_sr1i_atan_i<vec, c7x::char_vec>(g, s, an);
225 __vpred cmp_zero = __cmp_eq_pred(a, Zero);
226 res = __select(cmp_zero, Zero, res);
230 __vpred tmp = c7x::strm_agen<0, vec>::get_vpred();
231 vec *addr = c7x::strm_agen<0, vec>::get_adv(pDst);
232 __vstore_pred(tmp, addr, outVec);
template MATHLIB_STATUS MATHLIB_atan< float >(size_t length, float *pSrc, float *pDst)
static vecType atan2f_sr1i_atan_i(vecType g1, vecType s, vecType an)
static vecType divspMod_atan_i(vecType a, vecType b)
MATHLIB_STATUS MATHLIB_atan_sp(size_t length, float *pSrc, float *pDst)
This function is the C interface for MATHLIB_atan. Function accepts float pointers.
MATHLIB_STATUS MATHLIB_atan(size_t length, T *pSrc, T *pDst)
Performs the elementwise arc-tangent of the input vector. Function can be overloaded with float point...
static void MATHLIB_SE0SA0Close()
This method performs SE0 and SA0 close.
static void MATHLIB_SE0SA01DSequentialInit(__SE_TEMPLATE_v1 *se0Params, __SA_TEMPLATE_v1 *sa0Params, size_t length, T *pSrc, T *pDst)
static MATHLIB_STATUS MATHLIB_checkParams(size_t length, T *pSrc, T *pDst)
This method performs parameter checks for MATHLIB function.
static void MATHLIB_SE0SA0Open(__SE_TEMPLATE_v1 *se0Params, __SA_TEMPLATE_v1 *sa0Params, T *pSrc)
This method performs SE0 and SA0 open.
MATHLIB_STATUS_NAME
The enumeration of all status codes.