]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Update compiler options, fixing obscure bug
authorbones_was_here <bones_was_here@xonotic.au>
Sun, 2 Apr 2023 16:18:40 +0000 (02:18 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sun, 2 Apr 2023 16:18:40 +0000 (02:18 +1000)
Added -mno-avx to avoid QC bugs on (at least) haswell and skylake targets.

Removed -fno-signaling-nans as clang doesn't support it and spams warns,
and in GCC it's the default.

Removed -fno-rounding-math as this is also the default.

makefile.inc

index 2567612543e010e2aba67c906602f4de789a7e75..e1e1621cd143aa49090a67a60ae68bf1dd4e2a79 100644 (file)
@@ -22,13 +22,10 @@ CC?=gcc
 # Experimental
 #CPUOPTIMIZATIONS?=-fno-math-errno -fno-rounding-math -fno-signaling-nans -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math
 # Normal
-ifeq ($(CC), clang)
-       CPUOPTIMIZATIONS?=-fno-math-errno -fno-rounding-math -fno-trapping-math
-else
-       CPUOPTIMIZATIONS?=-fno-math-errno -fno-rounding-math -fno-signaling-nans -fno-trapping-math
-endif
+CPUOPTIMIZATIONS?=-mno-avx
 # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag
 # Also, since gcc 5, -ffinite-math-only makes NaN and zero compare equal inside engine code but not inside QC, which causes error spam for seemingly valid QC code like if (x != 0) return 1 / x;
+# bones_was_here: added -mno-avx because when compiling for (at least) haswell or skylake with gcc or clang, with both -O2 and -O3, AVX auto-vectorisation causes subtle bugs in Xonotic QC physics, and changes the hash generated by the CI pipeline.  AVX2 seems to be OK.  Also moved -fno-math-errno -fno-trapping-math to OPTIM_RELEASE as they're not CPU-specific.
 
 SDL_CONFIG?=sdl2-config
 SDLCONFIG_UNIXCFLAGS?=`$(SDL_CONFIG) --cflags`
@@ -201,7 +198,8 @@ OPTIM_DEBUG=$(CPUOPTIMIZATIONS)
 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -fno-math-errno -fno-trapping-math -fno-signaling-nans -fcx-limited-range -funroll-loops $(CPUOPTIMIZATIONS)
 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -funroll-loops $(CPUOPTIMIZATIONS)
 #OPTIM_RELEASE=-O2 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
-OPTIM_RELEASE=-O3 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
+#OPTIM_RELEASE=-O3 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
+OPTIM_RELEASE=-O3 -fno-strict-aliasing -fno-math-errno -fno-trapping-math $(CPUOPTIMIZATIONS)
 # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag
 # Also, since gcc 5, -ffinite-math-only makes NaN and zero compare equal inside engine code but not inside QC, which causes error spam for seemingly valid QC code like if (x != 0) return 1 / x;