Hi,
I have 4 _m128i 64byte elements which can contain 0 or non-zero (+ve, -ve) values. I want to extract non-zero values from them.
I looked at _mm_extract_epi8/_mmextract_epi16 but the syntax is int _mm_extract_epi16 (__m128i a, int imm) where imm is the index, hence I have to loop to get non-zero values.
Any intrinsics functions that can be used to avoid loop will be helpful. Inputs appreciated.
Thanks.
链接已复制
3 回复数
I'm thinking _mm_cmpeq_epi8, _mm_movemask_epi8 and then dispatch through a table of pointers to series of _mm_extract_epi8. But I'm not sure this approach will be beneficial compared to a regular std::find_if in memory.
Ravi,
Can you describe in more detail (widen the scope of your description) of what you are trying to do?
IOW are you intending to squish out the 0's of 4 x _mm_epi8 registers (to left, to right, across registers), or is this a squish of a larger number of bytes in memory?
Jim Dempsey