Your problem is that you declare a pointer __m128 *m_result
but you never allocate any space for it. Later you also do m_result++
which points to another memory address which has not been allocate. There is no reason to use a pointer here.
#include <xmmintrin.h> // SSE
#include <iostream>
using namespace std;
int main()
{
float temp1[] __attribute__((__aligned__(16))) = {1.1,1.2,1.3,14.5,3.1,5.2,2.3,3.4};
float temp2[] __attribute__((__aligned__(16))) = {1.2,2.3,3.4,3.5,1.2,2.3,4.2,2.2};
float temp3[8];
__m128 m, m_result;
__m128 arr1 = _mm_load_ps(temp1);
__m128 arr2 = _mm_load_ps(temp2);
m = _mm_mul_ps(arr1, arr2);
m_result = _mm_add_ps(m, m);
_mm_store_ps(temp3, m_result);
for(int i = 0; i < 4; i++)
{
cout << temp3[i] << endl;
}
arr1 = _mm_load_ps(temp1+4);
arr2 = _mm_load_ps(temp2+4);
m = _mm_mul_ps(arr1, arr2);
m_result = _mm_add_ps(m,m);
_mm_store_ps(temp3, m_result);
for(int i = 0; i < 4; i++)
{
cout << temp3[i] << endl;
}
return 0;
}