I need to convert a float vector (__m128) to an integer vector (__m128i), and I am using _mm_cvtps_epi32
, but I am not getting the expected value. Here is a very simple example:
__m128 test = _mm_set1_ps(4.5f);
__m128i test_i = _mm_cvtps_epi32(test);
The debugger output I get:
(lldb) po test
([0] = 4.5, [1] = 4.5, [2] = 4.5, [3] = 4.5)
(lldb) po test_i
([0] = 17179869188, [1] = 17179869188)
(lldb)
As you can see, the resulting integer is.. 17179869188? From 4.5? And why are there only two values? _mm_cvtps_epi32
should convert 4 packed 32-bit floating-point values to 4 packed 32-bit integers.