1 #ifndef INCLUDED_volk_32f_invsqrt_32f_a_H
2 #define INCLUDED_volk_32f_invsqrt_32f_a_H
9 static inline float Q_rsqrt(
float number )
12 const float threehalfs = 1.5F;
20 u.i = 0x5f3759df - ( u.i >> 1 );
21 u.f = u.f * ( threehalfs - ( x2 * u.f * u.f ) );
28 #include <immintrin.h>
35 static inline void volk_32f_invsqrt_32f_a_avx(
float* cVector,
const float* aVector,
unsigned int num_points){
36 unsigned int number = 0;
37 const unsigned int eighthPoints = num_points / 8;
39 float* cPtr = cVector;
40 const float* aPtr = aVector;
42 for (; number < eighthPoints; number++)
44 aVal = _mm256_load_ps(aPtr);
45 cVal = _mm256_rsqrt_ps(aVal);
46 _mm256_store_ps(cPtr, cVal);
51 number = eighthPoints * 8;
52 for(;number < num_points; number++)
59 #include <xmmintrin.h>
66 static inline void volk_32f_invsqrt_32f_a_sse(
float* cVector,
const float* aVector,
unsigned int num_points){
67 unsigned int number = 0;
68 const unsigned int quarterPoints = num_points / 4;
70 float* cPtr = cVector;
71 const float* aPtr = aVector;
74 for(;number < quarterPoints; number++){
76 aVal = _mm_load_ps(aPtr);
78 cVal = _mm_rsqrt_ps(aVal);
80 _mm_store_ps(cPtr,cVal);
86 number = quarterPoints * 4;
87 for(;number < num_points; number++){
93 #ifdef LV_HAVE_GENERIC
100 static inline void volk_32f_invsqrt_32f_generic(
float* cVector,
const float* aVector,
unsigned int num_points){
101 float* cPtr = cVector;
102 const float* aPtr = aVector;
103 unsigned int number = 0;
104 for(number = 0; number < num_points; number++){
111 #include <immintrin.h>
118 static inline void volk_32f_invsqrt_32f_u_avx(
float* cVector,
const float* aVector,
unsigned int num_points){
119 unsigned int number = 0;
120 const unsigned int eighthPoints = num_points / 8;
122 float* cPtr = cVector;
123 const float* aPtr = aVector;
125 for (; number < eighthPoints; number++)
127 aVal = _mm256_loadu_ps(aPtr);
128 cVal = _mm256_rsqrt_ps(aVal);
129 _mm256_storeu_ps(cPtr, cVal);
134 number = eighthPoints * 8;
135 for(;number < num_points; number++)
static float Q_rsqrt(float number)
Definition: volk_32f_invsqrt_32f.h:9
signed int int32_t
Definition: stdint.h:77