From 1d59351c03a1f0d8cc3f53f5c771232bf406db65 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 16 Jul 2023 03:43:54 +0200 Subject: [PATCH] Some MMX optimizations. --- src/cpu/CMakeLists.txt | 2 +- src/cpu/cpu.c | 1 + src/cpu/cpu.h | 5 +++++ src/cpu/x86_ops_mmx.h | 7 +++---- src/win/Makefile.mingw | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/cpu/CMakeLists.txt b/src/cpu/CMakeLists.txt index d1011504e..e4d8e71b2 100644 --- a/src/cpu/CMakeLists.txt +++ b/src/cpu/CMakeLists.txt @@ -14,7 +14,7 @@ # add_library(cpu OBJECT cpu.c cpu_table.c fpu.c x86.c 808x.c 386.c 386_common.c - 386_dynarec.c x86seg.c x87.c x87_timings.c 8080.c) + 386_dynarec.c x86_ops_mmx.c x86seg.c x87.c x87_timings.c 8080.c) if(AMD_K5) target_compile_definitions(cpu PRIVATE USE_AMD_K5) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 257d23845..d633b9bb2 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -1646,6 +1646,7 @@ cpu_set(void) cpu_exec = exec386; else cpu_exec = execx86; + mmx_init(); gdbstub_cpu_init(); } diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 692600005..3d6d0622a 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -850,4 +850,9 @@ extern void cpu_fast_off_reset(void); extern void smi_raise(void); extern void nmi_raise(void); +extern MMX_REG *MMP[8]; +extern uint16_t *MMEP[8]; + +extern void mmx_init(void); + #endif /*EMU_CPU_H*/ diff --git a/src/cpu/x86_ops_mmx.h b/src/cpu/x86_ops_mmx.h index 9706b206c..47751d059 100644 --- a/src/cpu/x86_ops_mmx.h +++ b/src/cpu/x86_ops_mmx.h @@ -3,12 +3,11 @@ #define USATB(val) (((val) < 0) ? 0 : (((val) > 255) ? 255 : (val))) #define USATW(val) (((val) < 0) ? 0 : (((val) > 65535) ? 65535 : (val))) -#define MMX_GETREGP(r) fpu_softfloat ? ((MMX_REG *) &fpu_state.st_space[r].fraction) : &(cpu_state.MM[r]) -#define MMX_GETREG(r) fpu_softfloat ? (*(MMX_REG *) &fpu_state.st_space[r].fraction) : cpu_state.MM[r] +#define MMX_GETREGP(r) MMP[r] +#define MMX_GETREG(r) *(MMP[r]) #define MMX_SETEXP(r) \ - if (fpu_softfloat) \ - fpu_state.st_space[r].exp = 0xffff + *(MMEP[r]) = 0xffff #define MMX_GETSRC() \ if (cpu_mod == 3) { \ diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index c5f6c61ce..55306e8d8 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -553,7 +553,7 @@ CPUOBJ := $(DYNARECOBJ) \ $(CGTOBJ) \ cpu.o cpu_table.o fpu.o x86.o \ 8080.o 808x.o 386.o 386_common.o 386_dynarec.o 386_dynarec_ops.o \ - x86seg.o x87.o x87_timings.o \ + x86_ops_mmx.o x86seg.o x87.o x87_timings.o \ f2xm1.o fpatan.o fprem.o fsincos.o fyl2x.o softfloat_poly.o softfloat.o softfloat16.o \ softfloat-muladd.o softfloat-round-pack.o softfloat-specialize.o softfloatx80.o