34 #define ELEMENT_COUNT(x) c7x::element_count_of<x>::value
35 #define ELEMENT_TYPE(x) typename c7x::element_type_of<x>::type
60 size_t remNumBlocks = 0;
63 typedef typename c7x::make_full_vector<T>::type vec;
68 __SE_TEMPLATE_v1 se0Params = __gen_SE_TEMPLATE_v1();
69 __SA_TEMPLATE_v1 sa0Params = __gen_SA_TEMPLATE_v1();
77 numBlocks = length / c7x::element_count_of<vec>::value;
78 remNumBlocks = length % c7x::element_count_of<vec>::value;
90 vec half, OneP5, small, inf;
94 small = (vec) 1.17549435e-38f;
95 inf = (vec) 0x7F800000u;
98 for (
size_t i = 0; i < numBlocks; i++) {
99 vec inVec = c7x::strm_eng<0, vec>::get_adv();
105 vec x0, x1, x2, x3, outVec;
112 x0 = __recip_sqrt(inVec);
114 x3 = OneP5 - (x1 * x0 * half);
116 x2 = x1 * (OneP5 - (inVec * x1 * x1 * half));
123 __vpred cmp_lezero = __cmp_lt_pred(inVec, small);
124 outVec = __select(cmp_lezero, inf, x2);
126 __vpred tmp = c7x::strm_agen<0, vec>::get_vpred();
127 vec *addr = c7x::strm_agen<0, vec>::get_adv(pDst);
128 __vstore_pred(tmp, addr, outVec);
template MATHLIB_STATUS MATHLIB_rsqrt< float >(size_t length, float *pSrc, float *pDst)
MATHLIB_STATUS MATHLIB_rsqrt(size_t length, T *pSrc, T *pDst)
Performs the elementwise reciprocal square root of an input vectors. Function can be overloaded with ...
MATHLIB_STATUS MATHLIB_rsqrt_sp(size_t length, float *pSrc, float *pDst)
This function is the C interface for MATHLIB_rsqrt. Function accepts 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.