Poor person, alternative _mm_cvttpd_epi64

In AXV512DQ there is _mm_cvttpd_epi64 , for example in the file avx512vldqintrin.h , we find

 static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvttpd_epi64 (__m128d __A) { return (__m128i) __builtin_ia32_cvttpd2qq128_mask ((__v2df) __A, (__v2di) _mm_setzero_si128(), (__mmask8) -1); } 

which converts two packed 64-bit floats ( __m128d ) to two packed 64-bit integers ( __m128i ). There is also _mm256_cvttpd_epi64 for converting four packed 64-bit floats ( __m256d ) to four packed 64-bit integers ( __m256i ).

However, many machines do not support the AXV512DQ . So I wonder what the best version of the alternative for the poor person is for this.

I must say that I am already satisfied with the solution, which only works for 64-bit floats, which can be converted to 32-bit floats without loss.

+5
source share

Source: https://habr.com/ru/post/1268781/


All Articles