1 #ifndef INCLUDED_volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_H
2 #define INCLUDED_volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_H
13 static inline void volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_sse3(
float* target,
lv_32fc_t* src0,
lv_32fc_t* points,
float scalar,
unsigned int num_points) {
15 const unsigned int num_bytes = num_points*8;
17 __m128 xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
20 memset(&diff, 0x0, 2*
sizeof(
float));
23 int bound = num_bytes >> 5;
24 int leftovers0 = (num_bytes >> 4) & 1;
25 int leftovers1 = (num_bytes >> 3) & 1;
30 xmm1 = _mm_setzero_ps();
31 xmm1 = _mm_loadl_pi(xmm1, (__m64*)src0);
32 xmm2 = _mm_load_ps((
float*)&points[0]);
33 xmm8 = _mm_load1_ps(&scalar);
34 xmm1 = _mm_movelh_ps(xmm1, xmm1);
35 xmm3 = _mm_load_ps((
float*)&points[2]);
38 for(; i < bound - 1; ++i) {
40 xmm4 = _mm_sub_ps(xmm1, xmm2);
41 xmm5 = _mm_sub_ps(xmm1, xmm3);
43 xmm6 = _mm_mul_ps(xmm4, xmm4);
44 xmm7 = _mm_mul_ps(xmm5, xmm5);
46 xmm2 = _mm_load_ps((
float*)&points[0]);
48 xmm4 = _mm_hadd_ps(xmm6, xmm7);
50 xmm3 = _mm_load_ps((
float*)&points[2]);
52 xmm4 = _mm_mul_ps(xmm4, xmm8);
54 _mm_store_ps(target, xmm4);
60 xmm4 = _mm_sub_ps(xmm1, xmm2);
61 xmm5 = _mm_sub_ps(xmm1, xmm3);
66 xmm6 = _mm_mul_ps(xmm4, xmm4);
67 xmm7 = _mm_mul_ps(xmm5, xmm5);
69 xmm4 = _mm_hadd_ps(xmm6, xmm7);
71 xmm4 = _mm_mul_ps(xmm4, xmm8);
73 _mm_store_ps(target, xmm4);
78 for(i = 0; i < leftovers0; ++i) {
80 xmm2 = _mm_load_ps((
float*)&points[0]);
82 xmm4 = _mm_sub_ps(xmm1, xmm2);
86 xmm6 = _mm_mul_ps(xmm4, xmm4);
88 xmm4 = _mm_hadd_ps(xmm6, xmm6);
90 xmm4 = _mm_mul_ps(xmm4, xmm8);
92 _mm_storeh_pi((__m64*)target, xmm4);
97 for(i = 0; i < leftovers1; ++i) {
99 diff = src0[0] - points[0];
109 #ifdef LV_HAVE_GENERIC
110 static inline void volk_32fc_x2_s32f_square_dist_scalar_mult_32f_generic(
float* target,
lv_32fc_t* src0,
lv_32fc_t* points,
float scalar,
unsigned int num_points) {
112 const unsigned int num_bytes = num_points*8;
118 for(; i < num_bytes >> 3; ++i) {
119 diff = src0[0] - points[i];
float complex lv_32fc_t
Definition: volk_complex.h:56
#define lv_creal(x)
Definition: volk_complex.h:76
#define lv_cimag(x)
Definition: volk_complex.h:78