58 #ifndef INCLUDED_volk_32f_index_max_16u_a_H
59 #define INCLUDED_volk_32f_index_max_16u_a_H
67 #include <immintrin.h>
72 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
75 const uint32_t eighthPoints = num_points / 8;
77 float* inputPtr = (
float*)src0;
79 __m256 indexIncrementValues = _mm256_set1_ps(8);
80 __m256 currentIndexes = _mm256_set_ps(-1, -2, -3, -4, -5, -6, -7, -8);
84 __m256 maxValues = _mm256_set1_ps(max);
85 __m256 maxValuesIndex = _mm256_setzero_ps();
86 __m256 compareResults;
92 for (; number < eighthPoints; number++) {
94 currentValues = _mm256_load_ps(inputPtr);
96 currentIndexes = _mm256_add_ps(currentIndexes, indexIncrementValues);
98 compareResults = _mm256_cmp_ps(currentValues, maxValues, _CMP_GT_OS);
100 maxValuesIndex = _mm256_blendv_ps(maxValuesIndex, currentIndexes, compareResults);
101 maxValues = _mm256_blendv_ps(maxValues, currentValues, compareResults);
105 _mm256_store_ps(maxValuesBuffer, maxValues);
106 _mm256_store_ps(maxIndexesBuffer, maxValuesIndex);
108 for (number = 0; number < 8; number++) {
109 if (maxValuesBuffer[number] > max) {
110 index = maxIndexesBuffer[number];
111 max = maxValuesBuffer[number];
112 }
else if (maxValuesBuffer[number] == max) {
113 if (index > maxIndexesBuffer[number])
114 index = maxIndexesBuffer[number];
118 number = eighthPoints * 8;
119 for (; number < num_points; number++) {
120 if (src0[number] > max) {
125 target[0] = (uint16_t)index;
130 #ifdef LV_HAVE_SSE4_1
131 #include <smmintrin.h>
134 volk_32f_index_max_16u_a_sse4_1(uint16_t* target,
const float* src0, uint32_t num_points)
136 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
139 const uint32_t quarterPoints = num_points / 4;
141 float* inputPtr = (
float*)src0;
156 for (; number < quarterPoints; number++) {
160 currentIndexes =
_mm_add_ps(currentIndexes, indexIncrementValues);
162 compareResults =
_mm_cmpgt_ps(currentValues, maxValues);
164 maxValuesIndex =
_mm_blendv_ps(maxValuesIndex, currentIndexes, compareResults);
165 maxValues =
_mm_blendv_ps(maxValues, currentValues, compareResults);
172 for (number = 0; number < 4; number++) {
173 if (maxValuesBuffer[number] > max) {
174 index = maxIndexesBuffer[number];
175 max = maxValuesBuffer[number];
176 }
else if (maxValuesBuffer[number] == max) {
177 if (index > maxIndexesBuffer[number])
178 index = maxIndexesBuffer[number];
182 number = quarterPoints * 4;
183 for (; number < num_points; number++) {
184 if (src0[number] > max) {
189 target[0] = (uint16_t)index;
197 #include <xmmintrin.h>
202 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
205 const uint32_t quarterPoints = num_points / 4;
207 float* inputPtr = (
float*)src0;
222 for (; number < quarterPoints; number++) {
226 currentIndexes =
_mm_add_ps(currentIndexes, indexIncrementValues);
228 compareResults =
_mm_cmpgt_ps(currentValues, maxValues);
240 for (number = 0; number < 4; number++) {
241 if (maxValuesBuffer[number] > max) {
242 index = maxIndexesBuffer[number];
243 max = maxValuesBuffer[number];
244 }
else if (maxValuesBuffer[number] == max) {
245 if (index > maxIndexesBuffer[number])
246 index = maxIndexesBuffer[number];
250 number = quarterPoints * 4;
251 for (; number < num_points; number++) {
252 if (src0[number] > max) {
257 target[0] = (uint16_t)index;
263 #ifdef LV_HAVE_GENERIC
268 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
275 for (;
i < num_points; ++
i) {
290 #ifndef INCLUDED_volk_32f_index_max_16u_u_H
291 #define INCLUDED_volk_32f_index_max_16u_u_H
293 #include <inttypes.h>
299 #include <immintrin.h>
304 num_points = (num_points > USHRT_MAX) ? USHRT_MAX : num_points;
307 const uint32_t eighthPoints = num_points / 8;
309 float* inputPtr = (
float*)src0;
311 __m256 indexIncrementValues = _mm256_set1_ps(8);
312 __m256 currentIndexes = _mm256_set_ps(-1, -2, -3, -4, -5, -6, -7, -8);
316 __m256 maxValues = _mm256_set1_ps(max);
317 __m256 maxValuesIndex = _mm256_setzero_ps();
318 __m256 compareResults;
319 __m256 currentValues;
324 for (; number < eighthPoints; number++) {
326 currentValues = _mm256_loadu_ps(inputPtr);
328 currentIndexes = _mm256_add_ps(currentIndexes, indexIncrementValues);
330 compareResults = _mm256_cmp_ps(currentValues, maxValues, _CMP_GT_OS);
332 maxValuesIndex = _mm256_blendv_ps(maxValuesIndex, currentIndexes, compareResults);
333 maxValues = _mm256_blendv_ps(maxValues, currentValues, compareResults);
337 _mm256_storeu_ps(maxValuesBuffer, maxValues);
338 _mm256_storeu_ps(maxIndexesBuffer, maxValuesIndex);
340 for (number = 0; number < 8; number++) {
341 if (maxValuesBuffer[number] > max) {
342 index = maxIndexesBuffer[number];
343 max = maxValuesBuffer[number];
344 }
else if (maxValuesBuffer[number] == max) {
345 if (index > maxIndexesBuffer[number])
346 index = maxIndexesBuffer[number];
350 number = eighthPoints * 8;
351 for (; number < num_points; number++) {
352 if (src0[number] > max) {
357 target[0] = (uint16_t)index;
float32x4_t __m128
Definition: sse2neon.h:235
FORCE_INLINE __m128 _mm_set_ps(float w, float z, float y, float x)
Definition: sse2neon.h:2429
FORCE_INLINE __m128 _mm_set1_ps(float _w)
Definition: sse2neon.h:2503
FORCE_INLINE __m128 _mm_cmpgt_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1154
FORCE_INLINE __m128 _mm_andnot_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1079
FORCE_INLINE __m128 _mm_setzero_ps(void)
Definition: sse2neon.h:2531
FORCE_INLINE __m128 _mm_and_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1064
FORCE_INLINE __m128 _mm_blendv_ps(__m128 _a, __m128 _b, __m128 _mask)
Definition: sse2neon.h:7458
FORCE_INLINE __m128 _mm_add_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1039
FORCE_INLINE __m128 _mm_load_ps(const float *p)
Definition: sse2neon.h:1858
FORCE_INLINE void _mm_store_ps(float *p, __m128 a)
Definition: sse2neon.h:2704
FORCE_INLINE __m128 _mm_or_ps(__m128, __m128)
Definition: sse2neon.h:2237
static void volk_32f_index_max_16u_u_avx(uint16_t *target, const float *src0, uint32_t num_points)
Definition: volk_32f_index_max_16u.h:302
static void volk_32f_index_max_16u_a_avx(uint16_t *target, const float *src0, uint32_t num_points)
Definition: volk_32f_index_max_16u.h:70
static void volk_32f_index_max_16u_generic(uint16_t *target, const float *src0, uint32_t num_points)
Definition: volk_32f_index_max_16u.h:266
static void volk_32f_index_max_16u_a_sse(uint16_t *target, const float *src0, uint32_t num_points)
Definition: volk_32f_index_max_16u.h:200
#define __VOLK_ATTR_ALIGNED(x)
Definition: volk_common.h:65
for i
Definition: volk_config_fixed.tmpl.h:13