Archived

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

darkdragon666

How can I perform a multiply between floating point number in ASM?

Recommended Posts

darkdragon666    122
How can I perform a multiply between floating point number in ASM? I wanna optimize my custom matrix n'' vector math functions, I know that Direct3D n'' OpenGL have their own-optimized functions but I''m doing a software render for the proyect and I think that ASM is much faster than C++.

Share this post


Link to post
Share on other sites
Brother Bob    10344
quote:

...and I think that ASM is much faster than C++.


If you have a good compiler, don''t be so sure about that. Today''s compiler can do a flow analysis of the program to see what happens with different pieces of code, pair machine instructions for optimum execution, and so on.

Share this post


Link to post
Share on other sites
a person    118
darkdragon, dont bother trying to optimize your matrix vector code (or any code for that matter) in asm. if you dont know how to do simply things multiple and divide in asm, you should not even attempt the complex task of optimization in asm
i suggest sticking to the c++ code since you cant hope to out compete the compiler until you learn about asm, sse, and your cpu. its not as easy you probally think. do you even have the entire rendering system working yet? if not dont optimize yet, its too soon. wait till your system is done, then optimize where its needed, otherwise you will never finish your project.

too many ppl think that asm is the magically speed fairy.

Share this post


Link to post
Share on other sites
jenova    122
goto "developer.intel.com" and lookup the "fmul" instruction, or better yet, you might want to lookup the entire fpu of the x86 before you start programming for it.

however, as a side note. if you''re going to do this then you should be detecting the level of the CPU, and add support for MMX or better yet SSE(2) (streaming simd) as these instructions offer parallel operation on fixed and floating point numbers with much greater performance.

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