Dynamic cpu code?

Everything else that doesn't fall into one of the other PB categories.
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post by Dummy »

How to create the exe that chooses the right one in PureBasic without ASM-Knowledge?
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

Fred were talking about writing code within pb that is specialized for certain CPU instructions using like this

Code: Select all

compilerif #Compiler_SSE
  procedure MyFunction()
    ;sse code
  endprocedure
compilerelseif #Compiler_MMX
  procedure myfunction()
    ;same function but using mmx
  endprocedure
compilerendif
and with dynamic cpu it will include all of them and select on runtime :)
~Dreglor
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post by Dummy »

I mean compile several Optimized exes(bin/MyGame_sse, bin/MyGame_3dnow!, bin/MyGame_none)

then make a selector exe:

Code: Select all

compilerif #Compiler_SSE
  runprogram("bin/MyGame_sse")
compilerelseif #Compiler_3DNOW!
  runprogram("bin/MyGame_3dnow!")
compilerelse
  runprogram("bin/MyGame_none")
compilerendif
and with dynamic cpu it will include all of them and select on runtime :)

That'd be what I'd do if it was possible...couse it's a little faster ;) *performance hunter*
Post Reply