34 #define ELEMENT_COUNT(x) c7x::element_count_of<x>::value
36 #define ELEMENT_TYPE(x) typename c7x::element_type_of<x>::type
55 template <
typename vecType>
static inline vecType
sqrt_asin_i(vecType a);
56 template <
typename vecType>
static inline vecType
pol_est_asin_i(vecType x);
59 template <
typename vecType>
static inline vecType
sqrt_asin_i(vecType a)
65 vecType half, OneP5, zero, maxValue;
68 OneP5 = (vecType) 1.5;
70 maxValue = (vecType) std::numeric_limits<elemType>::max();
72 vecType p0, p1, r0, d0, y;
78 p1 = OneP5 - d0 * p0 * half;
84 __vpred cmp_lezero = __cmp_le_pred((vecType) a, zero);
85 y = __select(cmp_lezero, zero, y);
90 __vpred cmp_gtmax = __cmp_lt_pred(maxValue, (vecType) a);
91 y = __select(cmp_gtmax, maxValue, y);
102 vecType c16, c14, c12, c10, c8, c6, c4, c2, x2, x4, x6, x8, x10, x12, pol, tmp1, tmp2;
104 c16 = (vecType) 0.053002771381990;
105 c14 = (vecType) -0.010980624698693;
106 c12 = (vecType) 0.020659425186833;
107 c10 = (vecType) 0.022862784546374;
108 c8 = (vecType) 0.030636056280974;
109 c6 = (vecType) 0.044450959710588;
110 c4 = (vecType) 0.075034659380970;
111 c2 = (vecType) 0.166664771293503;
139 tmp1 = ((c8 * x8) + (c6 * x6)) + ((c4 * x4) + (c2 * x2));
140 tmp2 = ((((c16 * x4) + (c14 * x2)) + c12) * x12) + (c10 * x10);
154 size_t numBlocks = 0;
155 size_t remNumBlocks = 0;
158 typedef typename c7x::make_full_vector<T>::type vec;
160 __SE_TEMPLATE_v1 se0Params = __gen_SE_TEMPLATE_v1();
161 __SA_TEMPLATE_v1 sa0Params = __gen_SA_TEMPLATE_v1();
169 numBlocks = length / c7x::element_count_of<vec>::value;
170 remNumBlocks = length % c7x::element_count_of<vec>::value;
182 vec HalfPI, Zero, One, rsqr2, s, negativeOne;
183 vec res, x_abs, a, temp1, temp2, negativeS;
184 vec poly, scale, offset;
186 HalfPI = (vec) 1.570796327;
187 rsqr2 = (vec) 0.7071067811;
192 vec nan = (vec) 0x7FFFFFFFu;
195 for (
size_t i = 0; i < numBlocks; i++) {
196 vec inVec = c7x::strm_eng<0, vec>::get();
215 x_abs = __abs(inVec);
216 a = One - (x_abs * x_abs);
218 temp1 = sqrt_asin_i<vec>(a);
221 __vpred cmp_x_abs = __cmp_lt_pred(rsqr2, x_abs);
222 temp2 = __select(cmp_x_abs, temp1, x_abs);
223 offset = __select(cmp_x_abs, HalfPI, Zero);
224 scale = __select(cmp_x_abs, negativeOne, One);
230 poly = pol_est_asin_i<vec>(temp2);
232 res = scale * poly + offset;
243 __vpred cmp_lt_zero = __cmp_lt_pred(inVec, Zero);
244 s = __select(cmp_lt_zero, negativeS, s);
254 vec inVec1 = c7x::strm_eng<0, vec>::get_adv();
255 vec x_abs1 = __abs(inVec1);
256 __vpred cmp_gt_one = __cmp_lt_pred(One, x_abs1);
257 res = __select(cmp_gt_one, nan, res);
261 __vpred tmp = c7x::strm_agen<0, vec>::get_vpred();
262 vec *addr = c7x::strm_agen<0, vec>::get_adv(pDst);
263 __vstore_pred(tmp, addr, outVec);
static vecType sqrt_asin_i(vecType a)
static vecType pol_est_asin_i(vecType x)
template MATHLIB_STATUS MATHLIB_asin< float >(size_t length, float *pSrc, float *pDst)
MATHLIB_STATUS MATHLIB_asin_sp(size_t length, float *pSrc, float *pDst)
This function is the C interface for MATHLIB_asin. Function accepts float pointers.
MATHLIB_STATUS MATHLIB_asin(size_t length, T *pSrc, T *pDst)
Performs the elementwise arc-sine of an input vector. Function can be overloaded with float pointers,...
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.