Page 1 of 1

MMX/SSE/SSE2/!3DNow/...

Posted: Thu Jul 08, 2004 2:00 pm
by Dummy
Are Calculations(eg: a+b-c/2) in PB Apps MMX/SSE/SSE2/!3DNow/... optimized when I say to Compile a SSE Executable? Can I combine eg: MMX and !3DNow?

Posted: Thu Jul 08, 2004 9:03 pm
by newbie
I was told before that these optimizations wasn't yet implemented.
Don't know when they will (if they are still not).

Posted: Sun Jul 11, 2004 2:20 am
by Codemonger
I think this optimization is in place for functions in .lib's only, the docs say this (although my docs may be outdated)

Code: Select all

   Since PureBasic 3.60, it's possible to creates specialized executables (or dynamic executables)
 which can use optimized commands for MMX, 3DNOW, SSE and SSE2 processor. It's done at compile time
 or at runtime, depending of the executable type (Normal or Dynamic CPU). Implements an optimized
 function is very easy, just put _EXTENSION below the name.
 
   Example (in C) to support MMX and 3DNOW format:
   
    PB_CrossFading       (int Rate)  // Base function, working on all processors
    PB_CrossFading_MMX   (int Rate)  // MMX optimized
    PB_CrossFading_3DNOW (int Rate)  // 3DNOW optimized
   
   Now, you have to add in the .desc which optimized functions are available. The following
   flags are available: MMX, 3DNOW, SSE and SSE2
So this means it is up to the person writing the procedures or functions for a library to create seperate functions for different mmx/3dnow extensions. For example if i wanted to create a distance function i could create 3 functions in a .lib file that are oiptimized for different extensions.. and use the dynamic setting to have the program at runtime choose which function to use depending on CPU. obviously it would choose the fastest. OR i could be completely wrong :)

Posted: Mon Jul 12, 2004 12:33 pm
by Dummy
Is here any assember who can explain me, how exactly these optimations are working?

Why aren't just the normal commands replaced with the quicker ones in the CPU?