diff options
author | Nick Foster | 2011-05-12 17:39:11 -0700 |
---|---|---|
committer | Nick Foster | 2011-05-12 17:39:11 -0700 |
commit | 7d349848c60f99f9906cb57d0ebe3c7dd35096bd (patch) | |
tree | 65dbdfd211413857803e2833b17254b67f023a8f /volk/include | |
parent | bfb812a4ae8ec750d4452be7ce6b31d33de5796d (diff) | |
download | gnuradio-7d349848c60f99f9906cb57d0ebe3c7dd35096bd.tar.gz gnuradio-7d349848c60f99f9906cb57d0ebe3c7dd35096bd.tar.bz2 gnuradio-7d349848c60f99f9906cb57d0ebe3c7dd35096bd.zip |
Volk: avx impl for 32f_s32f_convert_32i
Diffstat (limited to 'volk/include')
-rw-r--r-- | volk/include/volk/volk_32f_s32f_convert_32i_a16.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/volk/include/volk/volk_32f_s32f_convert_32i_a16.h b/volk/include/volk/volk_32f_s32f_convert_32i_a16.h index 2927d616c..3f5044313 100644 --- a/volk/include/volk/volk_32f_s32f_convert_32i_a16.h +++ b/volk/include/volk/volk_32f_s32f_convert_32i_a16.h @@ -5,6 +5,42 @@ #include <inttypes.h> #include <stdio.h> +#ifdef LV_HAVE_AVX +#include <immintrin.h> + /*! + \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value + \param inputVector The floating point input data buffer + \param outputVector The 32 bit output data buffer + \param scalar The value multiplied against each point in the input buffer + \param num_points The number of data values to be converted + */ +static inline void volk_32f_s32f_convert_32i_a16_avx(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){ + unsigned int number = 0; + + const unsigned int eighthPoints = num_points / 8; + + const float* inputVectorPtr = (const float*)inputVector; + int32_t* outputVectorPtr = outputVector; + __m256 vScalar = _mm256_set1_ps(scalar); + __m256 inputVal1; + __m256i intInputVal1; + + for(;number < eighthPoints; number++){ + inputVal1 = _mm256_load_ps(inputVectorPtr); inputVectorPtr += 8; + + intInputVal1 = _mm256_cvtps_epi32(_mm256_mul_ps(inputVal1, vScalar)); + + _mm256_store_si256((__m256i*)outputVectorPtr, intInputVal1); + outputVectorPtr += 8; + } + + number = eighthPoints * 8; + for(; number < num_points; number++){ + outputVector[number] = (int32_t)(inputVector[number] * scalar); + } +} +#endif /* LV_HAVE_AVX */ + #ifdef LV_HAVE_SSE2 #include <emmintrin.h> /*! |