61 #ifndef INCLUDED_volk_32fc_32f_add_32fc_u_H
62 #define INCLUDED_volk_32fc_32f_add_32fc_u_H
64 #ifdef LV_HAVE_GENERIC
69 unsigned int num_points)
73 const float* bPtr = bVector;
74 unsigned int number = 0;
76 for (number = 0; number < num_points; number++) {
77 *cPtr++ = (*aPtr++) + (*bPtr++);
84 #include <immintrin.h>
89 unsigned int num_points)
91 unsigned int number = 0;
92 const unsigned int eighthPoints = num_points / 8;
96 const float* bPtr = bVector;
98 __m256 aVal1, aVal2, bVal, cVal1, cVal2;
99 __m256 cpx_b1, cpx_b2;
101 zero = _mm256_setzero_ps();
103 for (; number < eighthPoints; number++) {
105 aVal1 = _mm256_loadu_ps((
float*)aPtr);
106 aVal2 = _mm256_loadu_ps((
float*)(aPtr + 4));
107 bVal = _mm256_loadu_ps(bPtr);
108 cpx_b1 = _mm256_unpacklo_ps(bVal, zero);
109 cpx_b2 = _mm256_unpackhi_ps(bVal, zero);
111 tmp1 = _mm256_permute2f128_ps(cpx_b1, cpx_b2, 0x0 + (0x2 << 4));
112 tmp2 = _mm256_permute2f128_ps(cpx_b1, cpx_b2, 0x1 + (0x3 << 4));
114 cVal1 = _mm256_add_ps(aVal1, tmp1);
115 cVal2 = _mm256_add_ps(aVal2, tmp2);
117 _mm256_storeu_ps((
float*)cPtr,
119 _mm256_storeu_ps((
float*)(cPtr + 4),
127 number = eighthPoints * 8;
128 for (; number < num_points; number++) {
129 *cPtr++ = (*aPtr++) + (*bPtr++);
135 #include <immintrin.h>
139 const float* bVector,
140 unsigned int num_points)
142 unsigned int number = 0;
143 const unsigned int eighthPoints = num_points / 8;
147 const float* bPtr = bVector;
149 __m256 aVal1, aVal2, bVal, cVal1, cVal2;
150 __m256 cpx_b1, cpx_b2;
152 zero = _mm256_setzero_ps();
154 for (; number < eighthPoints; number++) {
156 aVal1 = _mm256_load_ps((
float*)aPtr);
157 aVal2 = _mm256_load_ps((
float*)(aPtr + 4));
158 bVal = _mm256_load_ps(bPtr);
159 cpx_b1 = _mm256_unpacklo_ps(bVal, zero);
160 cpx_b2 = _mm256_unpackhi_ps(bVal, zero);
162 tmp1 = _mm256_permute2f128_ps(cpx_b1, cpx_b2, 0x0 + (0x2 << 4));
163 tmp2 = _mm256_permute2f128_ps(cpx_b1, cpx_b2, 0x1 + (0x3 << 4));
165 cVal1 = _mm256_add_ps(aVal1, tmp1);
166 cVal2 = _mm256_add_ps(aVal2, tmp2);
168 _mm256_store_ps((
float*)cPtr,
170 _mm256_store_ps((
float*)(cPtr + 4),
178 number = eighthPoints * 8;
179 for (; number < num_points; number++) {
180 *cPtr++ = (*aPtr++) + (*bPtr++);
186 #include <arm_neon.h>
190 const float* bVector,
191 unsigned int num_points)
195 const float* bPtr = bVector;
197 float32x4x4_t aVal0, aVal1;
198 float32x4x2_t bVal0, bVal1;
200 const unsigned int sixteenthPoints = num_points / 16;
201 unsigned int number = 0;
202 for (; number < sixteenthPoints; number++) {
203 aVal0 = vld4q_f32((
const float*)aPtr);
205 aVal1 = vld4q_f32((
const float*)aPtr);
209 bVal0 = vld2q_f32((
const float*)bPtr);
211 bVal1 = vld2q_f32((
const float*)bPtr);
215 aVal0.val[0] = vaddq_f32(aVal0.val[0], bVal0.val[0]);
216 aVal0.val[2] = vaddq_f32(aVal0.val[2], bVal0.val[1]);
218 aVal1.val[2] = vaddq_f32(aVal1.val[2], bVal1.val[1]);
219 aVal1.val[0] = vaddq_f32(aVal1.val[0], bVal1.val[0]);
221 vst4q_f32((
float*)(cPtr), aVal0);
223 vst4q_f32((
float*)(cPtr), aVal1);
227 for (number = sixteenthPoints * 16; number < num_points; number++) {
228 *cPtr++ = (*aPtr++) + (*bPtr++);
static void volk_32fc_32f_add_32fc_a_avx(lv_32fc_t *cVector, const lv_32fc_t *aVector, const float *bVector, unsigned int num_points)
Definition: volk_32fc_32f_add_32fc.h:137
static void volk_32fc_32f_add_32fc_generic(lv_32fc_t *cVector, const lv_32fc_t *aVector, const float *bVector, unsigned int num_points)
Definition: volk_32fc_32f_add_32fc.h:66
static void volk_32fc_32f_add_32fc_u_avx(lv_32fc_t *cVector, const lv_32fc_t *aVector, const float *bVector, unsigned int num_points)
Definition: volk_32fc_32f_add_32fc.h:86
static void volk_32fc_32f_add_32fc_neon(lv_32fc_t *cVector, const lv_32fc_t *aVector, const float *bVector, unsigned int num_points)
Definition: volk_32fc_32f_add_32fc.h:188
#define __VOLK_PREFETCH(addr)
Definition: volk_common.h:71
float complex lv_32fc_t
Definition: volk_complex.h:74