- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Tags:
- Intel® Advanced Vector Extensions (Intel® AVX)
- Intel® Streaming SIMD Extensions
- Parallel Computing
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks andysem for your inputs, will look into it.
Jim,
I want to use it for ipv6 source/destination address and mask and want to implement TCAM like Longest-Prefix-Match behavior.
Thanks.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page