There is an instruction called _mm256_set1_epi8
in AVX which can set 32 8-bit integers inside a _m256i
container to a specific value.
If I have an array of said 8-bit integers, how can I make it so that the __m256i
container resulting from the _mm256_set1_epi8
operation overrides the char[32]
container ?
I have not found any load or move instruction related to epi8 (8-bit signed integers) in either SSEx, or AVX. I guess there must be a way to achieve this as it seems not that complicated of a computation but I cannot find which instruction should be used to achieve that.
If it is not achievable using __m256i
, would it be possible to achieve something similar with a __m128i
?
Code sample to illustrate the situation described above :
int _tmain(int argc, _TCHAR* argv[])
{
// This is an array of 8-bit signed integers
char charArray[32] = { 0, 1, 2, 3, 4, /*[...],*/ 30, 31 };
// This is the value I want to set in the array at some point
char valueToSet = 4;
// This instruction makes it possible to set 32 8-bit signed integers at once
__m256i eightBitIntegersRegistry = _mm256_set1_epi8(valueToSet);
// How can I make it affect the charArray array?
// In the end I would want the content of charArray to be { 4, 4, 4, [...] 4, 4, 4 }
return 0;
}