Archived

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

Metus

MMX vs SSE vs 3DNow!

Recommended Posts

I''ll try to optimize my vector and vertex manupulation class with these pretty usual extensions. I know that MMX is for integers only and SSE and 3DNow for floats, so i guess I''ll use the latest. My question is though: If i implement SSE from the INTEL documents; will these SSE "functions" work on the AMD Athlon''s (the ones with SSE support) or do i have to use one implementation for the AMD version and one of the Intel version? The same goes for MMX (AMD Has the Extended MMX though) but will the standard mmx functions work over Cross-CPU''s?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Every socket based Athlon (Thunderbird & XP) supports
mmx , sse , 3dnow professional . But no sse2 though .
I don''t know for the slot-athlon ''s .
And indeed Magmai is right , 3dNOW/PRO is exclusive
for AMD .

Share this post


Link to post
Share on other sites
Well, Yes but that''s not my question: is the MMX instructions equal to both the AMD and the Intel version? If I''m using MMX on my computer using an Athlon XP, will the same cod work flawlessly on an Intel CPU?

Share this post


Link to post
Share on other sites
if you know how extensions work in opengl you know how that works..

some cpus can do mmx, some can do 3dnow, some can do sse, some can do sse2. you have to query what they can do, if it can do the specific ext, you can use it.

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
It''s not too complicated.
You should get the type of the CPU first, and you should create subclasses with inheritance from your Vector class for every case. From the P166 every CPU supports MMX, some AMD processors supporst 3DNow beside it, but nowadays AMD and Intel processors supports MMX and SSE too. And in the P4 there''s SSE2 too.
So you must create different vector classes for every cases, and use virtual functions, with plymorphism to choose the right. In this case you use the ancestor, but with polymorphism the C++ use the correct. So the most important to identify the type of the processor first. Later you know which class should be used.

Jonny

Share this post


Link to post
Share on other sites
I don''t think you get my dilemma... Is the registers (mm0 .. mm7) named equally in both AMD''s and INTEL''s CPU''s? Is the MOVQ MOVD equal in both cpu''s?

Share this post


Link to post
Share on other sites
Metus: If an AMD CPU supports MMX, it will run the same kind of MMX code an Intel chip runs. Why would you think otherwise? It wouldn''t be MMX if it couldn''t run Intel MMX code...

The encoding of the instructions are the same.

quote:

From the P166 every CPU supports MMX



Nope. There are non-MMX P166s, P180s, and P200s. When Intel introduced MMX, they had 166MHz and 200MHz versions (not sure about 150 and 180), and from then on everything supported MMX (except for Pentium Pros -- the Pentium IIs had MMX support, though.)

As always, use CPUID to find out if a given CPU supports MMX or not.

---
Bart

Share this post


Link to post
Share on other sites