52 #ifndef INCLUDED_volk_32f_index_min_32u_a_H
53 #define INCLUDED_volk_32f_index_min_32u_a_H
60 #include <smmintrin.h>
62 static inline void volk_32f_index_min_32u_a_sse4_1(uint32_t* target,
66 const uint32_t quarterPoints = num_points / 4;
68 float* inputPtr = (
float*)source;
73 float min = source[0];
83 for (uint32_t number = 0; number < quarterPoints; number++) {
87 currentIndexes =
_mm_add_ps(currentIndexes, indexIncrementValues);
91 minValuesIndex =
_mm_blendv_ps(minValuesIndex, currentIndexes, compareResults);
92 minValues =
_mm_blendv_ps(minValues, currentValues, compareResults);
99 for (uint32_t number = 0; number < 4; number++) {
100 if (minValuesBuffer[number] < min) {
101 index = minIndexesBuffer[number];
102 min = minValuesBuffer[number];
103 }
else if (minValuesBuffer[number] == min) {
104 if (index > minIndexesBuffer[number])
105 index = minIndexesBuffer[number];
109 for (uint32_t number = quarterPoints * 4; number < num_points; number++) {
110 if (source[number] < min) {
112 min = source[number];
115 target[0] = (uint32_t)index;
123 #include <xmmintrin.h>
128 const uint32_t quarterPoints = num_points / 4;
130 float* inputPtr = (
float*)source;
135 float min = source[0];
145 for (uint32_t number = 0; number < quarterPoints; number++) {
149 currentIndexes =
_mm_add_ps(currentIndexes, indexIncrementValues);
151 compareResults =
_mm_cmplt_ps(currentValues, minValues);
164 for (uint32_t number = 0; number < 4; number++) {
165 if (minValuesBuffer[number] < min) {
166 index = minIndexesBuffer[number];
167 min = minValuesBuffer[number];
168 }
else if (minValuesBuffer[number] == min) {
169 if (index > minIndexesBuffer[number])
170 index = minIndexesBuffer[number];
174 for (uint32_t number = quarterPoints * 4; number < num_points; number++) {
175 if (source[number] < min) {
177 min = source[number];
180 target[0] = (uint32_t)index;
187 #include <immintrin.h>
192 const uint32_t quarterPoints = num_points / 8;
194 float* inputPtr = (
float*)source;
196 __m256 indexIncrementValues = _mm256_set1_ps(8);
197 __m256 currentIndexes = _mm256_set_ps(-1, -2, -3, -4, -5, -6, -7, -8);
199 float min = source[0];
201 __m256 minValues = _mm256_set1_ps(min);
202 __m256 minValuesIndex = _mm256_setzero_ps();
203 __m256 compareResults;
204 __m256 currentValues;
209 for (uint32_t number = 0; number < quarterPoints; number++) {
210 currentValues = _mm256_load_ps(inputPtr);
212 currentIndexes = _mm256_add_ps(currentIndexes, indexIncrementValues);
213 compareResults = _mm256_cmp_ps(currentValues, minValues, _CMP_LT_OS);
214 minValuesIndex = _mm256_blendv_ps(minValuesIndex, currentIndexes, compareResults);
215 minValues = _mm256_blendv_ps(minValues, currentValues, compareResults);
219 _mm256_store_ps(minValuesBuffer, minValues);
220 _mm256_store_ps(minIndexesBuffer, minValuesIndex);
222 for (uint32_t number = 0; number < 8; number++) {
223 if (minValuesBuffer[number] < min) {
224 index = minIndexesBuffer[number];
225 min = minValuesBuffer[number];
226 }
else if (minValuesBuffer[number] == min) {
227 if (index > minIndexesBuffer[number])
228 index = minIndexesBuffer[number];
232 for (uint32_t number = quarterPoints * 8; number < num_points; number++) {
233 if (source[number] < min) {
235 min = source[number];
238 target[0] = (uint32_t)index;
245 #include <arm_neon.h>
250 const uint32_t quarterPoints = num_points / 4;
252 float* inputPtr = (
float*)source;
253 float32x4_t indexIncrementValues = vdupq_n_f32(4);
255 float currentIndexes_float[4] = { -4.0f, -3.0f, -2.0f, -1.0f };
256 float32x4_t currentIndexes = vld1q_f32(currentIndexes_float);
258 float min = source[0];
260 float32x4_t minValues = vdupq_n_f32(min);
261 uint32x4_t minValuesIndex = vmovq_n_u32(0);
262 uint32x4_t compareResults;
263 uint32x4_t currentIndexes_u;
264 float32x4_t currentValues;
269 for (uint32_t number = 0; number < quarterPoints; number++) {
270 currentValues = vld1q_f32(inputPtr);
272 currentIndexes = vaddq_f32(currentIndexes, indexIncrementValues);
273 currentIndexes_u = vcvtq_u32_f32(currentIndexes);
274 compareResults = vcgeq_f32(currentValues, minValues);
275 minValuesIndex = vorrq_u32(vandq_u32(compareResults, minValuesIndex),
276 vbicq_u32(currentIndexes_u, compareResults));
277 minValues = vminq_f32(currentValues, minValues);
281 vst1q_f32(minValuesBuffer, minValues);
282 vst1q_f32(minIndexesBuffer, vcvtq_f32_u32(minValuesIndex));
283 for (uint32_t number = 0; number < 4; number++) {
284 if (minValuesBuffer[number] < min) {
285 index = minIndexesBuffer[number];
286 min = minValuesBuffer[number];
287 }
else if (minValues[number] == min) {
288 if (index > minIndexesBuffer[number])
289 index = minIndexesBuffer[number];
293 for (uint32_t number = quarterPoints * 4; number < num_points; number++) {
294 if (source[number] < min) {
296 min = source[number];
299 target[0] = (uint32_t)index;
305 #ifdef LV_HAVE_GENERIC
310 float min = source[0];
313 for (uint32_t
i = 1;
i < num_points; ++
i) {
314 if (source[
i] < min) {
328 #ifndef INCLUDED_volk_32f_index_min_32u_u_H
329 #define INCLUDED_volk_32f_index_min_32u_u_H
331 #include <inttypes.h>
337 #include <immintrin.h>
342 const uint32_t quarterPoints = num_points / 8;
344 float* inputPtr = (
float*)source;
346 __m256 indexIncrementValues = _mm256_set1_ps(8);
347 __m256 currentIndexes = _mm256_set_ps(-1, -2, -3, -4, -5, -6, -7, -8);
349 float min = source[0];
351 __m256 minValues = _mm256_set1_ps(min);
352 __m256 minValuesIndex = _mm256_setzero_ps();
353 __m256 compareResults;
354 __m256 currentValues;
359 for (uint32_t number = 0; number < quarterPoints; number++) {
360 currentValues = _mm256_loadu_ps(inputPtr);
362 currentIndexes = _mm256_add_ps(currentIndexes, indexIncrementValues);
363 compareResults = _mm256_cmp_ps(currentValues, minValues, _CMP_LT_OS);
364 minValuesIndex = _mm256_blendv_ps(minValuesIndex, currentIndexes, compareResults);
365 minValues = _mm256_blendv_ps(minValues, currentValues, compareResults);
369 _mm256_store_ps(minValuesBuffer, minValues);
370 _mm256_store_ps(minIndexesBuffer, minValuesIndex);
372 for (uint32_t number = 0; number < 8; number++) {
373 if (minValuesBuffer[number] < min) {
374 index = minIndexesBuffer[number];
375 min = minValuesBuffer[number];
376 }
else if (minValuesBuffer[number] == min) {
377 if (index > minIndexesBuffer[number])
378 index = minIndexesBuffer[number];
382 for (uint32_t number = quarterPoints * 8; number < num_points; number++) {
383 if (source[number] < min) {
385 min = source[number];
388 target[0] = (uint32_t)index;
394 #ifdef LV_HAVE_SSE4_1
395 #include <smmintrin.h>
397 static inline void volk_32f_index_min_32u_u_sse4_1(uint32_t* target,
401 const uint32_t quarterPoints = num_points / 4;
403 float* inputPtr = (
float*)source;
408 float min = source[0];
418 for (uint32_t number = 0; number < quarterPoints; number++) {
421 currentIndexes =
_mm_add_ps(currentIndexes, indexIncrementValues);
422 compareResults =
_mm_cmplt_ps(currentValues, minValues);
423 minValuesIndex =
_mm_blendv_ps(minValuesIndex, currentIndexes, compareResults);
424 minValues =
_mm_blendv_ps(minValues, currentValues, compareResults);
431 for (uint32_t number = 0; number < 4; number++) {
432 if (minValuesBuffer[number] < min) {
433 index = minIndexesBuffer[number];
434 min = minValuesBuffer[number];
435 }
else if (minValuesBuffer[number] == min) {
436 if (index > minIndexesBuffer[number])
437 index = minIndexesBuffer[number];
441 for (uint32_t number = quarterPoints * 4; number < num_points; number++) {
442 if (source[number] < min) {
444 min = source[number];
447 target[0] = (uint32_t)index;
453 #include <xmmintrin.h>
458 const uint32_t quarterPoints = num_points / 4;
460 float* inputPtr = (
float*)source;
465 float min = source[0];
475 for (uint32_t number = 0; number < quarterPoints; number++) {
478 currentIndexes =
_mm_add_ps(currentIndexes, indexIncrementValues);
479 compareResults =
_mm_cmplt_ps(currentValues, minValues);
490 for (uint32_t number = 0; number < 4; number++) {
491 if (minValuesBuffer[number] < min) {
492 index = minIndexesBuffer[number];
493 min = minValuesBuffer[number];
494 }
else if (minValuesBuffer[number] == min) {
495 if (index > minIndexesBuffer[number])
496 index = minIndexesBuffer[number];
500 for (uint32_t number = quarterPoints * 4; number < num_points; number++) {
501 if (source[number] < min) {
503 min = source[number];
506 target[0] = (uint32_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_loadu_ps(const float *p)
Definition: sse2neon.h:1941
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_cmplt_ps(__m128 a, __m128 b)
Definition: sse2neon.h:1190
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_min_32u_neon(uint32_t *target, const float *source, uint32_t num_points)
Definition: volk_32f_index_min_32u.h:248
static void volk_32f_index_min_32u_a_sse(uint32_t *target, const float *source, uint32_t num_points)
Definition: volk_32f_index_min_32u.h:126
static void volk_32f_index_min_32u_u_sse(uint32_t *target, const float *source, uint32_t num_points)
Definition: volk_32f_index_min_32u.h:456
static void volk_32f_index_min_32u_generic(uint32_t *target, const float *source, uint32_t num_points)
Definition: volk_32f_index_min_32u.h:308
static void volk_32f_index_min_32u_a_avx(uint32_t *target, const float *source, uint32_t num_points)
Definition: volk_32f_index_min_32u.h:190
static void volk_32f_index_min_32u_u_avx(uint32_t *target, const float *source, uint32_t num_points)
Definition: volk_32f_index_min_32u.h:340
#define __VOLK_ATTR_ALIGNED(x)
Definition: volk_common.h:65
for i
Definition: volk_config_fixed.tmpl.h:13