GNU Radio 3.6.5 C++ API
|
00001 #ifndef INCLUDED_volk_64f_x2_min_64f_a_H 00002 #define INCLUDED_volk_64f_x2_min_64f_a_H 00003 00004 #include <inttypes.h> 00005 #include <stdio.h> 00006 00007 #ifdef LV_HAVE_SSE2 00008 #include <emmintrin.h> 00009 /*! 00010 \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector 00011 \param cVector The vector where the results will be stored 00012 \param aVector The vector to be checked 00013 \param bVector The vector to be checked 00014 \param num_points The number of values in aVector and bVector to be checked and stored into cVector 00015 */ 00016 static inline void volk_64f_x2_min_64f_a_sse2(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){ 00017 unsigned int number = 0; 00018 const unsigned int halfPoints = num_points / 2; 00019 00020 double* cPtr = cVector; 00021 const double* aPtr = aVector; 00022 const double* bPtr= bVector; 00023 00024 __m128d aVal, bVal, cVal; 00025 for(;number < halfPoints; number++){ 00026 00027 aVal = _mm_load_pd(aPtr); 00028 bVal = _mm_load_pd(bPtr); 00029 00030 cVal = _mm_min_pd(aVal, bVal); 00031 00032 _mm_store_pd(cPtr,cVal); // Store the results back into the C container 00033 00034 aPtr += 2; 00035 bPtr += 2; 00036 cPtr += 2; 00037 } 00038 00039 number = halfPoints * 2; 00040 for(;number < num_points; number++){ 00041 const double a = *aPtr++; 00042 const double b = *bPtr++; 00043 *cPtr++ = ( a < b ? a : b); 00044 } 00045 } 00046 #endif /* LV_HAVE_SSE2 */ 00047 00048 #ifdef LV_HAVE_GENERIC 00049 /*! 00050 \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector 00051 \param cVector The vector where the results will be stored 00052 \param aVector The vector to be checked 00053 \param bVector The vector to be checked 00054 \param num_points The number of values in aVector and bVector to be checked and stored into cVector 00055 */ 00056 static inline void volk_64f_x2_min_64f_a_generic(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){ 00057 double* cPtr = cVector; 00058 const double* aPtr = aVector; 00059 const double* bPtr= bVector; 00060 unsigned int number = 0; 00061 00062 for(number = 0; number < num_points; number++){ 00063 const double a = *aPtr++; 00064 const double b = *bPtr++; 00065 *cPtr++ = ( a < b ? a : b); 00066 } 00067 } 00068 #endif /* LV_HAVE_GENERIC */ 00069 00070 00071 #endif /* INCLUDED_volk_64f_x2_min_64f_a_H */