question about SSE intrinsic

question about SSE intrinsic

Hi
I have a question about SSE intrinsic below:
program A is:

_MM_ALIGN16 float input1[4] = { 1.2f, 3.5f, 1.7f, 2.8f };
_MM_ALIGN16 float input2[4] = { -0.7f, 2.6f, 3.3f, -0.8f };
_MM_ALIGN16 float output[4];
__m128 am,bm,tm;

for(int l = 0; .....; l++)
for(int k = 0; .....; k++)
for(int j = 0; .....; j++)
{ am = _mm_load_ps(input1);
bm = _mm_load_ps(input2);
tm = _mm_mul_ps(am, bm);
_mm_store_ps(output, tm);
}

program B is:

_MM_ALIGN16 float input1[4] = { 1.2f, 3.5f, 1.7f, 2.8f };
_MM_ALIGN16 float input2[4] = { -0.7f, 2.6f, 3.3f, -0.8f };
_MM_ALIGN16 float output[4];

for(int l = 0; ....l++)
for(int k = 0; ....; k++)
for(int j = 0; ....; j++)
{ __m128 am = _mm_load_ps(input1);
__m128 bm = _mm_load_ps(input2);
__m128 tm = _mm_mul_ps(am, bm);
_mm_store_ps(output, tm);
}

well,program A is much slower than B.(VC6 intelC++ compiler7.1)
I wonder why ?
thanks!

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Message Edited by tim18 on 08-25-2004 06:10 AM

Hi tcprince

I work on Microsoft VC++6.0. Some project need SSE instruction to speed up. So I install the intel C++ compiler7.1 which "designed to integrate with the Microsoft Visual C++* 6.0 Compiler."
I didn't install Microsoft Visual C++ Processor Pack.
well,this is my first time using SSE/SSE2 intrinsic.
There is no error in the process of compiling. But the speed is much slower when I running the program.
Then I write some short passage to find what happen. Program A and B above is some of them.
As you can see, there is just a little difference between them.
Program A announce to use SSE register for variable am,bm,tm first but Program B not. When running the program, A is slower than B.
I can't explain it.

I am sorry I forgot the head file of the program.
And the forum didn't allow me to write the sign of "less than" which cause a html error.So I use "...."instead :)

Leave a Comment

Please sign in to add a comment. Not a member? Join today