I am using the following code to divide all int array elements with constant factor using SSE.
void sse_div(int *arr,int num_shift,int N) // devide all array elements by 2
{
num_shift=1;
int nb_iters = N / 4;
__declspec(align(32))int *a1=arr;
__m128i* l = (__m128i*)a1;
for (int i = 0; i < nb_iters; ++i, ++l)
_mm_store_si128( l, _mm_srai_epi32(*l,num_shift)); //Error line
}
But I am getting the following error

I am unable to get rid of this problem.
Can anybody please help to solve this problem.
Any help will be appreciated.
Thanks in Advance
Since your input array is apparently misaligned you can use unaligned loads/stores, e.g.:
Note that there may be a significant performance hit from using unaligned loads/stores (depending on what CPU you are running on), so if possible you should make your
arrarray 16 byte aligned when you allocate the memory.