Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Examples ?

robiwano
2009-03-11
2013-04-24
  • robiwano
    robiwano
    2009-03-11

    I'm trying to do an algorithm which uses SSE2+SSE3 functions. How do I go about to actually compile REF + SSE + SSE2 + SSE3 variants of the algorithm?

    My hunch is that I somehow via includes direct the compiler which set of instructions to use, like (pseudo code):

    // Compile for REF
    #include <SSEplus_REF.h>
    #define myalgorithm myalgorithm_REF
    #include <myalgorithm.cpp>
    #undef myalgorithm

    // Compile for SSE
    #include <sseplus_unmap_all.h>
    #include <SSEplus_SSE.h>
    #define myalgorithm myalgorithm_SSE
    #include <myalgorithm.cpp>
    #undef myalgorithm

    etc.

    then use cpuid to map a function pointer at run-time to the correct version.

    Thing is that I don't know. An example project would be nice to have.