From 08fa148310930c2995b5cb9804aa20f1ae5997ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 23 Apr 2025 22:24:01 +0200 Subject: [PATCH] SCons: Explicitly enable `-mfpmath=sse -mstackrealign` for x86_32 Passing `-msse2` doesn't seem to be sufficient to opt into SSE floating point math instead of the less stable x87. `-mstackrealign` also seems necessary when using SSE on x86_32. --- SConstruct | 2 +- modules/raycast/SCsub | 1 - platform/android/detect.py | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index bcc2094f054..84d28466781 100644 --- a/SConstruct +++ b/SConstruct @@ -718,7 +718,7 @@ if env["arch"] == "x86_32": if env.msvc: env.Append(CCFLAGS=["/arch:SSE2"]) else: - env.Append(CCFLAGS=["-msse2"]) + env.Append(CCFLAGS=["-msse2", "-mfpmath=sse", "-mstackrealign"]) # Explicitly specify colored output. if methods.using_gcc(env): diff --git a/modules/raycast/SCsub b/modules/raycast/SCsub index 46e1c3292af..64a5100c778 100644 --- a/modules/raycast/SCsub +++ b/modules/raycast/SCsub @@ -71,7 +71,6 @@ if env["builtin_embree"]: env.Append(LINKFLAGS=["psapi.lib"]) else: env.Append(LIBS=["psapi"]) - env_raycast.Append(CCFLAGS=["-mstackrealign"]) if env.msvc: # Disable bogus warning about intentional struct padding. env_raycast.Append(CCFLAGS=["/wd4324"]) diff --git a/platform/android/detect.py b/platform/android/detect.py index 4e600f6f7fe..266a3aa0823 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -207,8 +207,6 @@ def configure(env: "SConsEnvironment"): env.Append(CPPDEFINES=[("_FILE_OFFSET_BITS", 64)]) if env["arch"] == "x86_32": - # The NDK adds this if targeting API < 24, so we can drop it when Godot targets it at least - env.Append(CCFLAGS=["-mstackrealign"]) if has_swappy: env.Append(LIBPATH=["#thirdparty/swappy-frame-pacing/x86"]) elif env["arch"] == "x86_64":