58#ifndef INCLUDED_volk_32fc_magnitude_squared_32f_u_H
59#define INCLUDED_volk_32fc_magnitude_squared_32f_u_H
71 unsigned int num_points)
73 unsigned int number = 0;
74 const unsigned int eighthPoints = num_points / 8;
76 const float* complexVectorPtr = (
float*)complexVector;
77 float* magnitudeVectorPtr = magnitudeVector;
79 __m256 cplxValue1, cplxValue2, result;
81 for (; number < eighthPoints; number++) {
82 cplxValue1 = _mm256_loadu_ps(complexVectorPtr);
83 cplxValue2 = _mm256_loadu_ps(complexVectorPtr + 8);
85 _mm256_storeu_ps(magnitudeVectorPtr, result);
87 complexVectorPtr += 16;
88 magnitudeVectorPtr += 8;
91 number = eighthPoints * 8;
92 for (; number < num_points; number++) {
93 float val1Real = *complexVectorPtr++;
94 float val1Imag = *complexVectorPtr++;
95 *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
102#include <pmmintrin.h>
107 unsigned int num_points)
109 unsigned int number = 0;
110 const unsigned int quarterPoints = num_points / 4;
112 const float* complexVectorPtr = (
float*)complexVector;
113 float* magnitudeVectorPtr = magnitudeVector;
115 __m128 cplxValue1, cplxValue2, result;
116 for (; number < quarterPoints; number++) {
118 complexVectorPtr += 4;
121 complexVectorPtr += 4;
125 magnitudeVectorPtr += 4;
128 number = quarterPoints * 4;
129 for (; number < num_points; number++) {
130 float val1Real = *complexVectorPtr++;
131 float val1Imag = *complexVectorPtr++;
132 *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
140#include <xmmintrin.h>
144 unsigned int num_points)
146 unsigned int number = 0;
147 const unsigned int quarterPoints = num_points / 4;
149 const float* complexVectorPtr = (
float*)complexVector;
150 float* magnitudeVectorPtr = magnitudeVector;
152 __m128 cplxValue1, cplxValue2, result;
154 for (; number < quarterPoints; number++) {
156 complexVectorPtr += 4;
159 complexVectorPtr += 4;
163 magnitudeVectorPtr += 4;
166 number = quarterPoints * 4;
167 for (; number < num_points; number++) {
168 float val1Real = *complexVectorPtr++;
169 float val1Imag = *complexVectorPtr++;
170 *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
176#ifdef LV_HAVE_GENERIC
180 unsigned int num_points)
182 const float* complexVectorPtr = (
float*)complexVector;
183 float* magnitudeVectorPtr = magnitudeVector;
184 unsigned int number = 0;
185 for (number = 0; number < num_points; number++) {
186 const float real = *complexVectorPtr++;
187 const float imag = *complexVectorPtr++;
188 *magnitudeVectorPtr++ = (real * real) + (imag * imag);
195#ifndef INCLUDED_volk_32fc_magnitude_squared_32f_a_H
196#define INCLUDED_volk_32fc_magnitude_squared_32f_a_H
203#include <immintrin.h>
208 unsigned int num_points)
210 unsigned int number = 0;
211 const unsigned int eighthPoints = num_points / 8;
213 const float* complexVectorPtr = (
float*)complexVector;
214 float* magnitudeVectorPtr = magnitudeVector;
216 __m256 cplxValue1, cplxValue2, result;
217 for (; number < eighthPoints; number++) {
218 cplxValue1 = _mm256_load_ps(complexVectorPtr);
219 complexVectorPtr += 8;
221 cplxValue2 = _mm256_load_ps(complexVectorPtr);
222 complexVectorPtr += 8;
225 _mm256_store_ps(magnitudeVectorPtr, result);
226 magnitudeVectorPtr += 8;
229 number = eighthPoints * 8;
230 for (; number < num_points; number++) {
231 float val1Real = *complexVectorPtr++;
232 float val1Imag = *complexVectorPtr++;
233 *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
240#include <pmmintrin.h>
245 unsigned int num_points)
247 unsigned int number = 0;
248 const unsigned int quarterPoints = num_points / 4;
250 const float* complexVectorPtr = (
float*)complexVector;
251 float* magnitudeVectorPtr = magnitudeVector;
253 __m128 cplxValue1, cplxValue2, result;
254 for (; number < quarterPoints; number++) {
256 complexVectorPtr += 4;
259 complexVectorPtr += 4;
263 magnitudeVectorPtr += 4;
266 number = quarterPoints * 4;
267 for (; number < num_points; number++) {
268 float val1Real = *complexVectorPtr++;
269 float val1Imag = *complexVectorPtr++;
270 *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
278#include <xmmintrin.h>
282 unsigned int num_points)
284 unsigned int number = 0;
285 const unsigned int quarterPoints = num_points / 4;
287 const float* complexVectorPtr = (
float*)complexVector;
288 float* magnitudeVectorPtr = magnitudeVector;
290 __m128 cplxValue1, cplxValue2, result;
291 for (; number < quarterPoints; number++) {
293 complexVectorPtr += 4;
296 complexVectorPtr += 4;
300 magnitudeVectorPtr += 4;
303 number = quarterPoints * 4;
304 for (; number < num_points; number++) {
305 float val1Real = *complexVectorPtr++;
306 float val1Imag = *complexVectorPtr++;
307 *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
318 unsigned int num_points)
320 unsigned int number = 0;
321 const unsigned int quarterPoints = num_points / 4;
323 const float* complexVectorPtr = (
float*)complexVector;
324 float* magnitudeVectorPtr = magnitudeVector;
326 float32x4x2_t cmplx_val;
328 for (; number < quarterPoints; number++) {
329 cmplx_val = vld2q_f32(complexVectorPtr);
330 complexVectorPtr += 8;
333 vmulq_f32(cmplx_val.val[0], cmplx_val.val[0]);
335 vmulq_f32(cmplx_val.val[1], cmplx_val.val[1]);
338 vaddq_f32(cmplx_val.val[0], cmplx_val.val[1]);
340 vst1q_f32(magnitudeVectorPtr, result);
341 magnitudeVectorPtr += 4;
344 number = quarterPoints * 4;
345 for (; number < num_points; number++) {
346 float val1Real = *complexVectorPtr++;
347 float val1Imag = *complexVectorPtr++;
348 *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);