From 47f61920049a19c9caecd2bb327cbb50ae0b36d8 Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Thu, 1 Apr 2010 05:10:39 +0000 Subject: [PATCH] add two paths to addx in JIT that Crazy Taxi kept hitting, add 'add' and 'add.' tests to the ASM test, although I haven't tested it yet git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5261 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/Src/PowerPC/Jit64/Jit_Integer.cpp | 25 +++++++++++++++++++ Source/TestSuite/ASM/source/Instructions.h | 2 ++ Source/TestSuite/ASM/source/asm_integer.cpp | 19 ++++++++++++++ Source/TestSuite/ASM/source/asm_tables.h | 2 ++ 4 files changed, 48 insertions(+) diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp index 985998b547..15943c1a06 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp @@ -626,6 +626,31 @@ void Jit64::addx(UGeckoInstruction inst) } gpr.UnlockAll(); } + else if( a == b && b == d && a == d) + { + gpr.Lock(d); + gpr.LoadToX64(d, true); + ADD(32, gpr.R(d), gpr.R(d)); + if (inst.Rc) + { + MOV(32, R(EAX), gpr.R(d)); + CALL((u8*)asm_routines.computeRc); + } + gpr.UnlockAll(); + } + else if( a == b && b != d) + { + gpr.Lock(a, d); + gpr.LoadToX64(d, false); + MOV(32, gpr.R(d), gpr.R(a)); + ADD(32, gpr.R(d), gpr.R(d)); + if (inst.Rc) + { + MOV(32, R(EAX), gpr.R(d)); + CALL((u8*)asm_routines.computeRc); + } + gpr.UnlockAll(); + } else { Default(inst); return; diff --git a/Source/TestSuite/ASM/source/Instructions.h b/Source/TestSuite/ASM/source/Instructions.h index 7ff5c52b81..e4eb8374b0 100644 --- a/Source/TestSuite/ASM/source/Instructions.h +++ b/Source/TestSuite/ASM/source/Instructions.h @@ -1,5 +1,7 @@ // Integer +void add(u32 *a, u32 *b, u32 *c, u32 *d); +void addRC(u32 *a, u32 *b, u32 *c, u32 *d); void subfc(u32 *a, u32 *b, u32 *c, u32 *d); void subfcRC(u32 *a, u32 *b, u32 *c, u32 *d); diff --git a/Source/TestSuite/ASM/source/asm_integer.cpp b/Source/TestSuite/ASM/source/asm_integer.cpp index 2f7891c40b..ed81832a5b 100644 --- a/Source/TestSuite/ASM/source/asm_integer.cpp +++ b/Source/TestSuite/ASM/source/asm_integer.cpp @@ -1,5 +1,24 @@ #include "asm_tables.h" #include "Defines.h" + +void add(u32 *a, u32 *b, u32 *c, u32 *d) +{ + asm( + "add %0,%1,%2" + : "=r"(*a) + : "r"(*b), "r"(*c) + ); +} +void addRC(u32 *a, u32 *b, u32 *c, u32 *d) +{ + asm( + "add. %0,%1,%2" + : "=r"(*a) + : "r"(*b), "r"(*c) + : "cc" + ); +} + void subfc(u32 *a, u32 *b, u32 *c, u32 *d) { asm( diff --git a/Source/TestSuite/ASM/source/asm_tables.h b/Source/TestSuite/ASM/source/asm_tables.h index abe854f205..1c8e35ba53 100644 --- a/Source/TestSuite/ASM/source/asm_tables.h +++ b/Source/TestSuite/ASM/source/asm_tables.h @@ -36,6 +36,8 @@ struct inst }; static inst instructions[] = { + { "add", NULL, 3, IO_ARG1 | IO_ARG2 | IO_ARG3, IO_ARG1,TYPE_INTEGER, add}, + { "add.", MOD_CR0, 3, IO_ARG1 | IO_ARG2 | IO_ARG3, IO_ARG1,TYPE_INTEGER, add}, { "subfc", NULL, 3, IO_ARG1 | IO_ARG2 | IO_ARG3, IO_ARG1,TYPE_INTEGER, subfc}, { "subfc.", MOD_CR0, 3, IO_ARG1 | IO_ARG2 | IO_ARG3, IO_ARG1,TYPE_INTEGER, subfcRC}, { "divw", NULL, 3, IO_ARG1 | IO_ARG2 | IO_ARG3, IO_ARG1, TYPE_INTEGER, divw},