aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c27c6e4e..b7de4a69 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -432,6 +432,30 @@ IF(HAVE_MFPU_NEON_SWITCH)
SET(FPU_NEON_SWITCH "-mfpu=neon")
ENDIF()
+SET(FPMATH_SET "0")
+IF(HAVE_MSSE_SWITCH AND CMAKE_SIZEOF_VOID_P MATCHES "4")
+ OPTION(ALSOFT_ENABLE_SSE_CODEGEN "Enable SSE code generation instead of x87 for 32-bit targets." TRUE)
+ IF(HAVE_MSSE2_SWITCH)
+ OPTION(ALSOFT_ENABLE_SSE2_CODEGEN "Enable SSE2 code generation instead of x87 for 32-bit targets." TRUE)
+ ENDIF()
+
+ IF(HAVE_MSSE2_SWITCH AND ALSOFT_ENABLE_SSE2_CODEGEN)
+ CHECK_C_COMPILER_FLAG("${SSE2_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE_2)
+ IF(ALSOFT_ENABLE_SSE2_CODEGEN AND HAVE_MFPMATH_SSE_2)
+ SET(C_FLAGS ${C_FLAGS} ${SSE2_SWITCH} -mfpmath=sse)
+ SET(FPMATH_SET 2)
+ ENDIF()
+ ENDIF()
+ IF(ALSOFT_ENABLE_SSE_CODEGEN AND NOT FPMATH_SET)
+ CHECK_C_COMPILER_FLAG("${SSE_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE)
+ IF(ALSOFT_ENABLE_SSE_CODEGEN AND HAVE_MFPMATH_SSE)
+ SET(C_FLAGS ${C_FLAGS} ${SSE_SWITCH} -mfpmath=sse)
+ SET(FPMATH_SET 1)
+ ENDIF()
+ ENDIF()
+ENDIF()
+
+
CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
int main() {return 0;}" HAVE_GCC_FORMAT)
@@ -1471,6 +1495,10 @@ MESSAGE(STATUS "")
MESSAGE(STATUS "Building with support for CPU extensions:")
MESSAGE(STATUS " ${CPU_EXTS}")
MESSAGE(STATUS "")
+IF(FPMATH_SET)
+ MESSAGE(STATUS "Building with SSE${FPMATH_SET} codegen")
+ MESSAGE(STATUS "")
+ENDIF()
IF(WIN32)
IF(NOT HAVE_DSOUND)