1 #ifndef INCLUDED_volk_32f_x3_sum_of_poly_32f_a_H
2 #define INCLUDED_volk_32f_x3_sum_of_poly_32f_a_H
9 #define MAX(X,Y) ((X) > (Y)?(X):(Y))
16 static inline void volk_32f_x3_sum_of_poly_32f_a_sse3(
float* target,
float* src0,
float* center_point_array,
float* cutoff,
unsigned int num_points) {
18 const unsigned int num_bytes = num_points*4;
29 __m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10;
31 xmm9 = _mm_setzero_ps();
32 xmm1 = _mm_setzero_ps();
34 xmm0 = _mm_load1_ps(¢er_point_array[0]);
35 xmm6 = _mm_load1_ps(¢er_point_array[1]);
36 xmm7 = _mm_load1_ps(¢er_point_array[2]);
37 xmm8 = _mm_load1_ps(¢er_point_array[3]);
39 xmm10 = _mm_load1_ps(cutoff);
41 int bound = num_bytes >> 4;
42 int leftovers = (num_bytes >> 2) & 3;
45 for(; i < bound; ++i) {
46 xmm2 = _mm_load_ps(src0);
47 xmm2 = _mm_max_ps(xmm10, xmm2);
48 xmm3 = _mm_mul_ps(xmm2, xmm2);
49 xmm4 = _mm_mul_ps(xmm2, xmm3);
50 xmm5 = _mm_mul_ps(xmm3, xmm3);
53 xmm2 = _mm_mul_ps(xmm2, xmm0);
54 xmm3 = _mm_mul_ps(xmm3, xmm6);
55 xmm4 = _mm_mul_ps(xmm4, xmm7);
56 xmm5 = _mm_mul_ps(xmm5, xmm8);
59 xmm2 = _mm_add_ps(xmm2, xmm3);
60 xmm3 = _mm_add_ps(xmm4, xmm5);
64 xmm9 = _mm_add_ps(xmm2, xmm9);
66 xmm1 = _mm_add_ps(xmm3, xmm1);
71 xmm2 = _mm_hadd_ps(xmm9, xmm1);
72 xmm3 = _mm_hadd_ps(xmm2, xmm2);
73 xmm4 = _mm_hadd_ps(xmm3, xmm3);
75 _mm_store_ss(&result, xmm4);
79 for(i = 0; i < leftovers; ++i) {
81 fst =
MAX(fst, *cutoff);
87 result += (center_point_array[0] * fst +
88 center_point_array[1] * sq +
89 center_point_array[2] * thrd +
90 center_point_array[3] * frth);
94 result += ((float)((bound * 4) + leftovers)) * center_point_array[4];
102 #ifdef LV_HAVE_GENERIC
104 static inline void volk_32f_x3_sum_of_poly_32f_generic(
float* target,
float* src0,
float* center_point_array,
float* cutoff,
unsigned int num_points) {
106 const unsigned int num_bytes = num_points*4;
119 for(; i < num_bytes >> 2; ++i) {
121 fst =
MAX(fst, *cutoff);
128 result += (center_point_array[0] * fst +
129 center_point_array[1] * sq +
130 center_point_array[2] * thrd +
131 center_point_array[3] * frth);
142 result += ((float)(num_bytes >> 2)) * (center_point_array[4]);
#define MAX(X, Y)
Definition: volk_32f_x3_sum_of_poly_32f.h:9