citra_common: Enable SSE4.2 on x86_64 builds
Enables the use of SSE4.2 instructions on x86_64 CPUs, allowing compilers to automatically vectorize some loops on citra_common. A CMake toggle ENABLE_SSE42 (ON by default) has been added to enable this behaviour. This change breaks compatibility with CPUs that do not have SSE4.2 instructions. All modern CPUs (from 2011 onwards) should always have these instructions. Manual compilation will be needed for older CPUs. A message has been added to report if the CPU is incompatible when starting the emulator. Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
This commit is contained in:
parent
9ecd26d2ce
commit
88b3dff278
4 changed files with 73 additions and 0 deletions
|
|
@ -105,6 +105,8 @@ option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
|
|||
|
||||
option(ENABLE_MICROPROFILE "Enables microprofile capabilities" OFF)
|
||||
|
||||
option(ENABLE_SSE42 "Enable SSE4.2 optimizations on x86_64" ON)
|
||||
|
||||
# Compile options
|
||||
CMAKE_DEPENDENT_OPTION(COMPILE_WITH_DWARF "Add DWARF debugging information" ${IS_DEBUG_BUILD} "MINGW" OFF)
|
||||
option(ENABLE_LTO "Enable link time optimization" ${DEFAULT_ENABLE_LTO})
|
||||
|
|
@ -126,6 +128,15 @@ if (ENABLE_SDL2_FRONTEND)
|
|||
add_definitions(-DENABLE_SDL2_FRONTEND)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SSE42 AND (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64"))
|
||||
message(STATUS "SSE4.2 enabled for x86_64")
|
||||
if(MSVC)
|
||||
SET(SSE42_COMPILE_OPTION /arch:SSE4.2)
|
||||
else()
|
||||
SET(SSE42_COMPILE_OPTION -msse4.1 -msse4.2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CitraHandleSystemLibs)
|
||||
|
||||
if (CITRA_USE_PRECOMPILED_HEADERS)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue