44 #ifndef INCLUDED_volk_8ic_x2_s32f_multiply_conjugate_32fc_a_H
45 #define INCLUDED_volk_8ic_x2_s32f_multiply_conjugate_32fc_a_H
52 #include <immintrin.h>
55 volk_8ic_x2_s32f_multiply_conjugate_32fc_a_avx2(
lv_32fc_t* cVector,
59 unsigned int num_points)
61 unsigned int number = 0;
62 const unsigned int oneEigthPoints = num_points / 8;
64 __m256i x, y, realz, imagz;
65 __m256 ret, retlo, rethi;
69 __m256i conjugateSign =
70 _mm256_set_epi16(-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1);
72 __m256 invScalar = _mm256_set1_ps(1.0 / scalar);
74 for (; number < oneEigthPoints; number++) {
80 realz = _mm256_madd_epi16(x, y);
83 y = _mm256_sign_epi16(y, conjugateSign);
86 y = _mm256_shufflehi_epi16(_mm256_shufflelo_epi16(y,
_MM_SHUFFLE(2, 3, 0, 1)),
90 imagz = _mm256_madd_epi16(x, y);
93 retlo = _mm256_cvtepi32_ps(_mm256_unpacklo_epi32(realz, imagz));
96 retlo = _mm256_mul_ps(retlo, invScalar);
99 rethi = _mm256_cvtepi32_ps(_mm256_unpackhi_epi32(realz, imagz));
102 rethi = _mm256_mul_ps(rethi, invScalar);
104 ret = _mm256_permute2f128_ps(retlo, rethi, 0b00100000);
105 _mm256_store_ps((
float*)c, ret);
108 ret = _mm256_permute2f128_ps(retlo, rethi, 0b00110001);
109 _mm256_store_ps((
float*)c, ret);
116 number = oneEigthPoints * 8;
117 float* cFloatPtr = (
float*)&cVector[number];
118 int8_t* a8Ptr = (int8_t*)&aVector[number];
119 int8_t* b8Ptr = (int8_t*)&bVector[number];
120 for (; number < num_points; number++) {
121 float aReal = (float)*a8Ptr++;
122 float aImag = (float)*a8Ptr++;
124 float bReal = (float)*b8Ptr++;
125 float bImag = (float)*b8Ptr++;
129 *cFloatPtr++ =
lv_creal(temp) / scalar;
130 *cFloatPtr++ =
lv_cimag(temp) / scalar;
136 #ifdef LV_HAVE_SSE4_1
137 #include <smmintrin.h>
140 volk_8ic_x2_s32f_multiply_conjugate_32fc_a_sse4_1(
lv_32fc_t* cVector,
144 unsigned int num_points)
146 unsigned int number = 0;
147 const unsigned int quarterPoints = num_points / 4;
158 for (; number < quarterPoints; number++) {
200 number = quarterPoints * 4;
201 float* cFloatPtr = (
float*)&cVector[number];
202 int8_t* a8Ptr = (int8_t*)&aVector[number];
203 int8_t* b8Ptr = (int8_t*)&bVector[number];
204 for (; number < num_points; number++) {
205 float aReal = (float)*a8Ptr++;
206 float aImag = (float)*a8Ptr++;
208 float bReal = (float)*b8Ptr++;
209 float bImag = (float)*b8Ptr++;
213 *cFloatPtr++ =
lv_creal(temp) / scalar;
214 *cFloatPtr++ =
lv_cimag(temp) / scalar;
220 #ifdef LV_HAVE_GENERIC
227 unsigned int num_points)
229 unsigned int number = 0;
230 float* cPtr = (
float*)cVector;
231 const float invScalar = 1.0 / scalar;
232 int8_t* a8Ptr = (int8_t*)aVector;
233 int8_t* b8Ptr = (int8_t*)bVector;
234 for (number = 0; number < num_points; number++) {
235 float aReal = (float)*a8Ptr++;
236 float aImag = (float)*a8Ptr++;
238 float bReal = (float)*b8Ptr++;
239 float bImag = (float)*b8Ptr++;
243 *cPtr++ = (
lv_creal(temp) * invScalar);
244 *cPtr++ = (
lv_cimag(temp) * invScalar);
252 #ifndef INCLUDED_volk_8ic_x2_s32f_multiply_conjugate_32fc_u_H
253 #define INCLUDED_volk_8ic_x2_s32f_multiply_conjugate_32fc_u_H
255 #include <inttypes.h>
260 #include <immintrin.h>
263 volk_8ic_x2_s32f_multiply_conjugate_32fc_u_avx2(
lv_32fc_t* cVector,
267 unsigned int num_points)
269 unsigned int number = 0;
270 const unsigned int oneEigthPoints = num_points / 8;
272 __m256i x, y, realz, imagz;
273 __m256 ret, retlo, rethi;
277 __m256i conjugateSign =
278 _mm256_set_epi16(-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1);
280 __m256 invScalar = _mm256_set1_ps(1.0 / scalar);
282 for (; number < oneEigthPoints; number++) {
288 realz = _mm256_madd_epi16(x, y);
291 y = _mm256_sign_epi16(y, conjugateSign);
294 y = _mm256_shufflehi_epi16(_mm256_shufflelo_epi16(y,
_MM_SHUFFLE(2, 3, 0, 1)),
298 imagz = _mm256_madd_epi16(x, y);
301 retlo = _mm256_cvtepi32_ps(_mm256_unpacklo_epi32(realz, imagz));
304 retlo = _mm256_mul_ps(retlo, invScalar);
307 rethi = _mm256_cvtepi32_ps(_mm256_unpackhi_epi32(realz, imagz));
310 rethi = _mm256_mul_ps(rethi, invScalar);
312 ret = _mm256_permute2f128_ps(retlo, rethi, 0b00100000);
313 _mm256_storeu_ps((
float*)c, ret);
316 ret = _mm256_permute2f128_ps(retlo, rethi, 0b00110001);
317 _mm256_storeu_ps((
float*)c, ret);
324 number = oneEigthPoints * 8;
325 float* cFloatPtr = (
float*)&cVector[number];
326 int8_t* a8Ptr = (int8_t*)&aVector[number];
327 int8_t* b8Ptr = (int8_t*)&bVector[number];
328 for (; number < num_points; number++) {
329 float aReal = (float)*a8Ptr++;
330 float aImag = (float)*a8Ptr++;
332 float bReal = (float)*b8Ptr++;
333 float bImag = (float)*b8Ptr++;
337 *cFloatPtr++ =
lv_creal(temp) / scalar;
338 *cFloatPtr++ =
lv_cimag(temp) / scalar;
float32x4_t __m128
Definition: sse2neon.h:235
FORCE_INLINE __m128i _mm_unpacklo_epi32(__m128i a, __m128i b)
Definition: sse2neon.h:6373
FORCE_INLINE __m128i _mm_unpackhi_epi32(__m128i a, __m128i b)
Definition: sse2neon.h:6263
FORCE_INLINE __m128i _mm_loadu_si128(const __m128i *p)
Definition: sse2neon.h:4570
FORCE_INLINE __m128i _mm_madd_epi16(__m128i a, __m128i b)
Definition: sse2neon.h:4595
FORCE_INLINE __m128 _mm_mul_ps(__m128 a, __m128 b)
Definition: sse2neon.h:2205
FORCE_INLINE __m128 _mm_set_ps1(float)
Definition: sse2neon.h:2437
FORCE_INLINE __m128i _mm_load_si128(const __m128i *p)
Definition: sse2neon.h:4471
#define _mm_shufflelo_epi16(a, imm)
Definition: sse2neon.h:5459
FORCE_INLINE __m128i _mm_loadl_epi64(__m128i const *p)
Definition: sse2neon.h:4513
FORCE_INLINE __m128i _mm_cvtepi8_epi16(__m128i a)
Definition: sse2neon.h:7565
FORCE_INLINE __m128i _mm_set_epi16(short i7, short i6, short i5, short i4, short i3, short i2, short i1, short i0)
Definition: sse2neon.h:5100
#define _mm_shufflehi_epi16(a, imm)
Definition: sse2neon.h:5444
FORCE_INLINE __m128i _mm_sign_epi16(__m128i _a, __m128i _b)
Definition: sse2neon.h:7132
#define _MM_SHUFFLE(fp3, fp2, fp1, fp0)
Definition: sse2neon.h:195
int64x2_t __m128i
Definition: sse2neon.h:244
FORCE_INLINE void _mm_store_ps(float *p, __m128 a)
Definition: sse2neon.h:2704
FORCE_INLINE __m128 _mm_cvtepi32_ps(__m128i a)
Definition: sse2neon.h:3937
static void volk_8ic_x2_s32f_multiply_conjugate_32fc_generic(lv_32fc_t *cVector, const lv_8sc_t *aVector, const lv_8sc_t *bVector, const float scalar, unsigned int num_points)
Definition: volk_8ic_x2_s32f_multiply_conjugate_32fc.h:223
#define lv_cimag(x)
Definition: volk_complex.h:98
#define lv_cmake(r, i)
Definition: volk_complex.h:77
char complex lv_8sc_t
Provide typedefs and operators for all complex types in C and C++.
Definition: volk_complex.h:70
#define lv_creal(x)
Definition: volk_complex.h:96
float complex lv_32fc_t
Definition: volk_complex.h:74