From 746146baf4cb036a63de67549f0bbf838ee291fa Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Fri, 17 Jan 2025 01:49:07 +0100 Subject: [PATCH] Disable mult/div and memset optimizations when debugging Lightrec These optimizations cause Lightrec's interpreter and dynarec to have different behaviours. Signed-off-by: Paul Cercueil --- Makefile | 3 ++- include/lightrec/lightrec-config.h | 4 ++-- jni/Android.mk | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ec07225e..e119c55c 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,8 @@ LIGHTREC_CODE_INV ?= 0 CFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP) \ -DLIGHTREC_CODE_INV=$(LIGHTREC_CODE_INV) \ -DLIGHTREC_ENABLE_THREADED_COMPILER=$(LIGHTREC_THREADED_COMPILER) \ - -DLIGHTREC_ENABLE_DISASSEMBLER=$(or $(LIGHTREC_DEBUG),0) + -DLIGHTREC_ENABLE_DISASSEMBLER=$(or $(LIGHTREC_DEBUG),0) \ + -DLIGHTREC_NO_DEBUG=$(if $(LIGHTREC_DEBUG),0,1) ifeq ($(LIGHTREC_CUSTOM_MAP),1) LDLIBS += -lrt OBJS += $(LIGHTREC_CUSTOM_MAP_OBJ) diff --git a/include/lightrec/lightrec-config.h b/include/lightrec/lightrec-config.h index 8453fe46..534472ef 100644 --- a/include/lightrec/lightrec-config.h +++ b/include/lightrec/lightrec-config.h @@ -14,14 +14,14 @@ #define HAS_DEFAULT_ELM 1 #define OPT_REMOVE_DIV_BY_ZERO_SEQ 1 -#define OPT_REPLACE_MEMSET 1 +#define OPT_REPLACE_MEMSET LIGHTREC_NO_DEBUG #define OPT_DETECT_IMPOSSIBLE_BRANCHES 1 #define OPT_HANDLE_LOAD_DELAYS 1 #define OPT_TRANSFORM_OPS 1 #define OPT_LOCAL_BRANCHES 1 #define OPT_SWITCH_DELAY_SLOTS 1 #define OPT_FLAG_IO 1 -#define OPT_FLAG_MULT_DIV 1 +#define OPT_FLAG_MULT_DIV LIGHTREC_NO_DEBUG #define OPT_EARLY_UNLOAD 1 #define OPT_PRELOAD_PC 1 diff --git a/jni/Android.mk b/jni/Android.mk index 0fe5cb95..222e870b 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -134,7 +134,6 @@ HAVE_ARI64=0 HAVE_LIGHTREC=0 LIGHTREC_CUSTOM_MAP=0 LIGHTREC_THREADED_COMPILER=0 -LIGHTREC_DEBUG=0 HAVE_GPU_NEON=0 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) HAVE_ARI64=1 @@ -156,6 +155,7 @@ endif COREFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP) COREFLAGS += -DLIGHTREC_ENABLE_THREADED_COMPILER=$(LIGHTREC_THREADED_COMPILER) COREFLAGS += -DLIGHTREC_ENABLE_DISASSEMBLER=$(or $(LIGHTREC_DEBUG),0) + COREFLAGS += -DLIGHTREC_NO_DEBUG=$(if $(LIGHTREC_DEBUG),0,1) ifeq ($(HAVE_ARI64),1) SOURCES_C += $(DYNAREC_DIR)/new_dynarec.c \ -- 2.39.5