63 #ifndef INCLUDED_volk_32fc_index_max_16u_a_H
64 #define INCLUDED_volk_32fc_index_max_16u_a_H
73 #include <immintrin.h>
76 static inline void volk_32fc_index_max_16u_a_avx2_variant_0(uint16_t* target,
80 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
82 const __m256i indices_increment = _mm256_set1_epi32(8);
88 __m256i current_indices = _mm256_set_epi32(7, 6, 3, 2, 5, 4, 1, 0);
90 __m256 max_values = _mm256_setzero_ps();
91 __m256i max_indices = _mm256_setzero_si256();
93 for (
unsigned i = 0;
i < num_points / 8u; ++
i) {
94 __m256 in0 = _mm256_load_ps((
float*)src0);
95 __m256 in1 = _mm256_load_ps((
float*)(src0 + 4));
97 in0, in1, &max_values, &max_indices, ¤t_indices, indices_increment);
104 _mm256_store_ps(max_values_buffer, max_values);
105 _mm256_store_si256((__m256i*)max_indices_buffer, max_indices);
109 for (
unsigned i = 0;
i < 8;
i++) {
110 if (max_values_buffer[
i] > max) {
111 max = max_values_buffer[
i];
112 index = max_indices_buffer[
i];
117 for (
unsigned i = num_points & (~7u);
i < num_points; ++
i) {
118 const float abs_squared =
120 if (abs_squared > max) {
133 #include <immintrin.h>
136 static inline void volk_32fc_index_max_16u_a_avx2_variant_1(uint16_t* target,
140 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
142 const __m256i indices_increment = _mm256_set1_epi32(8);
148 __m256i current_indices = _mm256_set_epi32(7, 6, 3, 2, 5, 4, 1, 0);
150 __m256 max_values = _mm256_setzero_ps();
151 __m256i max_indices = _mm256_setzero_si256();
153 for (
unsigned i = 0;
i < num_points / 8u; ++
i) {
154 __m256 in0 = _mm256_load_ps((
float*)src0);
155 __m256 in1 = _mm256_load_ps((
float*)(src0 + 4));
157 in0, in1, &max_values, &max_indices, ¤t_indices, indices_increment);
164 _mm256_store_ps(max_values_buffer, max_values);
165 _mm256_store_si256((__m256i*)max_indices_buffer, max_indices);
169 for (
unsigned i = 0;
i < 8;
i++) {
170 if (max_values_buffer[
i] > max) {
171 max = max_values_buffer[
i];
172 index = max_indices_buffer[
i];
177 for (
unsigned i = num_points & (~7u);
i < num_points; ++
i) {
178 const float abs_squared =
180 if (abs_squared > max) {
193 #include <pmmintrin.h>
194 #include <xmmintrin.h>
199 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
200 const uint32_t num_bytes = num_points * 8;
208 __m128i xmm8, xmm11, xmm12, xmm9, xmm10;
215 int bound = num_bytes >> 5;
223 for (;
i < bound; ++
i) {
247 if (num_bytes >> 4 & 1) {
274 if (num_bytes >> 3 & 1) {
298 target[0] = holderi.
i[0];
299 sq_dist = holderf.
f[0];
300 target[0] = (holderf.
f[1] > sq_dist) ? holderi.
i[1] : target[0];
301 sq_dist = (holderf.
f[1] > sq_dist) ? holderf.
f[1] : sq_dist;
302 target[0] = (holderf.
f[2] > sq_dist) ? holderi.
i[2] : target[0];
303 sq_dist = (holderf.
f[2] > sq_dist) ? holderf.
f[2] : sq_dist;
304 target[0] = (holderf.
f[3] > sq_dist) ? holderi.
i[3] : target[0];
305 sq_dist = (holderf.
f[3] > sq_dist) ? holderf.
f[3] : sq_dist;
310 #ifdef LV_HAVE_GENERIC
314 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
316 const uint32_t num_bytes = num_points * 8;
324 for (; i<num_bytes>> 3; ++
i) {
340 #ifndef INCLUDED_volk_32fc_index_max_16u_u_H
341 #define INCLUDED_volk_32fc_index_max_16u_u_H
343 #include <inttypes.h>
350 #include <immintrin.h>
353 static inline void volk_32fc_index_max_16u_u_avx2_variant_0(uint16_t* target,
357 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
359 const __m256i indices_increment = _mm256_set1_epi32(8);
365 __m256i current_indices = _mm256_set_epi32(7, 6, 3, 2, 5, 4, 1, 0);
367 __m256 max_values = _mm256_setzero_ps();
368 __m256i max_indices = _mm256_setzero_si256();
370 for (
unsigned i = 0;
i < num_points / 8u; ++
i) {
371 __m256 in0 = _mm256_loadu_ps((
float*)src0);
372 __m256 in1 = _mm256_loadu_ps((
float*)(src0 + 4));
374 in0, in1, &max_values, &max_indices, ¤t_indices, indices_increment);
381 _mm256_store_ps(max_values_buffer, max_values);
382 _mm256_store_si256((__m256i*)max_indices_buffer, max_indices);
386 for (
unsigned i = 0;
i < 8;
i++) {
387 if (max_values_buffer[
i] > max) {
388 max = max_values_buffer[
i];
389 index = max_indices_buffer[
i];
394 for (
unsigned i = num_points & (~7u);
i < num_points; ++
i) {
395 const float abs_squared =
397 if (abs_squared > max) {
410 #include <immintrin.h>
413 static inline void volk_32fc_index_max_16u_u_avx2_variant_1(uint16_t* target,
417 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
419 const __m256i indices_increment = _mm256_set1_epi32(8);
425 __m256i current_indices = _mm256_set_epi32(7, 6, 3, 2, 5, 4, 1, 0);
427 __m256 max_values = _mm256_setzero_ps();
428 __m256i max_indices = _mm256_setzero_si256();
430 for (
unsigned i = 0;
i < num_points / 8u; ++
i) {
431 __m256 in0 = _mm256_loadu_ps((
float*)src0);
432 __m256 in1 = _mm256_loadu_ps((
float*)(src0 + 4));
434 in0, in1, &max_values, &max_indices, ¤t_indices, indices_increment);
441 _mm256_store_ps(max_values_buffer, max_values);
442 _mm256_store_si256((__m256i*)max_indices_buffer, max_indices);
446 for (
unsigned i = 0;
i < 8;
i++) {
447 if (max_values_buffer[
i] > max) {
448 max = max_values_buffer[
i];
449 index = max_indices_buffer[
i];
454 for (
unsigned i = num_points & (~7u);
i < num_points; ++
i) {
455 const float abs_squared =
457 if (abs_squared > max) {
FORCE_INLINE void _mm_store_si128(__m128i *p, __m128i a)
Definition: sse2neon.h:5937
float32x4_t __m128
Definition: sse2neon.h:235
FORCE_INLINE __m128 _mm_hadd_ps(__m128 a, __m128 b)
Definition: sse2neon.h:6527
FORCE_INLINE __m128i _mm_add_epi32(__m128i a, __m128i b)
Definition: sse2neon.h:2984
FORCE_INLINE __m128i _mm_setzero_si128()
Definition: sse2neon.h:5339
FORCE_INLINE __m128i _mm_and_si128(__m128i, __m128i)
Definition: sse2neon.h:3128
FORCE_INLINE __m128i _mm_setr_epi32(int i3, int i2, int i1, int i0)
Definition: sse2neon.h:5278
FORCE_INLINE __m128 _mm_mul_ps(__m128 a, __m128 b)
Definition: sse2neon.h:2205
FORCE_INLINE __m128 _mm_max_ss(__m128 a, __m128 b)
Definition: sse2neon.h:2055
FORCE_INLINE __m128 _mm_movelh_ps(__m128 __A, __m128 __B)
Definition: sse2neon.h:2145
FORCE_INLINE __m128 _mm_setzero_ps(void)
Definition: sse2neon.h:2531
FORCE_INLINE __m128 _mm_cmpeq_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1118
FORCE_INLINE __m128 _mm_cmplt_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1190
FORCE_INLINE __m128 _mm_load1_ps(const float *p)
Definition: sse2neon.h:1885
FORCE_INLINE __m128 _mm_load_ps(const float *p)
Definition: sse2neon.h:1858
int64x2_t __m128i
Definition: sse2neon.h:244
FORCE_INLINE void _mm_store_ps(float *p, __m128 a)
Definition: sse2neon.h:2704
#define _mm_shuffle_epi32(a, imm)
Definition: sse2neon.h:5358
FORCE_INLINE __m128 _mm_max_ps(__m128 a, __m128 b)
Definition: sse2neon.h:2025
Definition: volk_common.h:120
float f[4]
Definition: volk_common.h:124
__m128i int_vec
Definition: volk_common.h:132
uint32_t i[4]
Definition: volk_common.h:123
__m128 float_vec
Definition: volk_common.h:128
static void volk_32fc_index_max_16u_a_sse3(uint16_t *target, lv_32fc_t *src0, uint32_t num_points)
Definition: volk_32fc_index_max_16u.h:197
static void volk_32fc_index_max_16u_generic(uint16_t *target, lv_32fc_t *src0, uint32_t num_points)
Definition: volk_32fc_index_max_16u.h:312
static void vector_32fc_index_max_variant1(__m256 in0, __m256 in1, __m256 *max_values, __m256i *max_indices, __m256i *current_indices, __m256i indices_increment)
Definition: volk_avx2_intrinsics.h:188
static void vector_32fc_index_max_variant0(__m256 in0, __m256 in1, __m256 *max_values, __m256i *max_indices, __m256i *current_indices, __m256i indices_increment)
Definition: volk_avx2_intrinsics.h:126
#define bit128_p(x)
Definition: volk_common.h:151
#define __VOLK_ATTR_ALIGNED(x)
Definition: volk_common.h:65
#define lv_cimag(x)
Definition: volk_complex.h:98
#define lv_creal(x)
Definition: volk_complex.h:96
float complex lv_32fc_t
Definition: volk_complex.h:74
for i
Definition: volk_config_fixed.tmpl.h:13