c++ - Constant floats with SIMD -
i've been trying hand @ optimising code have using microsoft's sse intrinsics. 1 of biggest problems when optimising code lhs happens whenever want use constant. there seems info on generating constants (here , here - section 13.4), assembly (which rather avoid).
the problem when try implement same thing intrinsics, msvc complains incompatible types etc. know of equivalent tricks using intrinsics?
example - generate {1.0,1.0,1.0,1.0}
//pcmpeqw xmm0,xmm0 __m128 t = _mm_cmpeq_epi16( t, t ); //pslld xmm0,25 _mm_slli_epi32(t, 25); //psrld xmm0,2 return _mm_srli_epi32(t, 2); this generates bunch of errors incompatible type (__m128 vs _m128i). i'm pretty new this, i'm pretty sure i'm missing obvious. can help?
tldr - how generate __m128 vec filled single precision constant floats ms intrinsics?
thanks reading :)
simply cast __m128i __m128 using _mm_castsi128_ps. also, second line should
t = _mm_slli_epi32(t, 25)
Comments
Post a Comment