tags:

views:

162

answers:

1

Hello

What's the best way ( sse2 ) to reduce a _m128 ( 4 words a b c d) to one word? I want the low part of each _m128 components:

int result = ( _m128.a & 0x000000ff ) <<  24
        | ( _m128.b & 0x000000ff ) << 16
        | ( _m128.c & 0x000000ff ) << 8
        | ( _m128.d & 0x000000ff ) << 0

Is there an intrinsics for that ? thanks !

+1  A: 

FYI, the sse3 intrinsics _mm_shuffle_epi8 do the job: (with the mask 0x0004080c in this case )

benoitj
`_mm_shuffle_epi8` (`PSHUFB`) is **SSSE3** (aka **SSE3.5** aka **MNI**). Otherwise good answer: +1.
Paul R