CMakeLists.txt
changeset 10835 0e9e7a128391
parent 10777 2883d23b5a28
child 10848 7764aba2f211
     1.1 --- a/CMakeLists.txt	Sun Jan 22 20:27:48 2017 -0500
     1.2 +++ b/CMakeLists.txt	Mon Jan 23 01:05:44 2017 -0500
     1.3 @@ -262,6 +262,7 @@
     1.4  set_option(3DNOW               "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM})
     1.5  set_option(SSE                 "Use SSE assembly routines" ${OPT_DEF_ASM})
     1.6  set_option(SSE2                "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH})
     1.7 +set_option(SSE3                "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH})
     1.8  set_option(ALTIVEC             "Use Altivec assembly routines" ${OPT_DEF_ASM})
     1.9  set_option(DISKAUDIO           "Support the disk writer audio driver" ON)
    1.10  set_option(DUMMYAUDIO          "Support the dummy audio driver" ON)
    1.11 @@ -516,8 +517,31 @@
    1.12        set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
    1.13      endif()
    1.14  
    1.15 +    if(SSE3)
    1.16 +      set(CMAKE_REQUIRED_FLAGS "-msse3")
    1.17 +      check_c_source_compiles("
    1.18 +          #ifdef __MINGW32__
    1.19 +          #include <_mingw.h>
    1.20 +          #ifdef __MINGW64_VERSION_MAJOR
    1.21 +          #include <intrin.h>
    1.22 +          #else
    1.23 +          #include <pmmintrin.h>
    1.24 +          #endif
    1.25 +          #else
    1.26 +          #include <pmmintrin.h>
    1.27 +          #endif
    1.28 +          #ifndef __SSE3__
    1.29 +          #error Assembler CPP flag not enabled
    1.30 +          #endif
    1.31 +          int main(int argc, char **argv) { }" HAVE_SSE3)
    1.32 +      if(HAVE_SSE3)
    1.33 +        list(APPEND EXTRA_CFLAGS "-msse3")
    1.34 +      endif()
    1.35 +      set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
    1.36 +    endif()
    1.37 +
    1.38      if(SSEMATH)
    1.39 -      if(SSE OR SSE2)
    1.40 +      if(SSE OR SSE2 OR SSE3)
    1.41          if(USE_GCC)
    1.42            list(APPEND EXTRA_CFLAGS "-mfpmath=387")
    1.43          endif()
    1.44 @@ -557,12 +581,13 @@
    1.45      endif()
    1.46      set(HAVE_SSE TRUE)
    1.47      set(HAVE_SSE2 TRUE)
    1.48 +    set(HAVE_SSE3 TRUE)
    1.49      set(SDL_ASSEMBLY_ROUTINES 1)
    1.50    endif()
    1.51  # TODO:
    1.52  #else()
    1.53  #  if(USE_GCC OR USE_CLANG)
    1.54 -#    list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-mmx")
    1.55 +#    list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-sse3" "-mno-mmx")
    1.56  #  endif()
    1.57  endif()
    1.58