GNU Radio 3.7.2 C++ API
volk_64f_x2_max_64f.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_64f_x2_max_64f_a_H
2 #define INCLUDED_volk_64f_x2_max_64f_a_H
3 
4 #include <inttypes.h>
5 #include <stdio.h>
6 
7 #ifdef LV_HAVE_SSE2
8 #include <emmintrin.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_64f_x2_max_64f_a_sse2(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){
17  unsigned int number = 0;
18  const unsigned int halfPoints = num_points / 2;
19 
20  double* cPtr = cVector;
21  const double* aPtr = aVector;
22  const double* bPtr= bVector;
23 
24  __m128d aVal, bVal, cVal;
25  for(;number < halfPoints; number++){
26 
27  aVal = _mm_load_pd(aPtr);
28  bVal = _mm_load_pd(bPtr);
29 
30  cVal = _mm_max_pd(aVal, bVal);
31 
32  _mm_store_pd(cPtr,cVal); // Store the results back into the C container
33 
34  aPtr += 2;
35  bPtr += 2;
36  cPtr += 2;
37  }
38 
39  number = halfPoints * 2;
40  for(;number < num_points; number++){
41  const double a = *aPtr++;
42  const double b = *bPtr++;
43  *cPtr++ = ( a > b ? a : b);
44  }
45 }
46 #endif /* LV_HAVE_SSE2 */
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_64f_x2_max_64f_generic(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){
57  double* cPtr = cVector;
58  const double* aPtr = aVector;
59  const double* bPtr= bVector;
60  unsigned int number = 0;
61 
62  for(number = 0; number < num_points; number++){
63  const double a = *aPtr++;
64  const double b = *bPtr++;
65  *cPtr++ = ( a > b ? a : b);
66  }
67 }
68 #endif /* LV_HAVE_GENERIC */
69 
70 
71 #endif /* INCLUDED_volk_64f_x2_max_64f_a_H */