mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
Make -ffast-math exclusive to sinc_resampler.c
-ffast-math was added in ff14092d8d with a comment that it "helps SINC
resampler to auto-vectorize". The flag is an alias for "-fno-math-errno
-funsafe-math-optimizations -ffp-contract=fast -fno-honor-infinities
-fno-honor-nans". The last two of those cause compiler complaints
because while the flag was meant for this file, it's shared across the
codebase that includes statements that operate on infinities and NaNs.
GCC 13.3 with -fopt-info-vec reports 18 vectorizations for `-O3
-ffast-math`, 17 for `-O3 -fno-math-errno -funsafe-math-optimizations
-ffp-contract=fast` and also 17 for plain `-O3`. So using the subset of
-ffast-math without the offending flags buys nothing and loses 1
vectorization.
Both GCC and Clang provide the "fast-math" pragma directive, which I add
to this one file that benefits from it, under the condition that it's
supported. -ffast-math is removed from most of the makefiles.
This commit is contained in:
1 parent
14c78b6c32
commit
6bfb7862e7
17 files changed
+22
-27
No files matched your search
@@ -45,7 +45,6 @@ else
|
||||
OBJDIR := $(OBJDIR_BASE)/release
|
||||
CFLAGS ?= -O3
|
||||
CXXFLAGS ?= -O3
|
||||
DEF_FLAGS += -ffast-math
|
||||
endif
|
||||
|
||||
DEF_FLAGS += -Wall -Wsign-compare
|
||||
|
||||
+2
-6
@@ -154,11 +154,7 @@ LIBDIRS := -L. -L$(CTRULIB)/lib
|
||||
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
|
||||
|
||||
CFLAGS += -mword-relocations \
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
#CFLAGS += -Wall
|
||||
CFLAGS += -mword-relocations $(ARCH)
|
||||
CFLAGS += -DARM11 -D_3DS
|
||||
|
||||
ifeq ($(strip $(USE_CTRULIB_2)),1)
|
||||
@@ -202,7 +198,7 @@ CFLAGS += -Werror=implicit-function-declaration
|
||||
|
||||
ASFLAGS := -g $(ARCH) -O3
|
||||
LDFLAGS += -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
CFLAGS += -std=gnu99 -ffast-math
|
||||
CFLAGS += -std=gnu99
|
||||
|
||||
LIB_CORE :=
|
||||
LIB_CORE_FULL :=
|
||||
|
||||
@@ -83,11 +83,7 @@ LIBDIRS := -L. -L$(CTRULIB)/lib
|
||||
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
|
||||
|
||||
CFLAGS += -mword-relocations \
|
||||
-fomit-frame-pointer -ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
#CFLAGS += -Wall
|
||||
CFLAGS += -mword-relocations -fomit-frame-pointer $(ARCH)
|
||||
CFLAGS += -DARM11 -D_3DS
|
||||
|
||||
ifeq ($(strip $(USE_CTRULIB_2)),1)
|
||||
@@ -115,7 +111,7 @@ CFLAGS += -Werror=implicit-function-declaration
|
||||
ASFLAGS := -g $(ARCH) -O3
|
||||
LDFLAGS += -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
CFLAGS += -std=gnu99 -ffast-math
|
||||
CFLAGS += -std=gnu99
|
||||
|
||||
LIBS := -lctru -lm
|
||||
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ OPK_NAME = retroarch.opk
|
||||
|
||||
OBJ :=
|
||||
LINK := $(CXX)
|
||||
DEF_FLAGS := -march=mips32 -mtune=mips32r2 -mhard-float -ffast-math -fomit-frame-pointer
|
||||
DEF_FLAGS := -march=mips32 -mtune=mips32r2 -mhard-float -fomit-frame-pointer
|
||||
DEF_FLAGS += -mplt -mno-shared
|
||||
DEF_FLAGS += -ffunction-sections -fdata-sections
|
||||
DEF_FLAGS += -I. -Ideps -Ideps/stb -DDINGUX=1 -MMD
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ APP_ICON := pkg/libnx/retroarch.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH :=
|
||||
|
||||
CFLAGS := -g -Wall -O3 -fcommon -ffast-math -ffunction-sections \
|
||||
CFLAGS := -g -Wall -O3 -fcommon -ffunction-sections \
|
||||
$(ARCH) $(DEFINES) $(INCLUDE_DIRS)
|
||||
|
||||
CFLAGS += $(INCLUDE)
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ APP_ICON := pkg/libnx/retroarch.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -mcpu=cortex-a57+crc+fp+simd
|
||||
|
||||
CFLAGS := -g -Wall -O3 -fcommon -ffast-math -ffunction-sections \
|
||||
CFLAGS := -g -Wall -O3 -fcommon -ffunction-sections \
|
||||
$(ARCH) $(DEFINES) $(INCLUDE_DIRS) -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h #$(shell $(PORTLIBS)/bin/freetype-config --cflags)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1 -DHAVE_SHADERPIPELINE -DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_ASSETS -DHAVE_UPDATE_CORES -DHAVE_UPDATE_CORE_INFO -DHAVE_STB_FONT #-DHAVE_FREETYPE
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ TARGET = retroarch
|
||||
|
||||
OBJ :=
|
||||
LINK := $(CXX)
|
||||
DEF_FLAGS := -march=armv5te -mtune=arm926ej-s -ffast-math -fomit-frame-pointer
|
||||
DEF_FLAGS := -march=armv5te -mtune=arm926ej-s -fomit-frame-pointer
|
||||
DEF_FLAGS += -ffunction-sections -fdata-sections
|
||||
DEF_FLAGS += -I. -Ideps -Ideps/stb -DMIYOO=1 -DDINGUX -MMD
|
||||
DEF_FLAGS += -Wall -Wno-unused-variable -flto
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ LDFLAGS += -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ports/lib -L.
|
||||
# Lib cdvd is needed to get proper time
|
||||
LIBS += -lpatches -lgskit -ldmakit -lps2_drivers -lz -lelf-loader
|
||||
|
||||
CFLAGS = $(OPTIMIZE_LV) $(DISABLE_WARNINGS) $(DEFINES) -DPS2 -ffast-math -fsingle-precision-constant
|
||||
CFLAGS = $(OPTIMIZE_LV) $(DISABLE_WARNINGS) $(DEFINES) -DPS2 -fsingle-precision-constant
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
EE_OBJS += $(OBJ)
|
||||
|
||||
@@ -21,7 +21,7 @@ endif
|
||||
|
||||
INCDIR = -Ilibretro-common/include
|
||||
INCDIR += -I$(PS2SDK)/ports/include
|
||||
CFLAGS = $(OPTIMIZE_LV) $(DISABLE_WARNINGS) -ffast-math -fsingle-precision-constant
|
||||
CFLAGS = $(OPTIMIZE_LV) $(DISABLE_WARNINGS) -fsingle-precision-constant
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES += -DPS2 -DIS_SALAMANDER -DRARCH_CONSOLE
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ else
|
||||
endif
|
||||
|
||||
INCDIR = deps deps/stb deps/7zip libretro-common/include libretro-common/include/compat/zlib
|
||||
CFLAGS = $(OPTIMIZE_LV) -ffast-math -fsingle-precision-constant
|
||||
CFLAGS = $(OPTIMIZE_LV) -fsingle-precision-constant
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES = -DPSP \
|
||||
|
||||
@@ -12,7 +12,7 @@ else
|
||||
endif
|
||||
|
||||
INCDIR = $(PSPPATH)/include libretro-common/include
|
||||
CFLAGS = $(OPTIMIZE_LV) -ffast-math -fsingle-precision-constant
|
||||
CFLAGS = $(OPTIMIZE_LV) -fsingle-precision-constant
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES = -DPSP -DIS_SALAMANDER -DRARCH_CONSOLE
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ OPK_NAME = retroarch_retrofw.opk
|
||||
|
||||
OBJ :=
|
||||
LINK := $(CXX)
|
||||
DEF_FLAGS := -march=mips32 -mtune=mips32 -mhard-float -ffast-math -fomit-frame-pointer
|
||||
DEF_FLAGS := -march=mips32 -mtune=mips32 -mhard-float -fomit-frame-pointer
|
||||
DEF_FLAGS += -mplt -mno-shared
|
||||
DEF_FLAGS += -ffunction-sections -fdata-sections
|
||||
DEF_FLAGS += -I. -Ideps -Ideps/stb -DDINGUX=1 -DRETROFW=1 -MMD
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ endif
|
||||
ASFLAGS := $(CFLAGS)
|
||||
LDFLAGS := -Wl,-q,--pic-veneer
|
||||
|
||||
CFLAGS += -Wall -ffast-math
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -DRARCH_INTERNAL -DHAVE_SCREENSHOTS -DRARCH_CONSOLE
|
||||
CFLAGS += -DHAVE_DSP_FILTER
|
||||
CFLAGS += -DHAVE_VIDEO_FILTER
|
||||
|
||||
@@ -14,7 +14,7 @@ PREFIX = arm-vita-eabi
|
||||
CC = $(PREFIX)-gcc
|
||||
|
||||
INCDIR = libretro-common/include
|
||||
CFLAGS = -Wl,-q $(OPTIMIZE_LV) -I$(INCDIR) -std=gnu99 -mfloat-abi=hard -ffast-math -fsingle-precision-constant -mword-relocations
|
||||
CFLAGS = -Wl,-q $(OPTIMIZE_LV) -I$(INCDIR) -std=gnu99 -mfloat-abi=hard -fsingle-precision-constant -mword-relocations
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES = -DVITA -DIS_SALAMANDER -DRARCH_CONSOLE
|
||||
|
||||
+1
-1
@@ -203,7 +203,7 @@ INCDIRS += -Iwiiu
|
||||
INCDIRS += -Iwiiu/include
|
||||
|
||||
CFLAGS := -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS += -ffast-math -Werror=implicit-function-declaration
|
||||
CFLAGS += -Werror=implicit-function-declaration
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
#CFLAGS += -fomit-frame-pointer -mword-relocations
|
||||
CFLAGS += -Wall
|
||||
|
||||
+2
-2
@@ -132,8 +132,8 @@ ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
CXXFLAGS += -O0 -g
|
||||
else
|
||||
CFLAGS += -O3 -ffast-math
|
||||
CXXFLAGS += -O3 -ffast-math
|
||||
CFLAGS += -O3
|
||||
CXXFLAGS += -O3
|
||||
endif
|
||||
|
||||
CFLAGS += $(DEF_FLAGS) -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
|
||||
/* Bog-standard windowed SINC implementation. */
|
||||
|
||||
#if defined(__GNUC__) && defined(__OPTIMIZE__)
|
||||
#pragma GCC optimize ("fast-math")
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
Reference in new issue
Block a user