[Retroarch] Optimize snes9x2002, gpsp, pcsx_rearmed (#87)

* Optimize snes9x2002

* Add optimize flags

* optimize gpsp, pcsx_rearmed
This commit is contained in:
tiopex
2024-01-15 07:09:44 +01:00
committed by GitHub
parent de1e8c30f4
commit 043a0dd85d
7 changed files with 177 additions and 81 deletions

View File

@@ -1,13 +0,0 @@
diff --git a/Makefile b/Makefile
index 5a3bab7..0658014 100644
--- a/Makefile
+++ b/Makefile
@@ -482,7 +482,7 @@ else ifeq ($(platform), miyoo)
CXX = /opt/miyoo/usr/bin/arm-linux-g++
AR = /opt/miyoo/usr/bin/arm-linux-ar
SHARED := -shared -nostdlib -Wl,--version-script=link.T
- fpic := -fPIC -DPIC
+ fpic := -fno-PIC
CFLAGS += -fomit-frame-pointer -ffast-math -march=armv5te -mtune=arm926ej-s
CFLAGS += -DSMALL_TRANSLATION_CACHE
HAVE_DYNAREC := 1

View File

@@ -0,0 +1,28 @@
diff --git a/Makefile b/Makefile
index 5a3bab7..fda6869 100644
--- a/Makefile
+++ b/Makefile
@@ -482,11 +482,22 @@ else ifeq ($(platform), miyoo)
CXX = /opt/miyoo/usr/bin/arm-linux-g++
AR = /opt/miyoo/usr/bin/arm-linux-ar
SHARED := -shared -nostdlib -Wl,--version-script=link.T
- fpic := -fPIC -DPIC
+ fpic := -fno-PIC
CFLAGS += -fomit-frame-pointer -ffast-math -march=armv5te -mtune=arm926ej-s
CFLAGS += -DSMALL_TRANSLATION_CACHE
HAVE_DYNAREC := 1
CPU_ARCH := arm
+ CFLAGS += -Ofast \
+ -flto=4 -fwhole-program -fuse-linker-plugin \
+ -fdata-sections -ffunction-sections -Wl,--gc-sections \
+ -fno-stack-protector -fno-ident -fomit-frame-pointer \
+ -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
+ -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
+ -fmerge-all-constants -fno-math-errno \
+ -marm
+ ASFLAGS += $(CFLAGS)
+ ARCH = arm
+ MMAP_JIT_CACHE = 1
# Windows
else

View File

@@ -1,7 +1,16 @@
diff --git a/Makefile b/Makefile
index 4786a922..c5029c00 100644
index 4786a922..e27ec29b 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ else
ifeq ($(platform), $(filter $(platform), vita ctr))
CFLAGS += -O3 -DNDEBUG
else
-CFLAGS += -O2 -DNDEBUG
+CFLAGS += -O3 -DNDEBUG
endif
endif
ifeq ($(DEBUG_ASAN), 1)
@@ -231,20 +231,20 @@ CFLAGS += -DTHREAD_RENDERING
OBJS += plugins/gpulib/gpulib_thread_if.o
endif
@@ -23,29 +32,43 @@ index 4786a922..c5029c00 100644
OBJS += plugins/gpulib/gpulib_thread_if.o
endif
-plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -O3
+plugins/gpu_unai_old/gpulib_if.o: CFLAGS += -DREARMED -O3
+plugins/gpu_unai_old/gpulib_if.o: CFLAGS += -DREARMED -Ofast
CC_LINK = $(CXX)
endif
diff --git a/Makefile.libretro b/Makefile.libretro
index 1169d892..99fb3870 100644
index 1169d892..144601b3 100644
--- a/Makefile.libretro
+++ b/Makefile.libretro
@@ -532,11 +532,11 @@ else ifneq (,$(findstring armv,$(platform)))
@@ -532,13 +532,25 @@ else ifneq (,$(findstring armv,$(platform)))
else ifeq ($(platform), miyoo)
TARGET := $(TARGET_NAME)_libretro.so
- fpic := -fPIC
- CFLAGS += -mcpu=arm926ej-s -fsingle-precision-constant
+ fpic := -fno-PIC
+ CFLAGS += -mcpu=arm926ej-s -fsingle-precision-constant -Ofast -fdata-sections -ffunction-sections -fsingle-precision-constant -flto
+ CFLAGS += -mcpu=arm926ej-s -fsingle-precision-constant -Ofast -fdata-sections -ffunction-sections -fsingle-precision-constant
CFLAGS += -DGPU_UNAI_USE_INT_DIV_MULTINV -D_MIYOO
+ CFLAGS += -Ofast \
+ -flto=auto -fuse-linker-plugin \
+ -fno-stack-protector -fno-ident -fomit-frame-pointer \
+ -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
+ -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
+ -fmerge-all-constants -fno-math-errno \
+ -marm
+ CXXFLAGS += $(CFLAGS)
+ CPPFLAGS += $(CFLAGS)
+ ASFLAGS += $(CFLAGS)
+ THREAD_RENDERING := 1
ARCH = arm
- BUILTIN_GPU = unai
+ BUILTIN_GPU = unai_old
DYNAREC = ari64
HAVE_NEON = 0
+ BASE_ADDR_DYNAMIC := 1
# Emscripten
else ifeq ($(platform), emscripten)
diff --git a/plugins/gpu_unai_old/Makefile b/plugins/gpu_unai_old/Makefile
new file mode 100644
index 00000000..1f4b8bdb

View File

@@ -16,7 +16,7 @@ define LIBRETRO_PCSX_REARMED_BUILD_CMDS
CFLAGS="$(TARGET_CFLAGS) $(COMPILER_COMMONS_CFLAGS_SO)" \
CXXFLAGS="$(TARGET_CXXFLAGS) $(COMPILER_COMMONS_CXXFLAGS_SO)" \
LDFLAGS="$(TARGET_LDFLAGS) $(COMPILER_COMMONS_LDFLAGS_SO)" \
$(MAKE) CXX="$(TARGET_CXX)" CC="$(TARGET_CC)" AR="$(TARGET_AR)" -C $(@D) -f Makefile.libretro platform="$(RETROARCH_LIBRETRO_PLATFORM)" CPUFLAGS="-march=armv5tej -mtune=arm926ej-s"
$(MAKE) CXX="$(TARGET_CXX)" CC="$(TARGET_CC)" AR="$(TARGET_AR)" -C $(@D) -f Makefile.libretro platform="$(RETROARCH_LIBRETRO_PLATFORM)"
$(TARGET_STRIP) --strip-unneeded $(@D)/*_libretro.so
endef

View File

@@ -1,59 +0,0 @@
diff --git a/Makefile b/Makefile
index b6af83f..d6d5d83 100644
--- a/Makefile
+++ b/Makefile
@@ -250,14 +250,19 @@ else ifeq ($(platform), miyoo)
CC = /opt/miyoo/usr/bin/arm-linux-gcc
CXX = /opt/miyoo/usr/bin/arm-linux-g++
AR = /opt/miyoo/usr/bin/arm-linux-ar
- fpic := -fPIC
+ fpic :=
ARM_ASM = 1
ASM_CPU = 0
ASM_SPC700 = 0
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
- CFLAGS += -fomit-frame-pointer -ffast-math -fno-unroll-loops -flto -mcpu=arm926ej-s
- CFLAGS += -DFAST_ALIGNED_LSB_WORD_ACCESS
-
+ CFLAGS += -fomit-frame-pointer -ffast-math -flto -mcpu=arm926ej-s -Ofast
+ CFLAGS += -DFAST_ALIGNED_LSB_WORD_ACCESS \
+ -DDINGUX \
+ -DLSB_FIRST \
+ -DPSS_STYLE=1 \
+ -DHAVE_ASPRINTF \
+ -DFRAMESKIP \
+ -D_REENTRANT
# Windows MSVC 2010 x64
else ifeq ($(platform), windows_msvc2010_x64)
CC = cl.exe
@@ -396,7 +401,7 @@ LIBRETRO_DIR := ./libretro
ifeq ($(DEBUG), 1)
DEFINES += -O0 -g
else ifneq (,$(findstring msvc,$(platform)))
-DEFINES += -O2 -DNDEBUG=1
+DEFINES += -O3 -DNDEBUG=1
else
DEFINES += -O3 -DNDEBUG=1
endif
diff --git a/libretro/libretro_core_options.h b/libretro/libretro_core_options.h
index ad03eae..455debb 100644
--- a/libretro/libretro_core_options.h
+++ b/libretro/libretro_core_options.h
@@ -68,7 +68,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
{ "fixed_interval", "Fixed Interval" },
{ NULL, NULL },
},
- "disabled"
+ "auto"
},
{
"snes9x2002_frameskip_threshold",
@@ -133,7 +133,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
{ "enabled", NULL },
{ NULL, NULL },
},
- "enabled"
+ "disabled"
},
{
"snes9x2002_low_pass_filter",

View File

@@ -0,0 +1,117 @@
diff --git a/Makefile b/Makefile
index b6af83f..f9f146f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
DEBUG = 0
-LAGFIX = 1
+LAGFIX = 0
USE_OLD_COLOUR_OPS = 0
TARGET_NAME = snes9x2002
@@ -27,12 +27,12 @@ LIBS :=
ifeq ($(platform), unix)
TARGET := $(TARGET_NAME)_libretro.so
- fpic := -fPIC
+ fpic :=
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
CFLAGS += -fno-builtin -fno-exceptions
else ifeq ($(platform), osx)
TARGET := $(TARGET_NAME)_libretro.dylib
- fpic := -fPIC
+ fpic :=
SHARED := -dynamiclib
ifeq ($(CROSS_COMPILE),1)
@@ -45,7 +45,7 @@ else ifeq ($(platform), osx)
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
- fpic := -fPIC
+ fpic :=
SHARED := -dynamiclib
MINVERSION :=
@@ -72,7 +72,7 @@ else ifneq (,$(findstring ios,$(platform)))
CXXFLAGS += $(MINVERSION)
else ifeq ($(platform), tvos-arm64)
TARGET := $(TARGET_NAME)_libretro_tvos.dylib
- fpic := -fPIC
+ fpic :=
SHARED := -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk appletvos Path)
@@ -143,7 +143,7 @@ else ifeq ($(platform), wiiu)
# NESC, SNESC, C64 mini
else ifeq ($(platform),$(filter $(platform),classic_armv7_a7 unix-armv7-hardfloat-neon))
TARGET := $(TARGET_NAME)_libretro.so
- fpic := -fPIC
+ fpic :=
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
CFLAGS += -Ofast \
-flto=4 -fwhole-program -fuse-linker-plugin \
@@ -238,7 +238,7 @@ else ifeq ($(platform), gcw0)
CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
CXX = /opt/gcw0-toolchain/usr/bin/mipsel-linux-g++
AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
- fpic := -fPIC
+ fpic :=
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
CFLAGS += -std=c99 -fomit-frame-pointer -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
CFLAGS += -fno-builtin -fno-exceptions
@@ -250,14 +250,28 @@ else ifeq ($(platform), miyoo)
CC = /opt/miyoo/usr/bin/arm-linux-gcc
CXX = /opt/miyoo/usr/bin/arm-linux-g++
AR = /opt/miyoo/usr/bin/arm-linux-ar
- fpic := -fPIC
+ fpic :=
ARM_ASM = 1
ASM_CPU = 0
ASM_SPC700 = 0
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
- CFLAGS += -fomit-frame-pointer -ffast-math -fno-unroll-loops -flto -mcpu=arm926ej-s
- CFLAGS += -DFAST_ALIGNED_LSB_WORD_ACCESS
-
+ CFLAGS += -fomit-frame-pointer -ffast-math -flto -mcpu=arm926ej-s \
+ -Ofast -msoft-float -finline-limit=42 -fno-unroll-loops \
+ -fno-ipa-cp -fno-common -fno-stack-protector -fno-guess-branch-probability \
+ -fno-caller-saves -fno-regmove -flto=4 -fwhole-program -fuse-linker-plugin \
+ -fdata-sections -ffunction-sections -Wl,--gc-sections \
+ -fno-stack-protector -fno-ident -fomit-frame-pointer \
+ -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
+ -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
+ -fmerge-all-constants -fno-math-errno \
+ -marm
+ CFLAGS += -DFAST_ALIGNED_LSB_WORD_ACCESS \
+ -DDINGUX \
+ -DLSB_FIRST \
+ -DPSS_STYLE=1 \
+ -DHAVE_ASPRINTF \
+ -DFRAMESKIP \
+ -D_REENTRANT
# Windows MSVC 2010 x64
else ifeq ($(platform), windows_msvc2010_x64)
CC = cl.exe
@@ -396,7 +410,7 @@ LIBRETRO_DIR := ./libretro
ifeq ($(DEBUG), 1)
DEFINES += -O0 -g
else ifneq (,$(findstring msvc,$(platform)))
-DEFINES += -O2 -DNDEBUG=1
+DEFINES += -O3 -DNDEBUG=1
else
DEFINES += -O3 -DNDEBUG=1
endif
diff --git a/libretro/libretro_core_options.h b/libretro/libretro_core_options.h
index ad03eae..6876868 100644
--- a/libretro/libretro_core_options.h
+++ b/libretro/libretro_core_options.h
@@ -133,7 +133,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
{ "enabled", NULL },
{ NULL, NULL },
},
- "enabled"
+ "disabled"
},
{
"snes9x2002_low_pass_filter",

View File

@@ -11,10 +11,10 @@ LIBRETRO_SNES9X2002_LICENSE = COPYRIGHT
LIBRETRO_SNES9X2002_NON_COMMERCIAL = y
# Dynarec on all boards
LIBRETRO_SNES9X2002_SUPP_OPT=USE_DYNAREC=1
#LIBRETRO_SNES9X2002_SUPP_OPT=USE_DYNAREC=1
LIBRETRO_SNES9X2002_SUPP_OPT+=ARM_ASM=1
LIBRETRO_SNES9X2002_SUPP_CFLAGS+=-Wa,-mimplicit-it=thumb
#LIBRETRO_SNES9X2002_SUPP_OPT+=ARM_ASM=1
#LIBRETRO_SNES9X2002_SUPP_CFLAGS+=-Wa,-mimplicit-it=thumb
define LIBRETRO_SNES9X2002_BUILD_CMDS
$(SED) "s|-O2|-O3|g" $(@D)/Makefile