Click here to Skip to main content
15,888,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.

I am asked to use following four X86 intrinsics to code split function.
__m128i _mm_blendv_epi8 (__m128i a, __m128i b, __m128i mask)
__m128i _mm_shuffle_epi8 (__m128i a, __m128i b)
__m128i _mm_load_si128 (__m128i const* mem_addr)
void _mm_store_si128 (__m128i* mem_addr, __m128i a)

Given array is Arr[] = {1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3}.
I need to split this array into three arrays.
a[] = {1,1,1,1,1,1,1,1,1}
b[] = {2,2,2,2,2,2,2,2,2}
c[] = {3,3,3,3,3,3,3,3,3}

I have no experience of Intel SSE intrinsics..I only have C programming experience..
Please help me to solve this problem.

Thanks.

What I have tried:

In C, I would do like this...
C++
for(int i = 0; i <size ; i++)
{ 
  a[i] = arr[i*3+0];
  b[i] = arr[i*3+1];
  c[i] = arr[i*3+2];
}
Posted
Updated 17-Nov-19 10:30am
v2

1 solution

Maybe that could give you some sort of starting point:
(PDF) x86 Intrinsics Cheat-Sheet[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900