Avoid the use of SSE instructions (R)SQRTSS for sqrtf and 1/sqrtf.

When using the -ffast-math option, GCC uses SSE instructions SQRTSS for
sqrtf and RSQRTSS for 1/sqrtf. This results in a loss of precision
according to the GCC documentation: "the precision of the sequence can
be decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
0.99999994)".
This loss of precision affects some games.
Fixes the broken AI in Soldiers of Fortune.
This commit is contained in:
Flyinghead 2018-07-08 10:16:27 +02:00
parent a89ff1e432
commit efa145f50e
1 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,7 @@ ifneq (,$(findstring x86,$(platform)))
MFLAGS += -m32
ASFLAGS += --32
LDFLAGS += -m32
CFLAGS += -m32 -D TARGET_LINUX_x86 -D TARGET_NO_AREC -fsingle-precision-constant
CFLAGS += -m32 -D TARGET_LINUX_x86 -D TARGET_NO_AREC -fsingle-precision-constant -fno-builtin-sqrtf
CXXFLAGS += -fno-exceptions
ifneq (,$(findstring sse4_1,$(platform)))
@ -102,7 +102,7 @@ else ifneq (,$(findstring x64,$(platform)))
X64_REC := 1
NOT_ARM := 1
USE_X11 := 1
CFLAGS += -D TARGET_LINUX_x64 -D TARGET_NO_AREC -fsingle-precision-constant
CFLAGS += -D TARGET_LINUX_x64 -D TARGET_NO_AREC -fsingle-precision-constant -fno-builtin-sqrtf
CXXFLAGS += -fexceptions
ifneq (,$(findstring sse4_1,$(platform)))