Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ps2xRuntime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,9 @@ if(PS2X_IS_VITA)
endif()
endif()

# PUBLIC, so recompiled game code linking against ps2_runtime inherits it.
EnableX86SimdBaseline(ps2_runtime)

if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
EnableFastReleaseMode(ps2_runtime)
EnableFastReleaseMode(ps2EntryRunner)
Expand Down
15 changes: 15 additions & 0 deletions ps2xRuntime/cmake/ReleaseMode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ include(CheckIPOSupported)

check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_ERROR)

# SSE4.1 is required to compile, not an optimisation: ps2_runtime.h includes
# <smmintrin.h> and the recompiler emits SSE4.1-only intrinsics. GCC and Clang
# default to the SSE2 baseline, so those TUs fail without this. Kept out of
# EnableFastReleaseMode because it applies to every configuration, not just
# Release.
function(EnableX86SimdBaseline TargetName)
if(MSVC)
return()
endif()
if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64|amd64|i[3-6]86|x86)$")
return()
endif()
target_compile_options(${TargetName} PUBLIC -msse4.1)
endfunction()

function(EnableFastReleaseMode TargetName)
message("> Enabling optimization for: ${TargetName}")
if(MSVC)
Expand Down