Archived

This topic is now archived and is closed to further replies.

Metus

Optimizin for MMX / 3DNow / SSE

Recommended Posts

Ok, Ignore my old post "MMX vs 3DNow vs SSE" ... WHAT IF i replaced EVERY operator ( - / * + sqrt) with corresponding feature (MMX / MMX Pro / SSE / SSE2 for Integers and 3DNow / 3DNow Pro / SSE / SSE2 for Floats) what kind of speed boost should i Expect? Is the time coding it worth the speed boost?

Share this post


Link to post
Share on other sites
I don''t think you get much of a speed boost for doing a single function, the overhead of calling a function is (I think) much greater than a couple of additions.

SSE, MMX etc are much better used where you have a lot of similar data to work on, in a particle engine for example you could work on four particles at once.

Andrew

Share this post


Link to post
Share on other sites
I don''t think you understand mmx/sse/3dnow correctly.

MMX is useful because of its single instruction multiple data techniques, meaning that you can load in 64 bits of data at a time and perforom an operation on each 32/16/8 bit chunk of the 64bits with one instruction. Just using the math capabilities of mmx will give you no speed boost because the most math instruction on the ALU are only one clock cycle anyways. Don''t use mmx just to use it.

SSE is great for several things. SSE gives you use of 128bit floating point registers, which can be useful if you need that much data. Or you can use some of the SSE instructions such as MOVNTQ for copying 64bit data directly to memory avoiding cache corruption.

As for 3DNow! I don''t have much experience with it but I''m assuming that it''s simmilar to MMX.

If you really want a speed boost optimize the algorithm and do low level optimization with the normal instructions. Such as memory alignment, keeping things in registers throughout the function, instruction pairing, branch prediction, etc.

--Andrew

Share this post


Link to post
Share on other sites
quote:
Original post by Metus
Well ofcourse.. I won''t use it to write my own calculator Actually It''s for my "never-ending" 3d engine using opengl...



most OpenGL drivers automatically take advantage of SSE or 3DNow.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites