GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
volk_32f_x2_max_32f.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_32f_x2_max_32f_a_H
2 #define INCLUDED_volk_32f_x2_max_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 maximum 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_max_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_max_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_GENERIC
49 /*!
50  \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
51  \param cVector The vector where the results will be stored
52  \param aVector The vector to be checked
53  \param bVector The vector to be checked
54  \param num_points The number of values in aVector and bVector to be checked and stored into cVector
55 */
56 static inline void volk_32f_x2_max_32f_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
57  float* cPtr = cVector;
58  const float* aPtr = aVector;
59  const float* bPtr= bVector;
60  unsigned int number = 0;
61 
62  for(number = 0; number < num_points; number++){
63  const float a = *aPtr++;
64  const float b = *bPtr++;
65  *cPtr++ = ( a > b ? a : b);
66  }
67 }
68 #endif /* LV_HAVE_GENERIC */
69 
70 #ifdef LV_HAVE_ORC
71 /*!
72  \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
73  \param cVector The vector where the results will be stored
74  \param aVector The vector to be checked
75  \param bVector The vector to be checked
76  \param num_points The number of values in aVector and bVector to be checked and stored into cVector
77 */
78 extern void volk_32f_x2_max_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
79 static inline void volk_32f_x2_max_32f_u_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
80  volk_32f_x2_max_32f_a_orc_impl(cVector, aVector, bVector, num_points);
81 }
82 #endif /* LV_HAVE_ORC */
83 
84 
85 #endif /* INCLUDED_volk_32f_x2_max_32f_a_H */