X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Makefile.libretro;h=cf8e08070314753abd66541972d4ac9f0f6cf5b8;hb=657d141e82b111e6719f499677e035cb443df537;hp=e9df3455dedf3684ffd3489fb8bea7a989238a6b;hpb=07ade526c4a0b1ddb316aff1459c1bdff31c267a;p=pcsx_rearmed.git diff --git a/Makefile.libretro b/Makefile.libretro index e9df3455..cf8e0807 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -46,6 +46,23 @@ LIBM := -lm MMAP_WIN32 = 0 EXTRA_LDFLAGS = +# select some defaults +ifneq (,$(findstring $(ARCH_DETECTED),arm aarch64)) + DYNAREC = ari64 +ifneq ($(findstring __thumb__,$(shell $(CC) -E -dD $(CFLAGS) include/arm_features.h)),) + # must disable thumb as ari64 can't handle it + CFLAGS += -marm +endif +ifneq ($(findstring __ARM_NEON,$(shell $(CC) -E -dD $(CFLAGS) include/arm_features.h)),) + BUILTIN_GPU = neon +endif +endif +ifneq (,$(findstring $(ARCH_DETECTED),i686 x86_64 aarch64)) + BUILTIN_GPU = neon +endif + +# platform specific options + # Unix ifeq ($(platform), unix) TARGET := $(TARGET_NAME)_libretro.so @@ -57,14 +74,6 @@ endif ifneq ($(findstring SunOS,$(shell uname -s)),) CC = gcc endif -ifneq (,$(findstring $(ARCH_DETECTED),arm aarch64)) - DYNAREC = ari64 - -ifneq ($(findstring __thumb__,$(shell $(CC) -E -dD $(CFLAGS) include/arm_features.h)),) - # must disable thumb as ari64 can't handle it - CFLAGS += -marm -endif -endif # ODROIDN2 else ifneq (,$(findstring CortexA73_G12B,$(platform))) @@ -72,6 +81,8 @@ else ifneq (,$(findstring CortexA73_G12B,$(platform))) fpic := -fPIC SHARED := -shared -Wl,-version-script=link.T ARCH = arm64 + BUILTIN_GPU = neon + HAVE_NEON = 1 DYNAREC = ari64 CFLAGS += -fomit-frame-pointer -ffast-math -DARM CPUFLAGS += -march=armv8-a+crc -mfpu=neon-fp-armv8 -mcpu=cortex-a73 -mtune=cortex-a73.cortex-a53 @@ -82,6 +93,8 @@ else ifneq (,$(findstring h5,$(platform))) fpic := -fPIC SHARED := -shared -Wl,-version-script=link.T ARCH = arm64 + BUILTIN_GPU = neon + HAVE_NEON = 1 DYNAREC = ari64 CFLAGS += -fomit-frame-pointer -ffast-math -DARM CPUFLAGS += -march=armv8-a+crc -mfpu=neon-fp-armv8 -mcpu=cortex-a53 -mtune=cortex-a53 @@ -141,8 +154,8 @@ ifeq ($(platform),ios-arm64) CC = cc -arch arm64 -isysroot $(IOSSDK) CXX = c++ -arch arm64 -isysroot $(IOSSDK) ARCH := arm64 - HAVE_NEON = 0 - BUILTIN_GPU = peops + BUILTIN_GPU = neon + HAVE_NEON = 1 DYNAREC = 0 else CC = cc -arch armv7 -isysroot $(IOSSDK) @@ -175,12 +188,12 @@ endif IOSSDK := $(shell xcodebuild -version -sdk appletvos Path) endif - CFLAGS += -DIOS -DTVOS -marm + CFLAGS += -DIOS -DTVOS CC = cc -arch arm64 -isysroot $(IOSSDK) CXX = c++ -arch arm64 -isysroot $(IOSSDK) ARCH := arm64 - HAVE_NEON = 0 - BUILTIN_GPU = peops + BUILTIN_GPU = neon + HAVE_NEON = 1 DYNAREC = 0 CC_AS = perl ./tools/gas-preprocessor.pl $(CC) @@ -190,7 +203,6 @@ else ifeq ($(platform), libnx) include $(DEVKITPRO)/libnx/switch_rules TARGET := $(TARGET_NAME)_libretro_$(platform).a ARCH := arm64 - BUILTIN_GPU = unai HAVE_VFS_FD = 0 CFLAGS += -O3 -fomit-frame-pointer -ffast-math -I$(DEVKITPRO)/libnx/include/ -fPIE -Wl,--allow-multiple-definition # -include $(LIBNX)/include/switch.h CFLAGS += -specs=$(DEVKITPRO)/libnx/switch.specs -DNO_OS -DNO_DYLIB -DNO_SOCKET -D__arm64__ -D__ARM_NEON__ @@ -200,14 +212,17 @@ else ifeq ($(platform), libnx) CFLAGS += -Ifrontend/switch -ftree-vectorize LIBPTHREAD := STATIC_LINKING=1 + BUILTIN_GPU = neon + HAVE_NEON = 1 DYNAREC = ari64 # Lakka Switch (arm64) else ifeq ($(platform), arm64) TARGET := $(TARGET_NAME)_libretro.so ARCH := arm64 + BUILTIN_GPU = neon + HAVE_NEON = 1 DYNAREC = ari64 - BUILTIN_GPU = unai fpic := -fPIC CFLAGS := $(filter-out -O2, $(CFLAGS)) CFLAGS += -O3 -ftree-vectorize @@ -351,7 +366,8 @@ else ifeq ($(platform), rpi3) else ifeq ($(platform), rpi3_64) TARGET := $(TARGET_NAME)_libretro.so ARCH := arm64 - BUILTIN_GPU = unai + BUILTIN_GPU = neon + HAVE_NEON = 1 DYNAREC = ari64 fpic := -fPIC CFLAGS += -march=armv8-a+crc+simd -mtune=cortex-a53 -ftree-vectorize @@ -372,8 +388,9 @@ else ifeq ($(platform), rpi4) else ifeq ($(platform), rpi4_64) TARGET := $(TARGET_NAME)_libretro.so ARCH := arm64 - BUILTIN_GPU = unai - DYNAREC = ari64 + BUILTIN_GPU = neon + HAVE_NEON = 1 + DYNAREC = ari64 fpic := -fPIC CFLAGS += -march=armv8-a+crc+simd -mtune=cortex-a72 -ftree-vectorize @@ -487,7 +504,6 @@ else ifeq ($(platform), emscripten) # Windows else TARGET := $(TARGET_NAME)_libretro.dll - BUILTIN_GPU = peops PLATFORM = libretro MAIN_LDFLAGS += -static-libgcc -static-libstdc++ -s CFLAGS += -D__WIN32__ -DNO_DYLIB @@ -512,8 +528,9 @@ endif ifndef ARCH ARCH = $(ARCH_DETECTED) endif -ifndef HAVE_NEON -HAVE_NEON = $(shell $(CC) -E -dD - < /dev/null 2> /dev/null | grep -q __ARM_NEON__ && echo 1 || echo 0) +ifndef HAVE_NEON_ASM +# asm for 32bit only +HAVE_NEON_ASM = $(shell $(CC) -E -dD $(CFLAGS) include/arm_features.h | grep -q HAVE_NEON32 && echo 1 || echo 0) endif ifeq ($(NO_UNDEF_CHECK)$(shell ld -v 2> /dev/null | awk '{print $$1}'),GNU) MAIN_LDFLAGS += -Wl,--no-undefined @@ -521,6 +538,15 @@ endif ifdef ALLOW_LIGHTREC_ON_ARM CFLAGS += -DALLOW_LIGHTREC_ON_ARM endif +ifeq ($(BUILTIN_GPU),neon) +ifneq (,$(findstring $(ARCH),x86 i686)) + CFLAGS_GPU_NEON ?= -msse2 # required +endif +ifeq ($(ARCH),x86_64) + CFLAGS_GPU_NEON ?= -mssse3 # optional, for more perf +endif +CFLAGS += $(CFLAGS_GPU_NEON) +endif TARGET ?= libretro.so PLATFORM = libretro @@ -538,6 +564,16 @@ NO_CONFIG_MAK = yes #endif #endif +$(info TARGET: $(TARGET)) +$(info platform: $(platform)) +$(info ARCH: $(ARCH)) +$(info DYNAREC: $(DYNAREC)) +$(info BUILTIN_GPU: $(BUILTIN_GPU)) +$(info CC: $(CC)) +$(info CFLAGS: $(CFLAGS)) +$(info MAIN_LDLIBS: $(MAIN_LDLIBS)) +$(info ) + include Makefile # no special AS needed for gpu_neon