Skip to content

Commit

Permalink
Optimize retroarch cores: fceumm, mame2000, snes9x2002, tyrquake
Browse files Browse the repository at this point in the history
  • Loading branch information
tiopex committed Jan 10, 2024
1 parent eb3ab10 commit c4305fb
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 5 deletions.
18 changes: 18 additions & 0 deletions package/libretro-fceumm/0001-optimize-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/Makefile.libretro b/Makefile.libretro
index 522bd06..152101c 100644
--- a/Makefile.libretro
+++ b/Makefile.libretro
@@ -458,9 +458,11 @@ 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 :=
SHARED := -shared -Wl,--version-script=src/libretro/link.T -Wl,-no-undefined
- PLATFORM_DEFINES += -fomit-frame-pointer -ffast-math -mcpu=arm926ej-s
+ PLATFORM_DEFINES += -mcpu=arm926ej-s -Wno-write-strings -Wno-sign-compare -fomit-frame-pointer -fno-builtin -fno-common -fpermissive -Ofast -flto -fomit-frame-pointer -fno-builtin \
+ -fno-common -Wno-write-strings -Wno-sign-compare -ffast-math -ftree-vectorize \
+ -funswitch-loops -fno-strict-aliasing
EXTERNAL_ZLIB = 1

# Windows MSVC 2017 all architectures
6 changes: 3 additions & 3 deletions package/libretro-fceumm/libretro-fceumm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
#
################################################################################

# Commit of 2023/09/16
LIBRETRO_FCEUMM_VERSION = 7fad08e5522e5396a1196055fc106be9b5d5de77
# Commit of 2024/01/08
LIBRETRO_FCEUMM_VERSION = 20efbf049918a1000e43fb240fba57ed70887581
LIBRETRO_FCEUMM_SITE = $(call github,libretro,libretro-fceumm,$(LIBRETRO_FCEUMM_VERSION))
LIBRETRO_FCEUMM_LICENSE = GPL-2.0
LIBRETRO_FCEUMM_LICENSE_FILES = Copying

define LIBRETRO_FCEUMM_BUILD_CMDS

$(SED) "s|-O2|-O3|g" $(@D)/Makefile
CFLAGS="$(TARGET_CFLAGS) $(COMPILER_COMMONS_CFLAGS_SO)" \
CXXFLAGS="$(TARGET_CXXFLAGS) $(COMPILER_COMMONS_CXXFLAGS_SO)" \
LDFLAGS="$(TARGET_LDFLAGS) $(COMPILER_COMMONS_LDFLAGS_SO)" \
Expand Down
18 changes: 18 additions & 0 deletions package/libretro-mame2000/0001-optimize-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/Makefile b/Makefile
index 64d8115..4dcf9d7 100644
--- a/Makefile
+++ b/Makefile
@@ -327,11 +327,11 @@ else ifeq ($(platform), miyoo)
TARGET := $(TARGET_NAME)_libretro.so
CC = /opt/miyoo/usr/bin/arm-linux-gcc
AR = /opt/miyoo/usr/bin/arm-linux-ar
- fpic := -fPIC
+ fpic :=
SHARED := -shared -Wl,--version-script=link.T -Wl,-no-undefined

DISABLE_ERROR_LOGGING := 1
- CFLAGS += -fomit-frame-pointer -ffast-math -march=armv5te -mtune=arm926ej-s
+ CFLAGS += -fomit-frame-pointer -ffast-math -mcpu=arm926ej-s -Ofast -fdata-sections -ffunction-sections -fsingle-precision-constant -flto
ARM = 1
USE_CYCLONE = 1
USE_DRZ80 = 1
4 changes: 2 additions & 2 deletions package/libretro-mame2000/libretro-mame2000.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#
################################################################################

# Commit of 2023/04/25
LIBRETRO_MAME2000_VERSION = 720b8ad4cbd76abd57b9aeced9ba541dc8476f7f
# Commit of 2023/11/01
LIBRETRO_MAME2000_VERSION = 1472da3a39ab14fff8325b1f51a1dfdb8eabb5c8
LIBRETRO_MAME2000_SITE = $(call github,libretro,mame2000-libretro,$(LIBRETRO_MAME2000_VERSION))
LIBRETRO_MAME2000_LICENSE = MAME
LIBRETRO_MAME2000_NON_COMMERCIAL = y
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/Makefile b/Makefile
index b6af83f..fa12a6d 100644
--- a/Makefile
+++ b/Makefile
@@ -250,12 +250,12 @@ 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 += -fomit-frame-pointer -ffast-math -fno-unroll-loops -flto -mcpu=arm926ej-s -fno-unroll-loops -fno-common -fno-stack-protector -fexpensive-optimizations
CFLAGS += -DFAST_ALIGNED_LSB_WORD_ACCESS

# Windows MSVC 2010 x64
@@ -396,7 +396,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..db3ac50 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",
16 changes: 16 additions & 0 deletions package/libretro-tyrquake/0001-optimize-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/Makefile b/Makefile
index ef82d42..bb51b40 100644
--- a/Makefile
+++ b/Makefile
@@ -232,9 +232,9 @@ else ifeq ($(platform), miyoo)
TARGET := $(TARGET_NAME)_libretro.so
CC = /opt/miyoo/usr/bin/arm-linux-gcc
AR = /opt/miyoo/usr/bin/arm-linux-ar
- fpic := -fPIC
+ fpic :=
SHARED := -shared -Wl,--version-script=common/libretro-link.T
- CFLAGS += -DDINGUX -D_MIYOO -fomit-frame-pointer -ffast-math -mcpu=arm926ej-s
+ CFLAGS += -DDINGUX -D_MIYOO -fomit-frame-pointer -ffast-math -mcpu=arm926ej-s -Ofast -fdata-sections -ffunction-sections -fsingle-precision-constant -flto -marm -DARM
HAVE_NETWORKING=0

# Raspberry Pi 1

0 comments on commit c4305fb

Please sign in to comment.