hi, I put together a small app to try using SEE in assembly, but I am getting the wrong output.
these are the .cpp file and the .asm file
#define WIN32_LEAN_AND_MEAN
#include <iostream>
using namespace std;
extern "C" int *myFunc(float *a, float *b, float *result);
int main(int argc, char *argv[])
{
float inA[] = {1.0f, 2.0f, 3.0f, 4.0f};
float inB[] = {1.0f, 2.0f, 3.0f, 4.0f};
float ret[4];
myFunc(inA, inB, ret);
cout << ret[0] << endl;
cout << ret[1] << endl;
cout << ret[2] << endl;
cout << ret[3] << endl;
system("pause");
return 0;
}
.586P
.XMM
.MODEL FLAT, C
.STACK
.DATA
.CODE
myFunc PROC a:DWORD, b:DWORD, result:DWORD
movups xmm0, [a]
movups xmm1, [b]
addps xmm0, xmm1
movups [result], xmm0
ret
myFunc ENDP
END
I was expecting to get the result
2
4
6
8
but instead got
-1.07374e+008
-1.07374e+008
-1.07374e+008
-1.07374e+008
can anyone help me out?