- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My output c is all zeros why?see codes below
#include "stdafx.h"
#include
#include "emmintrin.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
short x0[4]={1,1,1,1};//array xo
short x1[4]={2,2,2,2};//array x1
short c[4]; // sum of x0 and x1
__asm{
movq mm4,x0 // load x0 into mm4
movq mm7,x1 // load x1 into mm7
paddw mm4,mm7// add array x0 to array x1
movq mm5, mm1
movq c,mm1 // move result into xmm1
emms
}
for (int i = 0; i < 4; i++)
{
cout << x0 << " ";
cout << x1[1]<< " ";
cout << endl;
}
cout << endl;
for (int i = 0; i < 4; i++)
{
cout << c << " ";
cout << endl;
}
return 0;
}
#include "stdafx.h"
#include
#include "emmintrin.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
short x0[4]={1,1,1,1};//array xo
short x1[4]={2,2,2,2};//array x1
short c[4]; // sum of x0 and x1
__asm{
movq mm4,x0 // load x0 into mm4
movq mm7,x1 // load x1 into mm7
paddw mm4,mm7// add array x0 to array x1
movq mm5, mm1
movq c,mm1 // move result into xmm1
emms
}
for (int i = 0; i < 4; i++)
{
cout << x0 << " ";
cout << x1[1]<< " ";
cout << endl;
}
cout << endl;
for (int i = 0; i < 4; i++)
{
cout << c << " ";
cout << endl;
}
return 0;
}
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
it should be
movq c, mm4
instead of
movq c,mm1
?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page