GNU Radio Manual and C++ API Reference  3.7.5.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
volk_32f_x2_min_32f.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_32f_x2_min_32f_a_H
2 #define INCLUDED_volk_32f_x2_min_32f_a_H
3 
4 #include <inttypes.h>
5 #include <stdio.h>
6 
7 #ifdef LV_HAVE_SSE
8 #include <xmmintrin.h>
9 /*!
10  \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
11  \param cVector The vector where the results will be stored
12  \param aVector The vector to be checked
13  \param bVector The vector to be checked
14  \param num_points The number of values in aVector and bVector to be checked and stored into cVector
15 */
16 static inline void volk_32f_x2_min_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
17  unsigned int number = 0;
18  const unsigned int quarterPoints = num_points / 4;
19 
20  float* cPtr = cVector;
21  const float* aPtr = aVector;
22  const float* bPtr= bVector;
23 
24  __m128 aVal, bVal, cVal;
25  for(;number < quarterPoints; number++){
26 
27  aVal = _mm_load_ps(aPtr);
28  bVal = _mm_load_ps(bPtr);
29 
30  cVal = _mm_min_ps(aVal, bVal);
31 
32  _mm_store_ps(cPtr,cVal); // Store the results back into the C container
33 
34  aPtr += 4;
35  bPtr += 4;
36  cPtr += 4;
37  }
38 
39  number = quarterPoints * 4;
40  for(;number < num_points; number++){
41  const float a = *aPtr++;
42  const float b = *bPtr++;
43  *cPtr++ = ( a < b ? a : b);
44  }
45 }
46 #endif /* LV_HAVE_SSE */
47 
48 #ifdef LV_HAVE_NEON
49 #include <arm_neon.h>
50 
51 /*!
52  \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
53  \param cVector The vector where the results will be stored
54  \param aVector The vector to be checked
55  \param bVector The vector to be checked
56  \param num_points The number of values in aVector and bVector to be checked and stored into cVector
57 */
58 static inline void volk_32f_x2_min_32f_neon(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
59  float* cPtr = cVector;
60  const float* aPtr = aVector;
61  const float* bPtr= bVector;
62  unsigned int number = 0;
63  unsigned int quarter_points = num_points / 4;
64 
65  float32x4_t a_vec, b_vec, c_vec;
66  for(number = 0; number < quarter_points; number++){
67  a_vec = vld1q_f32(aPtr);
68  b_vec = vld1q_f32(bPtr);
69 
70  c_vec = vminq_f32(a_vec, b_vec);
71 
72  vst1q_f32(cPtr, c_vec);
73  aPtr += 4;
74  bPtr += 4;
75  cPtr += 4;
76  }
77 
78  for(number = quarter_points*4; number < num_points; number++){
79  const float a = *aPtr++;
80  const float b = *bPtr++;
81  *cPtr++ = ( a < b ? a : b);
82  }
83 }
84 #endif /* LV_HAVE_NEON */
85 
86 #ifdef LV_HAVE_GENERIC
87 /*!
88  \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
89  \param cVector The vector where the results will be stored
90  \param aVector The vector to be checked
91  \param bVector The vector to be checked
92  \param num_points The number of values in aVector and bVector to be checked and stored into cVector
93 */
94 static inline void volk_32f_x2_min_32f_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
95  float* cPtr = cVector;
96  const float* aPtr = aVector;
97  const float* bPtr= bVector;
98  unsigned int number = 0;
99 
100  for(number = 0; number < num_points; number++){
101  const float a = *aPtr++;
102  const float b = *bPtr++;
103  *cPtr++ = ( a < b ? a : b);
104  }
105 }
106 #endif /* LV_HAVE_GENERIC */
107 
108 #ifdef LV_HAVE_ORC
109 /*!
110  \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
111  \param cVector The vector where the results will be stored
112  \param aVector The vector to be checked
113  \param bVector The vector to be checked
114  \param num_points The number of values in aVector and bVector to be checked and stored into cVector
115 */
116 extern void volk_32f_x2_min_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
117 static inline void volk_32f_x2_min_32f_u_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
118  volk_32f_x2_min_32f_a_orc_impl(cVector, aVector, bVector, num_points);
119 }
120 #endif /* LV_HAVE_ORC */
121 
122 
123 #endif /* INCLUDED_volk_32f_x2_min_32f_a_H */