Writing cross-platform SSE/3DNow code

Started by
4 comments, last by Promit 20 years, 3 months ago
I''m currently looking at rewriting certain functions with SSE/3DNow, but I want to maintain cross-platformness. I don''t mean CPU cross-platform, but rather, OS and compiler cross-platform. I want to have code that will compile on both VS6 (with Processor Pack) and g++ (need any packs?). Are there any specific directives I need to give either compiler? Can I give the same directive to both? Does g++ need any special stuff to emit SSE/3DNow code? I''m just starting to look at this, so I need to know these things so I can plan accordingly.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Advertisement
write them in assembly, and use NASM
NASM
just #ifdef directives and include and access code as is appropriate. The only other thing you need to take into consideration is supportive code for each CPU types....is rather that simple.
What''s the g++ syntax for using proc-specific code literally?

Also, can g++ generate SSE and 3DNow! native instructions from C/C++ code with the -march=(athlon|pentium3) flag?
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
GAS
quote:Original post by Promit
Also, can g++ generate SSE and 3DNow! native instructions from C/C++ code with the -march=(athlon|pentium3) flag?

It can in theory (which is why the -mmmx, -m3dnow, -msse, and -msse2 flags were added) but I don''t think it''s implemented yet (I haven''t really checked in a while so they could have started on it by now).

This topic is closed to new replies.

Advertisement