Search code examples
c#.net-coressesimdintrinsics

What is the netCore SSE2 counterpart of _mm_set1_epi32


I'm porting some c++ SIMD instruction code to netCore Intrinsics and went over following line:

__m128i ssd = _mm_set1_epi32((unsigned __int32)(alpha_value & 0x000000FF) << 24); //ALPHA CHANNEL MASK

In the docs of netCore SSE2 Intrinsics I could not find any corresponding method for the _mm_set1_epi32 intrinsic.

What this instruction does is setting each of the 4 32 bit uint in the 128 bit vector to a specified value.

How to do that in netCore with Vector128<uint>?


Solution

  • It's not in that class, instead Vector128 has static a Create function with various overloads that can be used in place of both the set1-group and set-group of functions. Since they are overloads and don't have the type in the name, special care must be taken that the parameter type is correct.