GNU Radio 3.6.4.2 C++ API
|
00001 #ifndef INCLUDED_volk_32fc_x2_dot_prod_32fc_u_H 00002 #define INCLUDED_volk_32fc_x2_dot_prod_32fc_u_H 00003 00004 #include <volk/volk_common.h> 00005 #include <volk/volk_complex.h> 00006 #include <stdio.h> 00007 #include <string.h> 00008 00009 00010 #ifdef LV_HAVE_GENERIC 00011 00012 00013 static inline void volk_32fc_x2_dot_prod_32fc_generic(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) { 00014 00015 float * res = (float*) result; 00016 float * in = (float*) input; 00017 float * tp = (float*) taps; 00018 unsigned int n_2_ccomplex_blocks = num_points/2; 00019 unsigned int isodd = num_points &1; 00020 00021 00022 00023 float sum0[2] = {0,0}; 00024 float sum1[2] = {0,0}; 00025 unsigned int i = 0; 00026 00027 00028 for(i = 0; i < n_2_ccomplex_blocks; ++i) { 00029 00030 00031 sum0[0] += in[0] * tp[0] - in[1] * tp[1]; 00032 sum0[1] += in[0] * tp[1] + in[1] * tp[0]; 00033 sum1[0] += in[2] * tp[2] - in[3] * tp[3]; 00034 sum1[1] += in[2] * tp[3] + in[3] * tp[2]; 00035 00036 00037 in += 4; 00038 tp += 4; 00039 00040 } 00041 00042 00043 res[0] = sum0[0] + sum1[0]; 00044 res[1] = sum0[1] + sum1[1]; 00045 00046 00047 00048 for(i = 0; i < isodd; ++i) { 00049 00050 00051 *result += input[num_points - 1] * taps[num_points - 1]; 00052 00053 } 00054 00055 } 00056 00057 #endif /*LV_HAVE_GENERIC*/ 00058 00059 #ifdef LV_HAVE_SSE3 00060 00061 #include <pmmintrin.h> 00062 00063 static inline void volk_32fc_x2_dot_prod_32fc_u_sse3(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) { 00064 00065 00066 lv_32fc_t dotProduct; 00067 memset(&dotProduct, 0x0, 2*sizeof(float)); 00068 00069 unsigned int number = 0; 00070 const unsigned int halfPoints = num_points/2; 00071 00072 __m128 x, y, yl, yh, z, tmp1, tmp2, dotProdVal; 00073 00074 const lv_32fc_t* a = input; 00075 const lv_32fc_t* b = taps; 00076 00077 dotProdVal = _mm_setzero_ps(); 00078 00079 for(;number < halfPoints; number++){ 00080 00081 x = _mm_loadu_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi 00082 y = _mm_loadu_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di 00083 00084 yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr 00085 yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di 00086 00087 tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr 00088 00089 x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br 00090 00091 tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di 00092 00093 z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di 00094 00095 dotProdVal = _mm_add_ps(dotProdVal, z); // Add the complex multiplication results together 00096 00097 a += 2; 00098 b += 2; 00099 } 00100 00101 __VOLK_ATTR_ALIGNED(16) lv_32fc_t dotProductVector[2]; 00102 00103 _mm_storeu_ps((float*)dotProductVector,dotProdVal); // Store the results back into the dot product vector 00104 00105 dotProduct += ( dotProductVector[0] + dotProductVector[1] ); 00106 00107 if(num_points % 1 != 0) { 00108 dotProduct += (*a) * (*b); 00109 } 00110 00111 *result = dotProduct; 00112 } 00113 00114 #endif /*LV_HAVE_SSE3*/ 00115 00116 #endif /*INCLUDED_volk_32fc_x2_dot_prod_32fc_u_H*/ 00117 #ifndef INCLUDED_volk_32fc_x2_dot_prod_32fc_a_H 00118 #define INCLUDED_volk_32fc_x2_dot_prod_32fc_a_H 00119 00120 #include <volk/volk_common.h> 00121 #include <volk/volk_complex.h> 00122 #include <stdio.h> 00123 #include <string.h> 00124 00125 00126 #ifdef LV_HAVE_GENERIC 00127 00128 00129 static inline void volk_32fc_x2_dot_prod_32fc_a_generic(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) { 00130 00131 const unsigned int num_bytes = num_points*8; 00132 00133 float * res = (float*) result; 00134 float * in = (float*) input; 00135 float * tp = (float*) taps; 00136 unsigned int n_2_ccomplex_blocks = num_bytes >> 4; 00137 unsigned int isodd = (num_bytes >> 3) &1; 00138 00139 float sum0[2] = {0,0}; 00140 float sum1[2] = {0,0}; 00141 unsigned int i = 0; 00142 00143 for(i = 0; i < n_2_ccomplex_blocks; ++i) { 00144 sum0[0] += in[0] * tp[0] - in[1] * tp[1]; 00145 sum0[1] += in[0] * tp[1] + in[1] * tp[0]; 00146 sum1[0] += in[2] * tp[2] - in[3] * tp[3]; 00147 sum1[1] += in[2] * tp[3] + in[3] * tp[2]; 00148 00149 in += 4; 00150 tp += 4; 00151 } 00152 00153 res[0] = sum0[0] + sum1[0]; 00154 res[1] = sum0[1] + sum1[1]; 00155 00156 for(i = 0; i < isodd; ++i) { 00157 *result += input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1]; 00158 } 00159 } 00160 00161 #endif /*LV_HAVE_GENERIC*/ 00162 00163 00164 #if LV_HAVE_SSE && LV_HAVE_64 00165 00166 00167 static inline void volk_32fc_x2_dot_prod_32fc_a_sse_64(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) { 00168 00169 const unsigned int num_bytes = num_points*8; 00170 00171 asm 00172 ( 00173 "# ccomplex_dotprod_generic (float* result, const float *input,\n\t" 00174 "# const float *taps, unsigned num_bytes)\n\t" 00175 "# float sum0 = 0;\n\t" 00176 "# float sum1 = 0;\n\t" 00177 "# float sum2 = 0;\n\t" 00178 "# float sum3 = 0;\n\t" 00179 "# do {\n\t" 00180 "# sum0 += input[0] * taps[0] - input[1] * taps[1];\n\t" 00181 "# sum1 += input[0] * taps[1] + input[1] * taps[0];\n\t" 00182 "# sum2 += input[2] * taps[2] - input[3] * taps[3];\n\t" 00183 "# sum3 += input[2] * taps[3] + input[3] * taps[2];\n\t" 00184 "# input += 4;\n\t" 00185 "# taps += 4; \n\t" 00186 "# } while (--n_2_ccomplex_blocks != 0);\n\t" 00187 "# result[0] = sum0 + sum2;\n\t" 00188 "# result[1] = sum1 + sum3;\n\t" 00189 "# TODO: prefetch and better scheduling\n\t" 00190 " xor %%r9, %%r9\n\t" 00191 " xor %%r10, %%r10\n\t" 00192 " movq %%rcx, %%rax\n\t" 00193 " movq %%rcx, %%r8\n\t" 00194 " movq %[rsi], %%r9\n\t" 00195 " movq %[rdx], %%r10\n\t" 00196 " xorps %%xmm6, %%xmm6 # zero accumulators\n\t" 00197 " movaps 0(%%r9), %%xmm0\n\t" 00198 " xorps %%xmm7, %%xmm7 # zero accumulators\n\t" 00199 " movaps 0(%%r10), %%xmm2\n\t" 00200 " shr $5, %%rax # rax = n_2_ccomplex_blocks / 2\n\t" 00201 " shr $4, %%r8\n\t" 00202 " jmp .%=L1_test\n\t" 00203 " # 4 taps / loop\n\t" 00204 " # something like ?? cycles / loop\n\t" 00205 ".%=Loop1: \n\t" 00206 "# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000\n\t" 00207 "# movaps (%%r9), %%xmmA\n\t" 00208 "# movaps (%%r10), %%xmmB\n\t" 00209 "# movaps %%xmmA, %%xmmZ\n\t" 00210 "# shufps $0xb1, %%xmmZ, %%xmmZ # swap internals\n\t" 00211 "# mulps %%xmmB, %%xmmA\n\t" 00212 "# mulps %%xmmZ, %%xmmB\n\t" 00213 "# # SSE replacement for: pfpnacc %%xmmB, %%xmmA\n\t" 00214 "# xorps %%xmmPN, %%xmmA\n\t" 00215 "# movaps %%xmmA, %%xmmZ\n\t" 00216 "# unpcklps %%xmmB, %%xmmA\n\t" 00217 "# unpckhps %%xmmB, %%xmmZ\n\t" 00218 "# movaps %%xmmZ, %%xmmY\n\t" 00219 "# shufps $0x44, %%xmmA, %%xmmZ # b01000100\n\t" 00220 "# shufps $0xee, %%xmmY, %%xmmA # b11101110\n\t" 00221 "# addps %%xmmZ, %%xmmA\n\t" 00222 "# addps %%xmmA, %%xmmC\n\t" 00223 "# A=xmm0, B=xmm2, Z=xmm4\n\t" 00224 "# A'=xmm1, B'=xmm3, Z'=xmm5\n\t" 00225 " movaps 16(%%r9), %%xmm1\n\t" 00226 " movaps %%xmm0, %%xmm4\n\t" 00227 " mulps %%xmm2, %%xmm0\n\t" 00228 " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t" 00229 " movaps 16(%%r10), %%xmm3\n\t" 00230 " movaps %%xmm1, %%xmm5\n\t" 00231 " addps %%xmm0, %%xmm6\n\t" 00232 " mulps %%xmm3, %%xmm1\n\t" 00233 " shufps $0xb1, %%xmm5, %%xmm5 # swap internals\n\t" 00234 " addps %%xmm1, %%xmm6\n\t" 00235 " mulps %%xmm4, %%xmm2\n\t" 00236 " movaps 32(%%r9), %%xmm0\n\t" 00237 " addps %%xmm2, %%xmm7\n\t" 00238 " mulps %%xmm5, %%xmm3\n\t" 00239 " add $32, %%r9\n\t" 00240 " movaps 32(%%r10), %%xmm2\n\t" 00241 " addps %%xmm3, %%xmm7\n\t" 00242 " add $32, %%r10\n\t" 00243 ".%=L1_test:\n\t" 00244 " dec %%rax\n\t" 00245 " jge .%=Loop1\n\t" 00246 " # We've handled the bulk of multiplies up to here.\n\t" 00247 " # Let's sse if original n_2_ccomplex_blocks was odd.\n\t" 00248 " # If so, we've got 2 more taps to do.\n\t" 00249 " and $1, %%r8\n\t" 00250 " je .%=Leven\n\t" 00251 " # The count was odd, do 2 more taps.\n\t" 00252 " # Note that we've already got mm0/mm2 preloaded\n\t" 00253 " # from the main loop.\n\t" 00254 " movaps %%xmm0, %%xmm4\n\t" 00255 " mulps %%xmm2, %%xmm0\n\t" 00256 " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t" 00257 " addps %%xmm0, %%xmm6\n\t" 00258 " mulps %%xmm4, %%xmm2\n\t" 00259 " addps %%xmm2, %%xmm7\n\t" 00260 ".%=Leven:\n\t" 00261 " # neg inversor\n\t" 00262 " xorps %%xmm1, %%xmm1\n\t" 00263 " mov $0x80000000, %%r9\n\t" 00264 " movd %%r9, %%xmm1\n\t" 00265 " shufps $0x11, %%xmm1, %%xmm1 # b00010001 # 0 -0 0 -0\n\t" 00266 " # pfpnacc\n\t" 00267 " xorps %%xmm1, %%xmm6\n\t" 00268 " movaps %%xmm6, %%xmm2\n\t" 00269 " unpcklps %%xmm7, %%xmm6\n\t" 00270 " unpckhps %%xmm7, %%xmm2\n\t" 00271 " movaps %%xmm2, %%xmm3\n\t" 00272 " shufps $0x44, %%xmm6, %%xmm2 # b01000100\n\t" 00273 " shufps $0xee, %%xmm3, %%xmm6 # b11101110\n\t" 00274 " addps %%xmm2, %%xmm6\n\t" 00275 " # xmm6 = r1 i2 r3 i4\n\t" 00276 " movhlps %%xmm6, %%xmm4 # xmm4 = r3 i4 ?? ??\n\t" 00277 " addps %%xmm4, %%xmm6 # xmm6 = r1+r3 i2+i4 ?? ??\n\t" 00278 " movlps %%xmm6, (%[rdi]) # store low 2x32 bits (complex) to memory\n\t" 00279 : 00280 :[rsi] "r" (input), [rdx] "r" (taps), "c" (num_bytes), [rdi] "r" (result) 00281 :"rax", "r8", "r9", "r10" 00282 ); 00283 00284 00285 if(((num_bytes >> 3) & 1)) { 00286 *result += (input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1]); 00287 } 00288 00289 return; 00290 00291 } 00292 00293 #endif 00294 00295 #if LV_HAVE_SSE && LV_HAVE_32 00296 00297 static inline void volk_32fc_x2_dot_prod_32fc_a_sse_32(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) { 00298 volk_32fc_x2_dot_prod_32fc_a_generic(result, input, taps, num_points); 00299 00300 #if 0 00301 const unsigned int num_bytes = num_points*8; 00302 asm volatile 00303 ( 00304 " #pushl %%ebp\n\t" 00305 " #movl %%esp, %%ebp\n\t" 00306 " movl 12(%%ebp), %%eax # input\n\t" 00307 " movl 16(%%ebp), %%edx # taps\n\t" 00308 " movl 20(%%ebp), %%ecx # n_bytes\n\t" 00309 " xorps %%xmm6, %%xmm6 # zero accumulators\n\t" 00310 " movaps 0(%%eax), %%xmm0\n\t" 00311 " xorps %%xmm7, %%xmm7 # zero accumulators\n\t" 00312 " movaps 0(%%edx), %%xmm2\n\t" 00313 " shrl $5, %%ecx # ecx = n_2_ccomplex_blocks / 2\n\t" 00314 " jmp .%=L1_test\n\t" 00315 " # 4 taps / loop\n\t" 00316 " # something like ?? cycles / loop\n\t" 00317 ".%=Loop1: \n\t" 00318 "# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000\n\t" 00319 "# movaps (%%eax), %%xmmA\n\t" 00320 "# movaps (%%edx), %%xmmB\n\t" 00321 "# movaps %%xmmA, %%xmmZ\n\t" 00322 "# shufps $0xb1, %%xmmZ, %%xmmZ # swap internals\n\t" 00323 "# mulps %%xmmB, %%xmmA\n\t" 00324 "# mulps %%xmmZ, %%xmmB\n\t" 00325 "# # SSE replacement for: pfpnacc %%xmmB, %%xmmA\n\t" 00326 "# xorps %%xmmPN, %%xmmA\n\t" 00327 "# movaps %%xmmA, %%xmmZ\n\t" 00328 "# unpcklps %%xmmB, %%xmmA\n\t" 00329 "# unpckhps %%xmmB, %%xmmZ\n\t" 00330 "# movaps %%xmmZ, %%xmmY\n\t" 00331 "# shufps $0x44, %%xmmA, %%xmmZ # b01000100\n\t" 00332 "# shufps $0xee, %%xmmY, %%xmmA # b11101110\n\t" 00333 "# addps %%xmmZ, %%xmmA\n\t" 00334 "# addps %%xmmA, %%xmmC\n\t" 00335 "# A=xmm0, B=xmm2, Z=xmm4\n\t" 00336 "# A'=xmm1, B'=xmm3, Z'=xmm5\n\t" 00337 " movaps 16(%%eax), %%xmm1\n\t" 00338 " movaps %%xmm0, %%xmm4\n\t" 00339 " mulps %%xmm2, %%xmm0\n\t" 00340 " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t" 00341 " movaps 16(%%edx), %%xmm3\n\t" 00342 " movaps %%xmm1, %%xmm5\n\t" 00343 " addps %%xmm0, %%xmm6\n\t" 00344 " mulps %%xmm3, %%xmm1\n\t" 00345 " shufps $0xb1, %%xmm5, %%xmm5 # swap internals\n\t" 00346 " addps %%xmm1, %%xmm6\n\t" 00347 " mulps %%xmm4, %%xmm2\n\t" 00348 " movaps 32(%%eax), %%xmm0\n\t" 00349 " addps %%xmm2, %%xmm7\n\t" 00350 " mulps %%xmm5, %%xmm3\n\t" 00351 " addl $32, %%eax\n\t" 00352 " movaps 32(%%edx), %%xmm2\n\t" 00353 " addps %%xmm3, %%xmm7\n\t" 00354 " addl $32, %%edx\n\t" 00355 ".%=L1_test:\n\t" 00356 " decl %%ecx\n\t" 00357 " jge .%=Loop1\n\t" 00358 " # We've handled the bulk of multiplies up to here.\n\t" 00359 " # Let's sse if original n_2_ccomplex_blocks was odd.\n\t" 00360 " # If so, we've got 2 more taps to do.\n\t" 00361 " movl 20(%%ebp), %%ecx # n_2_ccomplex_blocks\n\t" 00362 " shrl $4, %%ecx\n\t" 00363 " andl $1, %%ecx\n\t" 00364 " je .%=Leven\n\t" 00365 " # The count was odd, do 2 more taps.\n\t" 00366 " # Note that we've already got mm0/mm2 preloaded\n\t" 00367 " # from the main loop.\n\t" 00368 " movaps %%xmm0, %%xmm4\n\t" 00369 " mulps %%xmm2, %%xmm0\n\t" 00370 " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t" 00371 " addps %%xmm0, %%xmm6\n\t" 00372 " mulps %%xmm4, %%xmm2\n\t" 00373 " addps %%xmm2, %%xmm7\n\t" 00374 ".%=Leven:\n\t" 00375 " # neg inversor\n\t" 00376 " movl 8(%%ebp), %%eax \n\t" 00377 " xorps %%xmm1, %%xmm1\n\t" 00378 " movl $0x80000000, (%%eax)\n\t" 00379 " movss (%%eax), %%xmm1\n\t" 00380 " shufps $0x11, %%xmm1, %%xmm1 # b00010001 # 0 -0 0 -0\n\t" 00381 " # pfpnacc\n\t" 00382 " xorps %%xmm1, %%xmm6\n\t" 00383 " movaps %%xmm6, %%xmm2\n\t" 00384 " unpcklps %%xmm7, %%xmm6\n\t" 00385 " unpckhps %%xmm7, %%xmm2\n\t" 00386 " movaps %%xmm2, %%xmm3\n\t" 00387 " shufps $0x44, %%xmm6, %%xmm2 # b01000100\n\t" 00388 " shufps $0xee, %%xmm3, %%xmm6 # b11101110\n\t" 00389 " addps %%xmm2, %%xmm6\n\t" 00390 " # xmm6 = r1 i2 r3 i4\n\t" 00391 " #movl 8(%%ebp), %%eax # @result\n\t" 00392 " movhlps %%xmm6, %%xmm4 # xmm4 = r3 i4 ?? ??\n\t" 00393 " addps %%xmm4, %%xmm6 # xmm6 = r1+r3 i2+i4 ?? ??\n\t" 00394 " movlps %%xmm6, (%%eax) # store low 2x32 bits (complex) to memory\n\t" 00395 " #popl %%ebp\n\t" 00396 : 00397 : 00398 : "eax", "ecx", "edx" 00399 ); 00400 00401 00402 int getem = num_bytes % 16; 00403 00404 for(; getem > 0; getem -= 8) { 00405 00406 00407 *result += (input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1]); 00408 00409 } 00410 00411 return; 00412 #endif 00413 } 00414 00415 #endif /*LV_HAVE_SSE*/ 00416 00417 #ifdef LV_HAVE_SSE3 00418 00419 #include <pmmintrin.h> 00420 00421 static inline void volk_32fc_x2_dot_prod_32fc_a_sse3(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) { 00422 00423 const unsigned int num_bytes = num_points*8; 00424 00425 lv_32fc_t dotProduct; 00426 memset(&dotProduct, 0x0, 2*sizeof(float)); 00427 00428 unsigned int number = 0; 00429 const unsigned int halfPoints = num_bytes >> 4; 00430 00431 __m128 x, y, yl, yh, z, tmp1, tmp2, dotProdVal; 00432 00433 const lv_32fc_t* a = input; 00434 const lv_32fc_t* b = taps; 00435 00436 dotProdVal = _mm_setzero_ps(); 00437 00438 for(;number < halfPoints; number++){ 00439 00440 x = _mm_load_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi 00441 y = _mm_load_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di 00442 00443 yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr 00444 yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di 00445 00446 tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr 00447 00448 x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br 00449 00450 tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di 00451 00452 z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di 00453 00454 dotProdVal = _mm_add_ps(dotProdVal, z); // Add the complex multiplication results together 00455 00456 a += 2; 00457 b += 2; 00458 } 00459 00460 __VOLK_ATTR_ALIGNED(16) lv_32fc_t dotProductVector[2]; 00461 00462 _mm_store_ps((float*)dotProductVector,dotProdVal); // Store the results back into the dot product vector 00463 00464 dotProduct += ( dotProductVector[0] + dotProductVector[1] ); 00465 00466 if(((num_bytes >> 3) & 1) != 0) { 00467 dotProduct += (*a) * (*b); 00468 } 00469 00470 *result = dotProduct; 00471 } 00472 00473 #endif /*LV_HAVE_SSE3*/ 00474 00475 #ifdef LV_HAVE_SSE4_1 00476 00477 #include <smmintrin.h> 00478 00479 static inline void volk_32fc_x2_dot_prod_32fc_a_sse4_1(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) { 00480 00481 const unsigned int num_bytes = num_points*8; 00482 00483 __m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, real0, real1, im0, im1; 00484 float *p_input, *p_taps; 00485 __m64 *p_result; 00486 00487 p_result = (__m64*)result; 00488 p_input = (float*)input; 00489 p_taps = (float*)taps; 00490 00491 static const __m128i neg = {0x000000000000000080000000}; 00492 00493 int i = 0; 00494 00495 int bound = (num_bytes >> 5); 00496 int leftovers = (num_bytes & 24) >> 3; 00497 00498 real0 = _mm_sub_ps(real0, real0); 00499 real1 = _mm_sub_ps(real1, real1); 00500 im0 = _mm_sub_ps(im0, im0); 00501 im1 = _mm_sub_ps(im1, im1); 00502 00503 for(; i < bound; ++i) { 00504 00505 00506 xmm0 = _mm_load_ps(p_input); 00507 xmm1 = _mm_load_ps(p_taps); 00508 00509 p_input += 4; 00510 p_taps += 4; 00511 00512 xmm2 = _mm_load_ps(p_input); 00513 xmm3 = _mm_load_ps(p_taps); 00514 00515 p_input += 4; 00516 p_taps += 4; 00517 00518 xmm4 = _mm_unpackhi_ps(xmm0, xmm2); 00519 xmm5 = _mm_unpackhi_ps(xmm1, xmm3); 00520 xmm0 = _mm_unpacklo_ps(xmm0, xmm2); 00521 xmm2 = _mm_unpacklo_ps(xmm1, xmm3); 00522 00523 //imaginary vector from input 00524 xmm1 = _mm_unpackhi_ps(xmm0, xmm4); 00525 //real vector from input 00526 xmm3 = _mm_unpacklo_ps(xmm0, xmm4); 00527 //imaginary vector from taps 00528 xmm0 = _mm_unpackhi_ps(xmm2, xmm5); 00529 //real vector from taps 00530 xmm2 = _mm_unpacklo_ps(xmm2, xmm5); 00531 00532 xmm4 = _mm_dp_ps(xmm3, xmm2, 0xf1); 00533 xmm5 = _mm_dp_ps(xmm1, xmm0, 0xf1); 00534 00535 xmm6 = _mm_dp_ps(xmm3, xmm0, 0xf2); 00536 xmm7 = _mm_dp_ps(xmm1, xmm2, 0xf2); 00537 00538 real0 = _mm_add_ps(xmm4, real0); 00539 real1 = _mm_add_ps(xmm5, real1); 00540 im0 = _mm_add_ps(xmm6, im0); 00541 im1 = _mm_add_ps(xmm7, im1); 00542 00543 } 00544 00545 real1 = _mm_xor_ps(real1, bit128_p(&neg)->float_vec); 00546 00547 im0 = _mm_add_ps(im0, im1); 00548 real0 = _mm_add_ps(real0, real1); 00549 00550 im0 = _mm_add_ps(im0, real0); 00551 00552 _mm_storel_pi(p_result, im0); 00553 00554 for(i = bound * 4; i < (bound * 4) + leftovers; ++i) { 00555 00556 *result += input[i] * taps[i]; 00557 } 00558 } 00559 00560 #endif /*LV_HAVE_SSE4_1*/ 00561 00562 #endif /*INCLUDED_volk_32fc_x2_dot_prod_32fc_a_H*/