Skip to content

Set the x86 SIMD baseline that the code already requires - #212

Open
Sinan-Karakaya wants to merge 1 commit into
ran-j:mainfrom
Sinan-Karakaya:fix/simd-baseline
Open

Set the x86 SIMD baseline that the code already requires#212
Sinan-Karakaya wants to merge 1 commit into
ran-j:mainfrom
Sinan-Karakaya:fix/simd-baseline

Conversation

@Sinan-Karakaya

@Sinan-Karakaya Sinan-Karakaya commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

ps2_runtime.h includes <smmintrin.h> unconditionally, and the recompiler emits SSE4.1-only intrinsics (_mm_blendv_ps and friends) for the COP2/FPU select idioms. SSE4.1 is a hard requirement of the codebase, not a tuning option.

Nothing sets it for GCC or Clang. MSVC does not need it, its intrinsics are not gated behind a target feature; and the only place any x86 feature is named is /arch:AVX2 inside EnableFastReleaseMode, which is MSVC-only and only applied for Release/RelWithDebInfo. GCC and Clang default to the plain x86-64 baseline, which is SSE2, so on a stock Linux or macOS toolchain the affected translation units fail:

error: always_inline function "_mm_blendv_ps" requires target feature "sse4.1"

Adds EnableX86SimdBaseline() and applies it to ps2_runtime in every configuration rather than from inside EnableFastReleaseMode; a Debug build needs it just as much. PUBLIC, so recompiled game code linking against ps2_runtime inherits it; that code is where most of the SSE4.1 intrinsics actually are. Guarded on CMAKE_SYSTEM_PROCESSOR so ARM builds are unaffected.

Found while linking a fully recompiled retail binary (~11.5k translation units, ~160 of which use SSE4.1 intrinsics) against ps2_runtime on Fedora with clang.

ps2_runtime.h includes <smmintrin.h> unconditionally, and the
recompiler emits SSE4.1-only intrinsics (_mm_blendv_ps and friends) for
the COP2 and FPU select idioms. SSE4.1 is therefore a hard requirement
of the codebase, not a tuning option.

Nothing sets it for GCC or Clang. MSVC does not need it -- its
intrinsics are not gated behind a target feature -- and the only place
any x86 feature is named is /arch:AVX2 inside EnableFastReleaseMode,
which is MSVC-only and applies to Release and RelWithDebInfo only. GCC
and Clang default to the plain x86-64 baseline, which is SSE2, so on a
stock Linux or macOS toolchain the affected translation units fail with
"always_inline function ... requires target feature 'sse4.1'".

Adds EnableX86SimdBaseline and applies it to ps2_runtime in every
configuration rather than in EnableFastReleaseMode, since a Debug build
needs it just as much. PUBLIC, so recompiled game code linking against
ps2_runtime inherits it -- that code is where most of the SSE4.1
intrinsics actually are. Guarded on the target processor so ARM builds
are unaffected.

(cherry picked from commit 226bae250b285930da75accc7a7ee0045942d807)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant