aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt66
1 files changed, 56 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bc0f51d4..af41c001 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -300,17 +300,21 @@ ELSE()
ENDIF()
SET(SSE_SWITCH "")
-IF(MSVC)
- CHECK_C_COMPILER_FLAG(/arch:SSE HAVE_ARCHSSE_SWITCH)
- IF(HAVE_ARCHSSE_SWITCH)
- SET(SSE_SWITCH "/arch:SSE")
- ENDIF()
-ENDIF()
-IF(NOT SSE_SWITCH)
+SET(SSE2_SWITCH "")
+SET(SSE4_1_SWITCH "")
+IF(NOT MSVC)
CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
IF(HAVE_MSSE_SWITCH)
SET(SSE_SWITCH "-msse")
ENDIF()
+ CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH)
+ IF(HAVE_MSSE2_SWITCH)
+ SET(SSE2_SWITCH "-msse2")
+ ENDIF()
+ CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH)
+ IF(HAVE_MSSE4_1_SWITCH)
+ SET(SSE4_1_SWITCH "-msse4.1")
+ ENDIF()
ENDIF()
CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
@@ -546,14 +550,16 @@ SET(ALC_OBJS Alc/ALc.c
SET(CPU_EXTS "Default")
-SET(HAVE_SSE 0)
+SET(HAVE_SSE 0)
+SET(HAVE_SSE2 0)
+SET(HAVE_SSE4_1 0)
SET(HAVE_NEON 0)
# Check for SSE support
-OPTION(ALSOFT_REQUIRE_SSE "Require SSE/SSE2 support" OFF)
+OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
IF(HAVE_XMMINTRIN_H)
- OPTION(ALSOFT_CPUEXT_SSE "Enable SSE/SSE2 support" ON)
+ OPTION(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
IF(ALSOFT_CPUEXT_SSE)
IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
SET(HAVE_SSE 1)
@@ -570,6 +576,46 @@ IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
ENDIF()
+OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
+CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
+IF(HAVE_EMMINTRIN_H)
+ OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
+ IF(ALSOFT_CPUEXT_SSE2)
+ IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
+ SET(HAVE_SSE2 1)
+ SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse2.c)
+ IF(SSE2_SWITCH)
+ SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse2.c PROPERTIES
+ COMPILE_FLAGS "${SSE2_SWITCH}")
+ ENDIF()
+ SET(CPU_EXTS "${CPU_EXTS}, SSE2")
+ ENDIF()
+ ENDIF()
+ENDIF()
+IF(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
+ MESSAGE(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
+ENDIF()
+
+OPTION(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
+CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
+IF(HAVE_SMMINTRIN_H)
+ OPTION(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
+ IF(ALSOFT_CPUEXT_SSE4_1)
+ IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
+ SET(HAVE_SSE4_1 1)
+ SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse41.c)
+ IF(SSE4_1_SWITCH)
+ SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse41.c PROPERTIES
+ COMPILE_FLAGS "${SSE4_1_SWITCH}")
+ ENDIF()
+ SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
+ ENDIF()
+ ENDIF()
+ENDIF()
+IF(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
+ MESSAGE(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
+ENDIF()
+
# Check for ARM Neon support
OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H)