34 #define ELEMENT_COUNT(x) c7x::element_count_of<x>::value
35 #define ELEMENT_TYPE(x) typename c7x::element_type_of<x>::type
61 size_t remNumBlocks = 0;
64 typedef typename c7x::make_full_vector<T>::type vec;
69 __SE_TEMPLATE_v1 se0Params = __gen_SE_TEMPLATE_v1();
70 __SA_TEMPLATE_v1 sa0Params = __gen_SA_TEMPLATE_v1();
78 numBlocks = length / c7x::element_count_of<vec>::value;
79 remNumBlocks = length % c7x::element_count_of<vec>::value;
91 vec half, OneP5, zero, maxValue;
96 maxValue = (vec) std::numeric_limits<elemType>::max();
99 for (
size_t i = 0; i < numBlocks; i++) {
100 vec inVec = c7x::strm_eng<0, vec>::get_adv();
113 p0 = __recip_sqrt(inVec);
115 p1 = OneP5 - d0 * p0 * half;
123 __vpred cmp_lezero = __cmp_le_pred(inVec, zero);
124 y = __select(cmp_lezero, zero, y);
127 __vpred cmp_gtmax = __cmp_le_pred(maxValue, inVec);
128 vec outVec = __select(cmp_gtmax, maxValue, y);
130 __vpred tmp = c7x::strm_agen<0, vec>::get_vpred();
131 vec *addr = c7x::strm_agen<0, vec>::get_adv(pDst);
132 __vstore_pred(tmp, addr, outVec);
template MATHLIB_STATUS MATHLIB_sqrt< float >(size_t length, float *pSrc, float *pDst)
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 MATHLIB_sqrt_sp(size_t length, float *pSrc, float *pDst)
This function is the C interface for MATHLIB_sqrt. Function accepts float pointers.
MATHLIB_STATUS MATHLIB_sqrt(size_t length, T *pSrc, T *pDst)
Performs the elementwise square root of an input vectors. Function can be overloaded with float point...
MATHLIB_STATUS_NAME
The enumeration of all status codes.