How can I store __m256i data type to integer?
I know that for floats there is :
_mm256_store_ps(float *a, __m256 b)
where the first argument is the output array.
For integers I found only :
_mm256_store_si256(__m256i *a, __m256i b)
where both arguments are __m256i data type.
Is it enough to do something like this:
int * X = (int*) _mm_malloc( N * sizeof (*X) ,32 );
( I am using this as an argument to a function and I want to obtain it's values)
Inside function:
__m256i * Xmmtype = (__m256i*) X;
//fill output
_mm256_store_si256( &Xmmtype[ i ] , T ); //T is __m256i
Is this OK?
-----UPDATED -----------------------
Ok, so what if I have :
__m256i T;
for ( y = 0; y < h; y++ )
{
for ( x = 0; x < w; x++ )
{
for ( int i = 0; i < N; i+=8 )
{
//calculate here the T
}
//write result
_mm256_store_si256( &Xmmtype[ x + y * w ] , T );
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…