c++ - Is there an equivalent of _mm_slli_si128(__m128i a, int num) for floats? -
let's have vector of 4 floats:
__m128 vector = |f0|f1|f2|f3| (pseudocode)
my intention transform variable this:
|0.0|f0|f1|f2|
doing shift right appear simplest choice, haven't been able find such intrinsic available floats.
what fastest way accomplish this?
here's solution:
__m128 const mask = _mm_castsi128_ps(_mm_set_epi32(0, -1, -1, -1)); vector = _mm_shuffle_ps(vector, vector, _mm_shuffle(0,3,2,1)) vector = _mm_and_ps(vector, mask);
Comments
Post a Comment