From a4bb9eaa55c28e0270c6b9d23abfe132d1f9c8b7 Mon Sep 17 00:00:00 2001 From: S Gopal Rajagopal Date: Mon, 15 Sep 2014 20:03:06 +0530 Subject: [PATCH] Made changes so that the recompiler output may be verfied against that of the interpreter. This seems to be a better strategy for testing the recompiler. The best strategy would be to verify its output against a real PPU core but I dont have access to one. --- rpcs3/Emu/Cell/PPUInterpreter.h | 1 + rpcs3/Emu/Cell/PPULLVMRecompiler.cpp | 979 +++++++++---------- rpcs3/Emu/Cell/PPULLVMRecompiler.h | 56 +- rpcs3/Emu/Cell/PPULLVMRecompilerTests.cpp | 1043 +++++---------------- rpcs3/stdafx.h | 1 + 5 files changed, 714 insertions(+), 1366 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index 5431a99fee..037256de9a 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -432,6 +432,7 @@ private: } // Bit n°2 of CR6 + CPU.SetCR(6, 0); CPU.SetCRBit(6, 0x2, allInBounds); } void VCMPEQFP(u32 vd, u32 va, u32 vb) diff --git a/rpcs3/Emu/Cell/PPULLVMRecompiler.cpp b/rpcs3/Emu/Cell/PPULLVMRecompiler.cpp index 33f6dcdafc..318ebe2a4f 100644 --- a/rpcs3/Emu/Cell/PPULLVMRecompiler.cpp +++ b/rpcs3/Emu/Cell/PPULLVMRecompiler.cpp @@ -8,6 +8,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/IR/Intrinsics.h" +#include "llvm/Support/Filesystem.h" using namespace llvm; @@ -15,20 +16,37 @@ PPULLVMRecompiler::PPULLVMRecompiler(PPUThread & ppu) : m_ppu(ppu) , m_decoder(this) , m_ir_builder(m_llvm_context) - , m_interpreter(ppu) { + , m_interpreter(ppu) + , m_compilation_time(0.0) + , m_execution_time(0.0) { InitializeNativeTarget(); InitializeNativeTargetAsmPrinter(); InitializeNativeTargetDisassembler(); m_module = new llvm::Module("Module", m_llvm_context); - m_pc = new GlobalVariable(*m_module, Type::getInt64Ty(m_llvm_context), false, GlobalValue::ExternalLinkage, nullptr, "pc"); - m_gpr = new GlobalVariable(*m_module, ArrayType::get(Type::getInt64Ty(m_llvm_context), 32), false, GlobalValue::ExternalLinkage, nullptr, "gpr"); - m_cr = new GlobalVariable(*m_module, Type::getInt32Ty(m_llvm_context), false, GlobalValue::ExternalLinkage, nullptr, "cr"); - m_xer = new GlobalVariable(*m_module, Type::getInt64Ty(m_llvm_context), false, GlobalValue::ExternalLinkage, nullptr, "xer"); - m_vpr = new GlobalVariable(*m_module, ArrayType::get(Type::getIntNTy(m_llvm_context, 128), 32), false, GlobalValue::ExternalLinkage, nullptr, "vpr"); - m_vscr = new GlobalVariable(*m_module, Type::getInt32Ty(m_llvm_context), false, GlobalValue::ExternalLinkage, nullptr, "vscr"); - m_execution_engine = EngineBuilder(m_module).create(); + std::vector execute_this_call_fn_args; + execute_this_call_fn_args.push_back(Type::getInt64PtrTy(m_llvm_context)); + auto execute_this_call_fn_type = FunctionType::get(Type::getVoidTy(m_llvm_context), execute_this_call_fn_args, false); + + m_execute_this_call_fn = Function::Create(execute_this_call_fn_type, GlobalValue::ExternalLinkage, "ExecuteThisCall", m_module); + m_execute_this_call_fn->setCallingConv(CallingConv::X86_64_Win64); + m_execute_this_call_fn_comment_md_node = MDNode::get(m_llvm_context, MDString::get(m_llvm_context, "Comment")); + + m_pc = new GlobalVariable(*m_module, Type::getInt64Ty(m_llvm_context), false, GlobalValue::ExternalLinkage, nullptr, "pc"); + m_gpr = new GlobalVariable(*m_module, ArrayType::get(Type::getInt64Ty(m_llvm_context), 32), false, GlobalValue::ExternalLinkage, nullptr, "gpr"); + m_cr = new GlobalVariable(*m_module, Type::getInt32Ty(m_llvm_context), false, GlobalValue::ExternalLinkage, nullptr, "cr"); + m_xer = new GlobalVariable(*m_module, Type::getInt64Ty(m_llvm_context), false, GlobalValue::ExternalLinkage, nullptr, "xer"); + m_vpr = new GlobalVariable(*m_module, ArrayType::get(Type::getIntNTy(m_llvm_context, 128), 32), false, GlobalValue::ExternalLinkage, nullptr, "vpr"); + m_vscr = new GlobalVariable(*m_module, Type::getInt32Ty(m_llvm_context), false, GlobalValue::ExternalLinkage, nullptr, "vscr"); + + EngineBuilder engine_builder(m_module); + engine_builder.setMCPU(sys::getHostCPUName()); + engine_builder.setEngineKind(EngineKind::JIT); + engine_builder.setOptLevel(CodeGenOpt::Default); + + m_execution_engine = engine_builder.create(); + m_execution_engine->addGlobalMapping(m_execute_this_call_fn, (void *)&PPULLVMRecompiler::ExecuteThisCall); m_execution_engine->addGlobalMapping(m_pc, &m_ppu.PC); m_execution_engine->addGlobalMapping(m_gpr, m_ppu.GPR); m_execution_engine->addGlobalMapping(m_cr, &m_ppu.CR); @@ -38,23 +56,33 @@ PPULLVMRecompiler::PPULLVMRecompiler(PPUThread & ppu) m_disassembler = LLVMCreateDisasm(sys::getProcessTriple().c_str(), nullptr, 0, nullptr, nullptr); - // RunAllTests(); + //RunAllTests(); } PPULLVMRecompiler::~PPULLVMRecompiler() { + for (auto i = m_this_call_ptrs_list.begin(); i != m_this_call_ptrs_list.end(); i++) { + delete *i; + } + + std::string error; + raw_fd_ostream log_file(fmt::Format("PPULLVMRecompiler_%d.log", m_ppu.GetId()).c_str(), error, sys::fs::F_Text); + log_file << "Time spent compiling = " << m_compilation_time.count() << "s\n"; + log_file << "Time spent executing = " << m_execution_time.count() << "s\n\n"; + log_file << "Interpreter invocation stats:\n"; + for (auto i = m_interpreter_invocation_stats.begin(); i != m_interpreter_invocation_stats.end(); i++) { + log_file << i->first << " = " << i->second << "\n"; + } + + log_file << "\nLLVM IR:\n"; + log_file << *m_module; + LLVMDisasmDispose(m_disassembler); delete m_execution_engine; - llvm_shutdown(); + //llvm_shutdown(); } -static std::string module; -static std::string registers; -static u64 lastAddress; -static std::chrono::duration compilation_time; -static std::chrono::duration execution_time; - u8 PPULLVMRecompiler::DecodeMemory(const u64 address) { - auto function_name = fmt::Format("fn_0x%llx", address); + auto function_name = fmt::Format("fn_0x%llX", address); auto function = m_module->getFunction(function_name); if (!function) { @@ -75,14 +103,10 @@ u8 PPULLVMRecompiler::DecodeMemory(const u64 address) { } m_ir_builder.CreateRetVoid(); - m_execution_engine->runJITOnFunction(function); - //module = ""; - //raw_string_ostream stream(module); - //stream << *m_module; std::chrono::high_resolution_clock::time_point compilation_end = std::chrono::high_resolution_clock::now(); - compilation_time += std::chrono::duration_cast>(compilation_end - compilation_start); + m_compilation_time += std::chrono::duration_cast>(compilation_end - compilation_start); } //lastAddress = address; @@ -91,24 +115,24 @@ u8 PPULLVMRecompiler::DecodeMemory(const u64 address) { std::vector args; m_execution_engine->runFunction(function, args); std::chrono::high_resolution_clock::time_point execution_end = std::chrono::high_resolution_clock::now(); - execution_time += std::chrono::duration_cast>(execution_end - execution_start); + m_execution_time += std::chrono::duration_cast>(execution_end - execution_start); return 0; } void PPULLVMRecompiler::NULL_OP() { - ThisCall0("NULL_OP", &PPUInterpreter::NULL_OP, &m_interpreter); + ThisCall("NULL_OP", &PPUInterpreter::NULL_OP, &m_interpreter); } void PPULLVMRecompiler::NOP() { - + ThisCall("NOP", &PPUInterpreter::NOP, &m_interpreter); } void PPULLVMRecompiler::TDI(u32 to, u32 ra, s32 simm16) { - ThisCall3("TDI", &PPUInterpreter::TDI, &m_interpreter, to, ra, simm16); + ThisCall("TDI", &PPUInterpreter::TDI, &m_interpreter, to, ra, simm16); } void PPULLVMRecompiler::TWI(u32 to, u32 ra, s32 simm16) { - ThisCall3("TWI", &PPUInterpreter::TWI, &m_interpreter, to, ra, simm16); + ThisCall("TWI", &PPUInterpreter::TWI, &m_interpreter, to, ra, simm16); } void PPULLVMRecompiler::MFVSCR(u32 vd) { @@ -120,6 +144,7 @@ void PPULLVMRecompiler::MFVSCR(u32 vd) { void PPULLVMRecompiler::MTVSCR(u32 vb) { auto vb_v4i32 = GetVrAsIntVec(vb, 32); auto vscr_i32 = m_ir_builder.CreateExtractElement(vb_v4i32, m_ir_builder.getInt32(0)); + vscr_i32 = m_ir_builder.CreateAnd(vscr_i32, 0x00010001); m_ir_builder.CreateStore(vscr_i32, m_vscr); } @@ -393,7 +418,7 @@ void PPULLVMRecompiler::VCMPBFP_(u32 vd, u32 va, u32 vb) { void PPULLVMRecompiler::VCMPEQFP(u32 vd, u32 va, u32 vb) { auto va_v4f32 = GetVrAsFloatVec(va); - auto vb_v4f32 = GetVrAsFloatVec(vb); + auto vb_v4f32 = GetVrAsFloatVec(vb); auto cmp_v4i1 = m_ir_builder.CreateFCmpOEQ(va_v4f32, vb_v4f32); auto cmp_v4i32 = m_ir_builder.CreateSExt(cmp_v4i1, VectorType::get(Type::getInt32Ty(m_llvm_context), 4)); SetVr(vd, cmp_v4i32); @@ -548,442 +573,442 @@ void PPULLVMRecompiler::VCMPGTUW_(u32 vd, u32 va, u32 vb) { } void PPULLVMRecompiler::VCTSXS(u32 vd, u32 uimm5, u32 vb) { - ThisCall3("VCTSXS", &PPUInterpreter::VCTSXS, &m_interpreter, vd, uimm5, vb); + ThisCall("VCTSXS", &PPUInterpreter::VCTSXS, &m_interpreter, vd, uimm5, vb); } void PPULLVMRecompiler::VCTUXS(u32 vd, u32 uimm5, u32 vb) { - ThisCall3("VCTUXS", &PPUInterpreter::VCTUXS, &m_interpreter, vd, uimm5, vb); + ThisCall("VCTUXS", &PPUInterpreter::VCTUXS, &m_interpreter, vd, uimm5, vb); } void PPULLVMRecompiler::VEXPTEFP(u32 vd, u32 vb) { - ThisCall2("VEXPTEFP", &PPUInterpreter::VEXPTEFP, &m_interpreter, vd, vb); + ThisCall("VEXPTEFP", &PPUInterpreter::VEXPTEFP, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VLOGEFP(u32 vd, u32 vb) { - ThisCall2("VLOGEFP", &PPUInterpreter::VLOGEFP, &m_interpreter, vd, vb); + ThisCall("VLOGEFP", &PPUInterpreter::VLOGEFP, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VMADDFP(u32 vd, u32 va, u32 vc, u32 vb) { - ThisCall4("VMADDFP", &PPUInterpreter::VMADDFP, &m_interpreter, vd, va, vc, vb); + ThisCall("VMADDFP", &PPUInterpreter::VMADDFP, &m_interpreter, vd, va, vc, vb); } void PPULLVMRecompiler::VMAXFP(u32 vd, u32 va, u32 vb) { - ThisCall3("VMAXFP", &PPUInterpreter::VMAXFP, &m_interpreter, vd, va, vb); + ThisCall("VMAXFP", &PPUInterpreter::VMAXFP, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMAXSB(u32 vd, u32 va, u32 vb) { - ThisCall3("VMAXSB", &PPUInterpreter::VMAXSB, &m_interpreter, vd, va, vb); + ThisCall("VMAXSB", &PPUInterpreter::VMAXSB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMAXSH(u32 vd, u32 va, u32 vb) { - ThisCall3("VMAXSH", &PPUInterpreter::VMAXSH, &m_interpreter, vd, va, vb); + ThisCall("VMAXSH", &PPUInterpreter::VMAXSH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMAXSW(u32 vd, u32 va, u32 vb) { - ThisCall3("VMAXSW", &PPUInterpreter::VMAXSW, &m_interpreter, vd, va, vb); + ThisCall("VMAXSW", &PPUInterpreter::VMAXSW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMAXUB(u32 vd, u32 va, u32 vb) { - ThisCall3("VMAXUB", &PPUInterpreter::VMAXUB, &m_interpreter, vd, va, vb); + ThisCall("VMAXUB", &PPUInterpreter::VMAXUB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMAXUH(u32 vd, u32 va, u32 vb) { - ThisCall3("VMAXUH", &PPUInterpreter::VMAXUH, &m_interpreter, vd, va, vb); + ThisCall("VMAXUH", &PPUInterpreter::VMAXUH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMAXUW(u32 vd, u32 va, u32 vb) { - ThisCall3("VMAXUW", &PPUInterpreter::VMAXUW, &m_interpreter, vd, va, vb); + ThisCall("VMAXUW", &PPUInterpreter::VMAXUW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMHADDSHS(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VMHADDSHS", &PPUInterpreter::VMHADDSHS, &m_interpreter, vd, va, vb, vc); + ThisCall("VMHADDSHS", &PPUInterpreter::VMHADDSHS, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VMHRADDSHS(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VMHRADDSHS", &PPUInterpreter::VMHRADDSHS, &m_interpreter, vd, va, vb, vc); + ThisCall("VMHRADDSHS", &PPUInterpreter::VMHRADDSHS, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VMINFP(u32 vd, u32 va, u32 vb) { - ThisCall3("VMINFP", &PPUInterpreter::VMINFP, &m_interpreter, vd, va, vb); + ThisCall("VMINFP", &PPUInterpreter::VMINFP, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMINSB(u32 vd, u32 va, u32 vb) { - ThisCall3("VMINSB", &PPUInterpreter::VMINSB, &m_interpreter, vd, va, vb); + ThisCall("VMINSB", &PPUInterpreter::VMINSB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMINSH(u32 vd, u32 va, u32 vb) { - ThisCall3("VMINSH", &PPUInterpreter::VMINSH, &m_interpreter, vd, va, vb); + ThisCall("VMINSH", &PPUInterpreter::VMINSH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMINSW(u32 vd, u32 va, u32 vb) { - ThisCall3("VMINSW", &PPUInterpreter::VMINSW, &m_interpreter, vd, va, vb); + ThisCall("VMINSW", &PPUInterpreter::VMINSW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMINUB(u32 vd, u32 va, u32 vb) { - ThisCall3("VMINUB", &PPUInterpreter::VMINUB, &m_interpreter, vd, va, vb); + ThisCall("VMINUB", &PPUInterpreter::VMINUB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMINUH(u32 vd, u32 va, u32 vb) { - ThisCall3("VMINUH", &PPUInterpreter::VMINUH, &m_interpreter, vd, va, vb); + ThisCall("VMINUH", &PPUInterpreter::VMINUH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMINUW(u32 vd, u32 va, u32 vb) { - ThisCall3("VMINUW", &PPUInterpreter::VMINUW, &m_interpreter, vd, va, vb); + ThisCall("VMINUW", &PPUInterpreter::VMINUW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMLADDUHM(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VMLADDUHM", &PPUInterpreter::VMLADDUHM, &m_interpreter, vd, va, vb, vc); + ThisCall("VMLADDUHM", &PPUInterpreter::VMLADDUHM, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VMRGHB(u32 vd, u32 va, u32 vb) { - ThisCall3("VMRGHB", &PPUInterpreter::VMRGHB, &m_interpreter, vd, va, vb); + ThisCall("VMRGHB", &PPUInterpreter::VMRGHB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMRGHH(u32 vd, u32 va, u32 vb) { - ThisCall3("VMRGHH", &PPUInterpreter::VMRGHH, &m_interpreter, vd, va, vb); + ThisCall("VMRGHH", &PPUInterpreter::VMRGHH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMRGHW(u32 vd, u32 va, u32 vb) { - ThisCall3("VMRGHW", &PPUInterpreter::VMRGHW, &m_interpreter, vd, va, vb); + ThisCall("VMRGHW", &PPUInterpreter::VMRGHW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMRGLB(u32 vd, u32 va, u32 vb) { - ThisCall3("VMRGLB", &PPUInterpreter::VMRGLB, &m_interpreter, vd, va, vb); + ThisCall("VMRGLB", &PPUInterpreter::VMRGLB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMRGLH(u32 vd, u32 va, u32 vb) { - ThisCall3("VMRGLH", &PPUInterpreter::VMRGLH, &m_interpreter, vd, va, vb); + ThisCall("VMRGLH", &PPUInterpreter::VMRGLH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMRGLW(u32 vd, u32 va, u32 vb) { - ThisCall3("VMRGLW", &PPUInterpreter::VMRGLW, &m_interpreter, vd, va, vb); + ThisCall("VMRGLW", &PPUInterpreter::VMRGLW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMSUMMBM(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VMSUMMBM", &PPUInterpreter::VMSUMMBM, &m_interpreter, vd, va, vb, vc); + ThisCall("VMSUMMBM", &PPUInterpreter::VMSUMMBM, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VMSUMSHM(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VMSUMSHM", &PPUInterpreter::VMSUMSHM, &m_interpreter, vd, va, vb, vc); + ThisCall("VMSUMSHM", &PPUInterpreter::VMSUMSHM, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VMSUMSHS(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VMSUMSHS", &PPUInterpreter::VMSUMSHS, &m_interpreter, vd, va, vb, vc); + ThisCall("VMSUMSHS", &PPUInterpreter::VMSUMSHS, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VMSUMUBM(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VMSUMUBM", &PPUInterpreter::VMSUMUBM, &m_interpreter, vd, va, vb, vc); + ThisCall("VMSUMUBM", &PPUInterpreter::VMSUMUBM, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VMSUMUHM(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VMSUMUHM", &PPUInterpreter::VMSUMUHM, &m_interpreter, vd, va, vb, vc); + ThisCall("VMSUMUHM", &PPUInterpreter::VMSUMUHM, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VMSUMUHS(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VMSUMUHS", &PPUInterpreter::VMSUMUHS, &m_interpreter, vd, va, vb, vc); + ThisCall("VMSUMUHS", &PPUInterpreter::VMSUMUHS, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VMULESB(u32 vd, u32 va, u32 vb) { - ThisCall3("VMULESB", &PPUInterpreter::VMULESB, &m_interpreter, vd, va, vb); + ThisCall("VMULESB", &PPUInterpreter::VMULESB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMULESH(u32 vd, u32 va, u32 vb) { - ThisCall3("VMULESH", &PPUInterpreter::VMULESH, &m_interpreter, vd, va, vb); + ThisCall("VMULESH", &PPUInterpreter::VMULESH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMULEUB(u32 vd, u32 va, u32 vb) { - ThisCall3("VMULEUB", &PPUInterpreter::VMULEUB, &m_interpreter, vd, va, vb); + ThisCall("VMULEUB", &PPUInterpreter::VMULEUB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMULEUH(u32 vd, u32 va, u32 vb) { - ThisCall3("VMULEUH", &PPUInterpreter::VMULEUH, &m_interpreter, vd, va, vb); + ThisCall("VMULEUH", &PPUInterpreter::VMULEUH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMULOSB(u32 vd, u32 va, u32 vb) { - ThisCall3("VMULOSB", &PPUInterpreter::VMULOSB, &m_interpreter, vd, va, vb); + ThisCall("VMULOSB", &PPUInterpreter::VMULOSB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMULOSH(u32 vd, u32 va, u32 vb) { - ThisCall3("VMULOSH", &PPUInterpreter::VMULOSH, &m_interpreter, vd, va, vb); + ThisCall("VMULOSH", &PPUInterpreter::VMULOSH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMULOUB(u32 vd, u32 va, u32 vb) { - ThisCall3("VMULOUB", &PPUInterpreter::VMULOUB, &m_interpreter, vd, va, vb); + ThisCall("VMULOUB", &PPUInterpreter::VMULOUB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VMULOUH(u32 vd, u32 va, u32 vb) { - ThisCall3("VMULOUH", &PPUInterpreter::VMULOUH, &m_interpreter, vd, va, vb); + ThisCall("VMULOUH", &PPUInterpreter::VMULOUH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VNMSUBFP(u32 vd, u32 va, u32 vc, u32 vb) { - ThisCall4("VNMSUBFP", &PPUInterpreter::VNMSUBFP, &m_interpreter, vd, va, vc, vb); + ThisCall("VNMSUBFP", &PPUInterpreter::VNMSUBFP, &m_interpreter, vd, va, vc, vb); } void PPULLVMRecompiler::VNOR(u32 vd, u32 va, u32 vb) { - ThisCall3("VNOR", &PPUInterpreter::VNOR, &m_interpreter, vd, va, vb); + ThisCall("VNOR", &PPUInterpreter::VNOR, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VOR(u32 vd, u32 va, u32 vb) { - ThisCall3("VOR", &PPUInterpreter::VOR, &m_interpreter, vd, va, vb); + ThisCall("VOR", &PPUInterpreter::VOR, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VPERM(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VPERM", &PPUInterpreter::VPERM, &m_interpreter, vd, va, vb, vc); + ThisCall("VPERM", &PPUInterpreter::VPERM, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VPKPX(u32 vd, u32 va, u32 vb) { - ThisCall3("VPKPX", &PPUInterpreter::VPKPX, &m_interpreter, vd, va, vb); + ThisCall("VPKPX", &PPUInterpreter::VPKPX, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VPKSHSS(u32 vd, u32 va, u32 vb) { - ThisCall3("VPKSHSS", &PPUInterpreter::VPKSHSS, &m_interpreter, vd, va, vb); + ThisCall("VPKSHSS", &PPUInterpreter::VPKSHSS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VPKSHUS(u32 vd, u32 va, u32 vb) { - ThisCall3("VPKSHUS", &PPUInterpreter::VPKSHUS, &m_interpreter, vd, va, vb); + ThisCall("VPKSHUS", &PPUInterpreter::VPKSHUS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VPKSWSS(u32 vd, u32 va, u32 vb) { - ThisCall3("VPKSWSS", &PPUInterpreter::VPKSWSS, &m_interpreter, vd, va, vb); + ThisCall("VPKSWSS", &PPUInterpreter::VPKSWSS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VPKSWUS(u32 vd, u32 va, u32 vb) { - ThisCall3("VPKSWUS", &PPUInterpreter::VPKSWUS, &m_interpreter, vd, va, vb); + ThisCall("VPKSWUS", &PPUInterpreter::VPKSWUS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VPKUHUM(u32 vd, u32 va, u32 vb) { - ThisCall3("VPKUHUM", &PPUInterpreter::VPKUHUM, &m_interpreter, vd, va, vb); + ThisCall("VPKUHUM", &PPUInterpreter::VPKUHUM, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VPKUHUS(u32 vd, u32 va, u32 vb) { - ThisCall3("VPKUHUS", &PPUInterpreter::VPKUHUS, &m_interpreter, vd, va, vb); + ThisCall("VPKUHUS", &PPUInterpreter::VPKUHUS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VPKUWUM(u32 vd, u32 va, u32 vb) { - ThisCall3("VPKUWUM", &PPUInterpreter::VPKUWUM, &m_interpreter, vd, va, vb); + ThisCall("VPKUWUM", &PPUInterpreter::VPKUWUM, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VPKUWUS(u32 vd, u32 va, u32 vb) { - ThisCall3("VPKUWUS", &PPUInterpreter::VPKUWUS, &m_interpreter, vd, va, vb); + ThisCall("VPKUWUS", &PPUInterpreter::VPKUWUS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VREFP(u32 vd, u32 vb) { - ThisCall2("VREFP", &PPUInterpreter::VREFP, &m_interpreter, vd, vb); + ThisCall("VREFP", &PPUInterpreter::VREFP, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VRFIM(u32 vd, u32 vb) { - ThisCall2("VRFIM", &PPUInterpreter::VRFIM, &m_interpreter, vd, vb); + ThisCall("VRFIM", &PPUInterpreter::VRFIM, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VRFIN(u32 vd, u32 vb) { - ThisCall2("VRFIN", &PPUInterpreter::VRFIN, &m_interpreter, vd, vb); + ThisCall("VRFIN", &PPUInterpreter::VRFIN, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VRFIP(u32 vd, u32 vb) { - ThisCall2("VRFIP", &PPUInterpreter::VRFIP, &m_interpreter, vd, vb); + ThisCall("VRFIP", &PPUInterpreter::VRFIP, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VRFIZ(u32 vd, u32 vb) { - ThisCall2("VRFIZ", &PPUInterpreter::VRFIZ, &m_interpreter, vd, vb); + ThisCall("VRFIZ", &PPUInterpreter::VRFIZ, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VRLB(u32 vd, u32 va, u32 vb) { - ThisCall3("VRLB", &PPUInterpreter::VRLB, &m_interpreter, vd, va, vb); + ThisCall("VRLB", &PPUInterpreter::VRLB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VRLH(u32 vd, u32 va, u32 vb) { - ThisCall3("VRLH", &PPUInterpreter::VRLH, &m_interpreter, vd, va, vb); + ThisCall("VRLH", &PPUInterpreter::VRLH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VRLW(u32 vd, u32 va, u32 vb) { - ThisCall3("VRLW", &PPUInterpreter::VRLW, &m_interpreter, vd, va, vb); + ThisCall("VRLW", &PPUInterpreter::VRLW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VRSQRTEFP(u32 vd, u32 vb) { - ThisCall2("VRSQRTEFP", &PPUInterpreter::VRSQRTEFP, &m_interpreter, vd, vb); + ThisCall("VRSQRTEFP", &PPUInterpreter::VRSQRTEFP, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VSEL(u32 vd, u32 va, u32 vb, u32 vc) { - ThisCall4("VSEL", &PPUInterpreter::VSEL, &m_interpreter, vd, va, vb, vc); + ThisCall("VSEL", &PPUInterpreter::VSEL, &m_interpreter, vd, va, vb, vc); } void PPULLVMRecompiler::VSL(u32 vd, u32 va, u32 vb) { - ThisCall3("VSL", &PPUInterpreter::VSL, &m_interpreter, vd, va, vb); + ThisCall("VSL", &PPUInterpreter::VSL, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSLB(u32 vd, u32 va, u32 vb) { - ThisCall3("VSLB", &PPUInterpreter::VSLB, &m_interpreter, vd, va, vb); + ThisCall("VSLB", &PPUInterpreter::VSLB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSLDOI(u32 vd, u32 va, u32 vb, u32 sh) { - ThisCall4("VSLDOI", &PPUInterpreter::VSLDOI, &m_interpreter, vd, va, vb, sh); + ThisCall("VSLDOI", &PPUInterpreter::VSLDOI, &m_interpreter, vd, va, vb, sh); } void PPULLVMRecompiler::VSLH(u32 vd, u32 va, u32 vb) { - ThisCall3("VSLH", &PPUInterpreter::VSLH, &m_interpreter, vd, va, vb); + ThisCall("VSLH", &PPUInterpreter::VSLH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSLO(u32 vd, u32 va, u32 vb) { - ThisCall3("VSLO", &PPUInterpreter::VSLO, &m_interpreter, vd, va, vb); + ThisCall("VSLO", &PPUInterpreter::VSLO, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSLW(u32 vd, u32 va, u32 vb) { - ThisCall3("VSLW", &PPUInterpreter::VSLW, &m_interpreter, vd, va, vb); + ThisCall("VSLW", &PPUInterpreter::VSLW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSPLTB(u32 vd, u32 uimm5, u32 vb) { - ThisCall3("VSPLTB", &PPUInterpreter::VSPLTB, &m_interpreter, vd, uimm5, vb); + ThisCall("VSPLTB", &PPUInterpreter::VSPLTB, &m_interpreter, vd, uimm5, vb); } void PPULLVMRecompiler::VSPLTH(u32 vd, u32 uimm5, u32 vb) { - ThisCall3("VSPLTH", &PPUInterpreter::VSPLTH, &m_interpreter, vd, uimm5, vb); + ThisCall("VSPLTH", &PPUInterpreter::VSPLTH, &m_interpreter, vd, uimm5, vb); } void PPULLVMRecompiler::VSPLTISB(u32 vd, s32 simm5) { - ThisCall2("VSPLTISB", &PPUInterpreter::VSPLTISB, &m_interpreter, vd, simm5); + ThisCall("VSPLTISB", &PPUInterpreter::VSPLTISB, &m_interpreter, vd, simm5); } void PPULLVMRecompiler::VSPLTISH(u32 vd, s32 simm5) { - ThisCall2("VSPLTISH", &PPUInterpreter::VSPLTISH, &m_interpreter, vd, simm5); + ThisCall("VSPLTISH", &PPUInterpreter::VSPLTISH, &m_interpreter, vd, simm5); } void PPULLVMRecompiler::VSPLTISW(u32 vd, s32 simm5) { - ThisCall2("VSPLTISW", &PPUInterpreter::VSPLTISW, &m_interpreter, vd, simm5); + ThisCall("VSPLTISW", &PPUInterpreter::VSPLTISW, &m_interpreter, vd, simm5); } void PPULLVMRecompiler::VSPLTW(u32 vd, u32 uimm5, u32 vb) { - ThisCall3("VSPLTW", &PPUInterpreter::VSPLTW, &m_interpreter, vd, uimm5, vb); + ThisCall("VSPLTW", &PPUInterpreter::VSPLTW, &m_interpreter, vd, uimm5, vb); } void PPULLVMRecompiler::VSR(u32 vd, u32 va, u32 vb) { - ThisCall3("VSR", &PPUInterpreter::VSR, &m_interpreter, vd, va, vb); + ThisCall("VSR", &PPUInterpreter::VSR, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSRAB(u32 vd, u32 va, u32 vb) { - ThisCall3("VSRAB", &PPUInterpreter::VSRAB, &m_interpreter, vd, va, vb); + ThisCall("VSRAB", &PPUInterpreter::VSRAB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSRAH(u32 vd, u32 va, u32 vb) { - ThisCall3("VSRAH", &PPUInterpreter::VSRAH, &m_interpreter, vd, va, vb); + ThisCall("VSRAH", &PPUInterpreter::VSRAH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSRAW(u32 vd, u32 va, u32 vb) { - ThisCall3("VSRAW", &PPUInterpreter::VSRAW, &m_interpreter, vd, va, vb); + ThisCall("VSRAW", &PPUInterpreter::VSRAW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSRB(u32 vd, u32 va, u32 vb) { - ThisCall3("VSRB", &PPUInterpreter::VSRB, &m_interpreter, vd, va, vb); + ThisCall("VSRB", &PPUInterpreter::VSRB, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSRH(u32 vd, u32 va, u32 vb) { - ThisCall3("VSRH", &PPUInterpreter::VSRH, &m_interpreter, vd, va, vb); + ThisCall("VSRH", &PPUInterpreter::VSRH, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSRO(u32 vd, u32 va, u32 vb) { - ThisCall3("VSRO", &PPUInterpreter::VSRO, &m_interpreter, vd, va, vb); + ThisCall("VSRO", &PPUInterpreter::VSRO, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSRW(u32 vd, u32 va, u32 vb) { - ThisCall3("VSRW", &PPUInterpreter::VSRW, &m_interpreter, vd, va, vb); + ThisCall("VSRW", &PPUInterpreter::VSRW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBCUW(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBCUW", &PPUInterpreter::VSUBCUW, &m_interpreter, vd, va, vb); + ThisCall("VSUBCUW", &PPUInterpreter::VSUBCUW, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBFP(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBFP", &PPUInterpreter::VSUBFP, &m_interpreter, vd, va, vb); + ThisCall("VSUBFP", &PPUInterpreter::VSUBFP, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBSBS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBSBS", &PPUInterpreter::VSUBSBS, &m_interpreter, vd, va, vb); + ThisCall("VSUBSBS", &PPUInterpreter::VSUBSBS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBSHS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBSHS", &PPUInterpreter::VSUBSHS, &m_interpreter, vd, va, vb); + ThisCall("VSUBSHS", &PPUInterpreter::VSUBSHS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBSWS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBSWS", &PPUInterpreter::VSUBSWS, &m_interpreter, vd, va, vb); + ThisCall("VSUBSWS", &PPUInterpreter::VSUBSWS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBUBM(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBUBM", &PPUInterpreter::VSUBUBM, &m_interpreter, vd, va, vb); + ThisCall("VSUBUBM", &PPUInterpreter::VSUBUBM, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBUBS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBUBS", &PPUInterpreter::VSUBUBS, &m_interpreter, vd, va, vb); + ThisCall("VSUBUBS", &PPUInterpreter::VSUBUBS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBUHM(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBUHM", &PPUInterpreter::VSUBUHM, &m_interpreter, vd, va, vb); + ThisCall("VSUBUHM", &PPUInterpreter::VSUBUHM, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBUHS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBUHS", &PPUInterpreter::VSUBUHS, &m_interpreter, vd, va, vb); + ThisCall("VSUBUHS", &PPUInterpreter::VSUBUHS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBUWM(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBUWM", &PPUInterpreter::VSUBUWM, &m_interpreter, vd, va, vb); + ThisCall("VSUBUWM", &PPUInterpreter::VSUBUWM, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUBUWS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUBUWS", &PPUInterpreter::VSUBUWS, &m_interpreter, vd, va, vb); + ThisCall("VSUBUWS", &PPUInterpreter::VSUBUWS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUMSWS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUMSWS", &PPUInterpreter::VSUMSWS, &m_interpreter, vd, va, vb); + ThisCall("VSUMSWS", &PPUInterpreter::VSUMSWS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUM2SWS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUM2SWS", &PPUInterpreter::VSUM2SWS, &m_interpreter, vd, va, vb); + ThisCall("VSUM2SWS", &PPUInterpreter::VSUM2SWS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUM4SBS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUM4SBS", &PPUInterpreter::VSUM4SBS, &m_interpreter, vd, va, vb); + ThisCall("VSUM4SBS", &PPUInterpreter::VSUM4SBS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUM4SHS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUM4SHS", &PPUInterpreter::VSUM4SHS, &m_interpreter, vd, va, vb); + ThisCall("VSUM4SHS", &PPUInterpreter::VSUM4SHS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VSUM4UBS(u32 vd, u32 va, u32 vb) { - ThisCall3("VSUM4UBS", &PPUInterpreter::VSUM4UBS, &m_interpreter, vd, va, vb); + ThisCall("VSUM4UBS", &PPUInterpreter::VSUM4UBS, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::VUPKHPX(u32 vd, u32 vb) { - ThisCall2("VUPKHPX", &PPUInterpreter::VUPKHPX, &m_interpreter, vd, vb); + ThisCall("VUPKHPX", &PPUInterpreter::VUPKHPX, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VUPKHSB(u32 vd, u32 vb) { - ThisCall2("VUPKHSB", &PPUInterpreter::VUPKHSB, &m_interpreter, vd, vb); + ThisCall("VUPKHSB", &PPUInterpreter::VUPKHSB, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VUPKHSH(u32 vd, u32 vb) { - ThisCall2("VUPKHSH", &PPUInterpreter::VUPKHSH, &m_interpreter, vd, vb); + ThisCall("VUPKHSH", &PPUInterpreter::VUPKHSH, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VUPKLPX(u32 vd, u32 vb) { - ThisCall2("VUPKLPX", &PPUInterpreter::VUPKLPX, &m_interpreter, vd, vb); + ThisCall("VUPKLPX", &PPUInterpreter::VUPKLPX, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VUPKLSB(u32 vd, u32 vb) { - ThisCall2("VUPKLSB", &PPUInterpreter::VUPKLSB, &m_interpreter, vd, vb); + ThisCall("VUPKLSB", &PPUInterpreter::VUPKLSB, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VUPKLSH(u32 vd, u32 vb) { - ThisCall2("VUPKLSH", &PPUInterpreter::VUPKLSH, &m_interpreter, vd, vb); + ThisCall("VUPKLSH", &PPUInterpreter::VUPKLSH, &m_interpreter, vd, vb); } void PPULLVMRecompiler::VXOR(u32 vd, u32 va, u32 vb) { - ThisCall3("VXOR", &PPUInterpreter::VXOR, &m_interpreter, vd, va, vb); + ThisCall("VXOR", &PPUInterpreter::VXOR, &m_interpreter, vd, va, vb); } void PPULLVMRecompiler::MULLI(u32 rd, u32 ra, s32 simm16) { //auto ra_i64 = GetGpr(ra); //auto res_i64 = m_ir_builder.CreateMul(ra_i64, m_ir_builder.getInt64((s64)simm16)); //SetGpr(rd, res_i64); - ThisCall3("MULLI", &PPUInterpreter::MULLI, &m_interpreter, rd, ra, simm16); + ThisCall("MULLI", &PPUInterpreter::MULLI, &m_interpreter, rd, ra, simm16); } void PPULLVMRecompiler::SUBFIC(u32 rd, u32 ra, s32 simm16) { @@ -993,7 +1018,7 @@ void PPULLVMRecompiler::SUBFIC(u32 rd, u32 ra, s32 simm16) { //auto carry_i1 = m_ir_builder.CreateExtractValue(res_s, {1}); //SetGpr(rd, diff_i64); //SetXerCa(carry_i1); - ThisCall3("SUBFIC", &PPUInterpreter::SUBFIC, &m_interpreter, rd, ra, simm16); + ThisCall("SUBFIC", &PPUInterpreter::SUBFIC, &m_interpreter, rd, ra, simm16); } void PPULLVMRecompiler::CMPLI(u32 crfd, u32 l, u32 ra, u32 uimm16) { @@ -1003,7 +1028,7 @@ void PPULLVMRecompiler::CMPLI(u32 crfd, u32 l, u32 ra, u32 uimm16) { //} //SetCrFieldUnsignedCmp(crfd, ra_i64, m_ir_builder.getInt64(uimm16)); - ThisCall4("CMPLI", &PPUInterpreter::CMPLI, &m_interpreter, crfd, l, ra, uimm16); + ThisCall("CMPLI", &PPUInterpreter::CMPLI, &m_interpreter, crfd, l, ra, uimm16); } void PPULLVMRecompiler::CMPI(u32 crfd, u32 l, u32 ra, s32 simm16) { @@ -1014,7 +1039,7 @@ void PPULLVMRecompiler::CMPI(u32 crfd, u32 l, u32 ra, s32 simm16) { //} //SetCrFieldSignedCmp(crfd, ra_i64, m_ir_builder.getInt64((s64)simm16)); - ThisCall4("CMPI", &PPUInterpreter::CMPI, &m_interpreter, crfd, l, ra, simm16); + ThisCall("CMPI", &PPUInterpreter::CMPI, &m_interpreter, crfd, l, ra, simm16); } void PPULLVMRecompiler::ADDIC(u32 rd, u32 ra, s32 simm16) { @@ -1024,24 +1049,24 @@ void PPULLVMRecompiler::ADDIC(u32 rd, u32 ra, s32 simm16) { //auto carry_i1 = m_ir_builder.CreateExtractValue(res_s, {1}); //SetGpr(rd, sum_i64); //SetXerCa(carry_i1); - ThisCall3("ADDIC", &PPUInterpreter::ADDIC, &m_interpreter, rd, ra, simm16); + ThisCall("ADDIC", &PPUInterpreter::ADDIC, &m_interpreter, rd, ra, simm16); } void PPULLVMRecompiler::ADDIC_(u32 rd, u32 ra, s32 simm16) { //ADDIC(rd, ra, simm16); //SetCrFieldSignedCmp(0, GetGpr(rd), m_ir_builder.getInt64(0)); - ThisCall3("ADDIC_", &PPUInterpreter::ADDIC_, &m_interpreter, rd, ra, simm16); + ThisCall("ADDIC_", &PPUInterpreter::ADDIC_, &m_interpreter, rd, ra, simm16); } void PPULLVMRecompiler::ADDI(u32 rd, u32 ra, s32 simm16) { - //if (ra == 0) { - // SetGpr(rd, m_ir_builder.getInt64((s64)simm16)); - //} else { - // auto ra_i64 = GetGpr(ra); - // auto sum_i64 = m_ir_builder.CreateAdd(ra_i64, m_ir_builder.getInt64((s64)simm16)); - // SetGpr(rd, sum_i64); - //} - ThisCall3("ADDI", &PPUInterpreter::ADDI, &m_interpreter, rd, ra, simm16); + if (ra == 0) { + SetGpr(rd, m_ir_builder.getInt64((s64)simm16)); + } else { + auto ra_i64 = GetGpr(ra); + auto sum_i64 = m_ir_builder.CreateAdd(ra_i64, m_ir_builder.getInt64((s64)simm16)); + SetGpr(rd, sum_i64); + } + //ThisCall("ADDI", &PPUInterpreter::ADDI, &m_interpreter, rd, ra, simm16); } void PPULLVMRecompiler::ADDIS(u32 rd, u32 ra, s32 simm16) { @@ -1052,20 +1077,20 @@ void PPULLVMRecompiler::ADDIS(u32 rd, u32 ra, s32 simm16) { // auto sum_i64 = m_ir_builder.CreateAdd(ra_i64, m_ir_builder.getInt64((s64)(simm16 << 16))); // SetGpr(rd, sum_i64); //} - ThisCall3("ADDIS", &PPUInterpreter::ADDIS, &m_interpreter, rd, ra, simm16); + ThisCall("ADDIS", &PPUInterpreter::ADDIS, &m_interpreter, rd, ra, simm16); } void PPULLVMRecompiler::BC(u32 bo, u32 bi, s32 bd, u32 aa, u32 lk) { - ThisCall5("BC", &PPUInterpreter::BC, &m_interpreter, bo, bi, bd, aa, lk); + ThisCall("BC", &PPUInterpreter::BC, &m_interpreter, bo, bi, bd, aa, lk); m_hit_branch_instruction = true; } void PPULLVMRecompiler::SC(u32 sc_code) { - ThisCall1("SC", &PPUInterpreter::SC, &m_interpreter, sc_code); + ThisCall("SC", &PPUInterpreter::SC, &m_interpreter, sc_code); } void PPULLVMRecompiler::B(s32 ll, u32 aa, u32 lk) { - ThisCall3("B", &PPUInterpreter::B, &m_interpreter, ll, aa, lk); + ThisCall("B", &PPUInterpreter::B, &m_interpreter, ll, aa, lk); m_hit_branch_instruction = true; } @@ -1076,11 +1101,11 @@ void PPULLVMRecompiler::MCRF(u32 crfd, u32 crfs) { // cr_i32 = SetNibble(cr_i32, crfd, crf_i32); // SetCr(cr_i32); //} - ThisCall2("MCRF", &PPUInterpreter::MCRF, &m_interpreter, crfd, crfs); + ThisCall("MCRF", &PPUInterpreter::MCRF, &m_interpreter, crfd, crfs); } void PPULLVMRecompiler::BCLR(u32 bo, u32 bi, u32 bh, u32 lk) { - ThisCall4("BCLR", &PPUInterpreter::BCLR, &m_interpreter, bo, bi, bh, lk); + ThisCall("BCLR", &PPUInterpreter::BCLR, &m_interpreter, bo, bi, bh, lk); m_hit_branch_instruction = true; } @@ -1092,7 +1117,7 @@ void PPULLVMRecompiler::CRNOR(u32 crbd, u32 crba, u32 crbb) { //res_i32 = m_ir_builder.CreateXor(res_i32, 1); //cr_i32 = SetBit(cr_i32, crbd, res_i32); //SetCr(cr_i32); - ThisCall3("CRNOR", &PPUInterpreter::CRNOR, &m_interpreter, crbd, crba, crbb); + ThisCall("CRNOR", &PPUInterpreter::CRNOR, &m_interpreter, crbd, crba, crbb); } void PPULLVMRecompiler::CRANDC(u32 crbd, u32 crba, u32 crbb) { @@ -1103,7 +1128,7 @@ void PPULLVMRecompiler::CRANDC(u32 crbd, u32 crba, u32 crbb) { //res_i32 = m_ir_builder.CreateAnd(ba_i32, res_i32); //cr_i32 = SetBit(cr_i32, crbd, res_i32); //SetCr(cr_i32); - ThisCall3("CRANDC", &PPUInterpreter::CRANDC, &m_interpreter, crbd, crba, crbb); + ThisCall("CRANDC", &PPUInterpreter::CRANDC, &m_interpreter, crbd, crba, crbb); } void PPULLVMRecompiler::ISYNC() { @@ -1117,7 +1142,7 @@ void PPULLVMRecompiler::CRXOR(u32 crbd, u32 crba, u32 crbb) { //auto res_i32 = m_ir_builder.CreateXor(ba_i32, bb_i32); //cr_i32 = SetBit(cr_i32, crbd, res_i32); //SetCr(cr_i32); - ThisCall3("CRXOR", &PPUInterpreter::CRXOR, &m_interpreter, crbd, crba, crbb); + ThisCall("CRXOR", &PPUInterpreter::CRXOR, &m_interpreter, crbd, crba, crbb); } void PPULLVMRecompiler::CRNAND(u32 crbd, u32 crba, u32 crbb) { @@ -1128,7 +1153,7 @@ void PPULLVMRecompiler::CRNAND(u32 crbd, u32 crba, u32 crbb) { //res_i32 = m_ir_builder.CreateXor(res_i32, 1); //cr_i32 = SetBit(cr_i32, crbd, res_i32); //SetCr(cr_i32); - ThisCall3("CRNAND", &PPUInterpreter::CRNAND, &m_interpreter, crbd, crba, crbb); + ThisCall("CRNAND", &PPUInterpreter::CRNAND, &m_interpreter, crbd, crba, crbb); } void PPULLVMRecompiler::CRAND(u32 crbd, u32 crba, u32 crbb) { @@ -1138,7 +1163,7 @@ void PPULLVMRecompiler::CRAND(u32 crbd, u32 crba, u32 crbb) { //auto res_i32 = m_ir_builder.CreateAnd(ba_i32, bb_i32); //cr_i32 = SetBit(cr_i32, crbd, res_i32); //SetCr(cr_i32); - ThisCall3("CRAND", &PPUInterpreter::CRAND, &m_interpreter, crbd, crba, crbb); + ThisCall("CRAND", &PPUInterpreter::CRAND, &m_interpreter, crbd, crba, crbb); } void PPULLVMRecompiler::CREQV(u32 crbd, u32 crba, u32 crbb) { @@ -1149,7 +1174,7 @@ void PPULLVMRecompiler::CREQV(u32 crbd, u32 crba, u32 crbb) { //res_i32 = m_ir_builder.CreateXor(res_i32, 1); //cr_i32 = SetBit(cr_i32, crbd, res_i32); //SetCr(cr_i32); - ThisCall3("CREQV", &PPUInterpreter::CREQV, &m_interpreter, crbd, crba, crbb); + ThisCall("CREQV", &PPUInterpreter::CREQV, &m_interpreter, crbd, crba, crbb); } void PPULLVMRecompiler::CRORC(u32 crbd, u32 crba, u32 crbb) { @@ -1160,7 +1185,7 @@ void PPULLVMRecompiler::CRORC(u32 crbd, u32 crba, u32 crbb) { //res_i32 = m_ir_builder.CreateOr(ba_i32, res_i32); //cr_i32 = SetBit(cr_i32, crbd, res_i32); //SetCr(cr_i32); - ThisCall3("CRORC", &PPUInterpreter::CRORC, &m_interpreter, crbd, crba, crbb); + ThisCall("CRORC", &PPUInterpreter::CRORC, &m_interpreter, crbd, crba, crbb); } void PPULLVMRecompiler::CROR(u32 crbd, u32 crba, u32 crbb) { @@ -1170,52 +1195,52 @@ void PPULLVMRecompiler::CROR(u32 crbd, u32 crba, u32 crbb) { //auto res_i32 = m_ir_builder.CreateOr(ba_i32, bb_i32); //cr_i32 = SetBit(cr_i32, crbd, res_i32); //SetCr(cr_i32); - ThisCall3("CROR", &PPUInterpreter::CROR, &m_interpreter, crbd, crba, crbb); + ThisCall("CROR", &PPUInterpreter::CROR, &m_interpreter, crbd, crba, crbb); } void PPULLVMRecompiler::BCCTR(u32 bo, u32 bi, u32 bh, u32 lk) { - ThisCall4("BCCTR", &PPUInterpreter::BCCTR, &m_interpreter, bo, bi, bh, lk); + ThisCall("BCCTR", &PPUInterpreter::BCCTR, &m_interpreter, bo, bi, bh, lk); m_hit_branch_instruction = true; } void PPULLVMRecompiler::RLWIMI(u32 ra, u32 rs, u32 sh, u32 mb, u32 me, bool rc) { - ThisCall6("RLWIMI", &PPUInterpreter::RLWIMI, &m_interpreter, ra, rs, sh, mb, me, rc); + ThisCall("RLWIMI", &PPUInterpreter::RLWIMI, &m_interpreter, ra, rs, sh, mb, me, rc); } void PPULLVMRecompiler::RLWINM(u32 ra, u32 rs, u32 sh, u32 mb, u32 me, bool rc) { - ThisCall6("RLWINM", &PPUInterpreter::RLWINM, &m_interpreter, ra, rs, sh, mb, me, rc); + ThisCall("RLWINM", &PPUInterpreter::RLWINM, &m_interpreter, ra, rs, sh, mb, me, rc); } void PPULLVMRecompiler::RLWNM(u32 ra, u32 rs, u32 rb, u32 mb, u32 me, bool rc) { - ThisCall6("RLWNM", &PPUInterpreter::RLWNM, &m_interpreter, ra, rs, rb, mb, me, rc); + ThisCall("RLWNM", &PPUInterpreter::RLWNM, &m_interpreter, ra, rs, rb, mb, me, rc); } void PPULLVMRecompiler::ORI(u32 ra, u32 rs, u32 uimm16) { //auto rs_i64 = GetGpr(rs); //auto res_i64 = m_ir_builder.CreateOr(rs_i64, uimm16); //SetGpr(ra, res_i64); - ThisCall3("ORI", &PPUInterpreter::ORI, &m_interpreter, ra, rs, uimm16); + ThisCall("ORI", &PPUInterpreter::ORI, &m_interpreter, ra, rs, uimm16); } void PPULLVMRecompiler::ORIS(u32 ra, u32 rs, u32 uimm16) { //auto rs_i64 = GetGpr(rs); //auto res_i64 = m_ir_builder.CreateOr(rs_i64, uimm16 << 16); //SetGpr(ra, res_i64); - ThisCall3("ORIS", &PPUInterpreter::ORIS, &m_interpreter, ra, rs, uimm16); + ThisCall("ORIS", &PPUInterpreter::ORIS, &m_interpreter, ra, rs, uimm16); } void PPULLVMRecompiler::XORI(u32 ra, u32 rs, u32 uimm16) { //auto rs_i64 = GetGpr(rs); //auto res_i64 = m_ir_builder.CreateXor(rs_i64, uimm16); //SetGpr(ra, res_i64); - ThisCall3("XORI", &PPUInterpreter::XORI, &m_interpreter, ra, rs, uimm16); + ThisCall("XORI", &PPUInterpreter::XORI, &m_interpreter, ra, rs, uimm16); } void PPULLVMRecompiler::XORIS(u32 ra, u32 rs, u32 uimm16) { //auto rs_i64 = GetGpr(rs); //auto res_i64 = m_ir_builder.CreateXor(rs_i64, uimm16 << 16); //SetGpr(ra, res_i64); - ThisCall3("XORIS", &PPUInterpreter::XORIS, &m_interpreter, ra, rs, uimm16); + ThisCall("XORIS", &PPUInterpreter::XORIS, &m_interpreter, ra, rs, uimm16); } void PPULLVMRecompiler::ANDI_(u32 ra, u32 rs, u32 uimm16) { @@ -1223,7 +1248,7 @@ void PPULLVMRecompiler::ANDI_(u32 ra, u32 rs, u32 uimm16) { //auto res_i64 = m_ir_builder.CreateAnd(rs_i64, uimm16); //SetGpr(ra, res_i64); //SetCrFieldSignedCmp(0, res_i64, m_ir_builder.getInt64(0)); - ThisCall3("ANDI_", &PPUInterpreter::ANDI_, &m_interpreter, ra, rs, uimm16); + ThisCall("ANDI_", &PPUInterpreter::ANDI_, &m_interpreter, ra, rs, uimm16); } void PPULLVMRecompiler::ANDIS_(u32 ra, u32 rs, u32 uimm16) { @@ -1231,812 +1256,811 @@ void PPULLVMRecompiler::ANDIS_(u32 ra, u32 rs, u32 uimm16) { //auto res_i64 = m_ir_builder.CreateAnd(rs_i64, uimm16 << 16); //SetGpr(ra, res_i64); //SetCrFieldSignedCmp(0, res_i64, m_ir_builder.getInt64(0)); - ThisCall3("ANDIS_", &PPUInterpreter::ANDIS_, &m_interpreter, ra, rs, uimm16); + ThisCall("ANDIS_", &PPUInterpreter::ANDIS_, &m_interpreter, ra, rs, uimm16); } void PPULLVMRecompiler::RLDICL(u32 ra, u32 rs, u32 sh, u32 mb, bool rc) { - ThisCall5("RLDICL", &PPUInterpreter::RLDICL, &m_interpreter, ra, rs, sh, mb, rc); + ThisCall("RLDICL", &PPUInterpreter::RLDICL, &m_interpreter, ra, rs, sh, mb, rc); } void PPULLVMRecompiler::RLDICR(u32 ra, u32 rs, u32 sh, u32 me, bool rc) { - ThisCall5("RLDICR", &PPUInterpreter::RLDICR, &m_interpreter, ra, rs, sh, me, rc); + ThisCall("RLDICR", &PPUInterpreter::RLDICR, &m_interpreter, ra, rs, sh, me, rc); } void PPULLVMRecompiler::RLDIC(u32 ra, u32 rs, u32 sh, u32 mb, bool rc) { - ThisCall5("RLDIC", &PPUInterpreter::RLDIC, &m_interpreter, ra, rs, sh, mb, rc); + ThisCall("RLDIC", &PPUInterpreter::RLDIC, &m_interpreter, ra, rs, sh, mb, rc); } void PPULLVMRecompiler::RLDIMI(u32 ra, u32 rs, u32 sh, u32 mb, bool rc) { - ThisCall5("RLDIMI", &PPUInterpreter::RLDIMI, &m_interpreter, ra, rs, sh, mb, rc); + ThisCall("RLDIMI", &PPUInterpreter::RLDIMI, &m_interpreter, ra, rs, sh, mb, rc); } void PPULLVMRecompiler::RLDC_LR(u32 ra, u32 rs, u32 rb, u32 m_eb, bool is_r, bool rc) { - ThisCall6("RLDC_LR", &PPUInterpreter::RLDC_LR, &m_interpreter, ra, rs, rb, m_eb, is_r, rc); + ThisCall("RLDC_LR", &PPUInterpreter::RLDC_LR, &m_interpreter, ra, rs, rb, m_eb, is_r, rc); } void PPULLVMRecompiler::CMP(u32 crfd, u32 l, u32 ra, u32 rb) { - //m_ppu.UpdateCRnS(l, crfd, m_ppu.GPR[ra], m_ppu.GPR[rb]); - ThisCall4("CMP", &PPUInterpreter::CMP, &m_interpreter, crfd, l, ra, rb); + ThisCall("CMP", &PPUInterpreter::CMP, &m_interpreter, crfd, l, ra, rb); } void PPULLVMRecompiler::TW(u32 to, u32 ra, u32 rb) { - ThisCall3("TW", &PPUInterpreter::TW, &m_interpreter, to, ra, rb); + ThisCall("TW", &PPUInterpreter::TW, &m_interpreter, to, ra, rb); } void PPULLVMRecompiler::LVSL(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVSL", &PPUInterpreter::LVSL, &m_interpreter, vd, ra, rb); + ThisCall("LVSL", &PPUInterpreter::LVSL, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::LVEBX(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVEBX", &PPUInterpreter::LVEBX, &m_interpreter, vd, ra, rb); + ThisCall("LVEBX", &PPUInterpreter::LVEBX, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::SUBFC(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("SUBFC", &PPUInterpreter::SUBFC, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("SUBFC", &PPUInterpreter::SUBFC, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::ADDC(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("ADDC", &PPUInterpreter::ADDC, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("ADDC", &PPUInterpreter::ADDC, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::MULHDU(u32 rd, u32 ra, u32 rb, bool rc) { - ThisCall4("MULHDU", &PPUInterpreter::MULHDU, &m_interpreter, rd, ra, rb, rc); + ThisCall("MULHDU", &PPUInterpreter::MULHDU, &m_interpreter, rd, ra, rb, rc); } void PPULLVMRecompiler::MULHWU(u32 rd, u32 ra, u32 rb, bool rc) { - ThisCall4("MULHWU", &PPUInterpreter::MULHWU, &m_interpreter, rd, ra, rb, rc); + ThisCall("MULHWU", &PPUInterpreter::MULHWU, &m_interpreter, rd, ra, rb, rc); } void PPULLVMRecompiler::MFOCRF(u32 a, u32 rd, u32 crm) { - ThisCall3("MFOCRF", &PPUInterpreter::MFOCRF, &m_interpreter, a, rd, crm); + ThisCall("MFOCRF", &PPUInterpreter::MFOCRF, &m_interpreter, a, rd, crm); } void PPULLVMRecompiler::LWARX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LWARX", &PPUInterpreter::LWARX, &m_interpreter, rd, ra, rb); + ThisCall("LWARX", &PPUInterpreter::LWARX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::LDX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LDX", &PPUInterpreter::LDX, &m_interpreter, rd, ra, rb); + ThisCall("LDX", &PPUInterpreter::LDX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::LWZX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LWZX", &PPUInterpreter::LWZX, &m_interpreter, rd, ra, rb); + ThisCall("LWZX", &PPUInterpreter::LWZX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::SLW(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("SLW", &PPUInterpreter::SLW, &m_interpreter, ra, rs, rb, rc); + ThisCall("SLW", &PPUInterpreter::SLW, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::CNTLZW(u32 ra, u32 rs, bool rc) { - ThisCall3("CNTLZW", &PPUInterpreter::CNTLZW, &m_interpreter, ra, rs, rc); + ThisCall("CNTLZW", &PPUInterpreter::CNTLZW, &m_interpreter, ra, rs, rc); } void PPULLVMRecompiler::SLD(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("SLD", &PPUInterpreter::SLD, &m_interpreter, ra, rs, rb, rc); + ThisCall("SLD", &PPUInterpreter::SLD, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::AND(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("AND", &PPUInterpreter::AND, &m_interpreter, ra, rs, rb, rc); + ThisCall("AND", &PPUInterpreter::AND, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::CMPL(u32 crfd, u32 l, u32 ra, u32 rb) { - ThisCall4("CMPL", &PPUInterpreter::CMPL, &m_interpreter, crfd, l, ra, rb); + ThisCall("CMPL", &PPUInterpreter::CMPL, &m_interpreter, crfd, l, ra, rb); } void PPULLVMRecompiler::LVSR(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVSR", &PPUInterpreter::LVSR, &m_interpreter, vd, ra, rb); + ThisCall("LVSR", &PPUInterpreter::LVSR, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::LVEHX(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVEHX", &PPUInterpreter::LVEHX, &m_interpreter, vd, ra, rb); + ThisCall("LVEHX", &PPUInterpreter::LVEHX, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::SUBF(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("SUBF", &PPUInterpreter::SUBF, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("SUBF", &PPUInterpreter::SUBF, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::LDUX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LDUX", &PPUInterpreter::LDUX, &m_interpreter, rd, ra, rb); + ThisCall("LDUX", &PPUInterpreter::LDUX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::DCBST(u32 ra, u32 rb) { - ThisCall2("DCBST", &PPUInterpreter::DCBST, &m_interpreter, ra, rb); + ThisCall("DCBST", &PPUInterpreter::DCBST, &m_interpreter, ra, rb); } void PPULLVMRecompiler::LWZUX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LWZUX", &PPUInterpreter::LWZUX, &m_interpreter, rd, ra, rb); + ThisCall("LWZUX", &PPUInterpreter::LWZUX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::CNTLZD(u32 ra, u32 rs, bool rc) { - ThisCall3("CNTLZD", &PPUInterpreter::CNTLZD, &m_interpreter, ra, rs, rc); + ThisCall("CNTLZD", &PPUInterpreter::CNTLZD, &m_interpreter, ra, rs, rc); } void PPULLVMRecompiler::ANDC(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("ANDC", &PPUInterpreter::ANDC, &m_interpreter, ra, rs, rb, rc); + ThisCall("ANDC", &PPUInterpreter::ANDC, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::TD(u32 to, u32 ra, u32 rb) { - ThisCall3("TD", &PPUInterpreter::TD, &m_interpreter, to, ra, rb); + ThisCall("TD", &PPUInterpreter::TD, &m_interpreter, to, ra, rb); } void PPULLVMRecompiler::LVEWX(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVEWX", &PPUInterpreter::LVEWX, &m_interpreter, vd, ra, rb); + ThisCall("LVEWX", &PPUInterpreter::LVEWX, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::MULHD(u32 rd, u32 ra, u32 rb, bool rc) { - ThisCall4("MULHD", &PPUInterpreter::MULHD, &m_interpreter, rd, ra, rb, rc); + ThisCall("MULHD", &PPUInterpreter::MULHD, &m_interpreter, rd, ra, rb, rc); } void PPULLVMRecompiler::MULHW(u32 rd, u32 ra, u32 rb, bool rc) { - ThisCall4("MULHW", &PPUInterpreter::MULHW, &m_interpreter, rd, ra, rb, rc); + ThisCall("MULHW", &PPUInterpreter::MULHW, &m_interpreter, rd, ra, rb, rc); } void PPULLVMRecompiler::LDARX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LDARX", &PPUInterpreter::LDARX, &m_interpreter, rd, ra, rb); + ThisCall("LDARX", &PPUInterpreter::LDARX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::DCBF(u32 ra, u32 rb) { - ThisCall2("DCBF", &PPUInterpreter::DCBF, &m_interpreter, ra, rb); + ThisCall("DCBF", &PPUInterpreter::DCBF, &m_interpreter, ra, rb); } void PPULLVMRecompiler::LBZX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LBZX", &PPUInterpreter::LBZX, &m_interpreter, rd, ra, rb); + ThisCall("LBZX", &PPUInterpreter::LBZX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::LVX(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVX", &PPUInterpreter::LVX, &m_interpreter, vd, ra, rb); + ThisCall("LVX", &PPUInterpreter::LVX, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::NEG(u32 rd, u32 ra, u32 oe, bool rc) { - ThisCall4("NEG", &PPUInterpreter::NEG, &m_interpreter, rd, ra, oe, rc); + ThisCall("NEG", &PPUInterpreter::NEG, &m_interpreter, rd, ra, oe, rc); } void PPULLVMRecompiler::LBZUX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LBZUX", &PPUInterpreter::LBZUX, &m_interpreter, rd, ra, rb); + ThisCall("LBZUX", &PPUInterpreter::LBZUX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::NOR(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("NOR", &PPUInterpreter::NOR, &m_interpreter, ra, rs, rb, rc); + ThisCall("NOR", &PPUInterpreter::NOR, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::STVEBX(u32 vs, u32 ra, u32 rb) { - ThisCall3("STVEBX", &PPUInterpreter::STVEBX, &m_interpreter, vs, ra, rb); + ThisCall("STVEBX", &PPUInterpreter::STVEBX, &m_interpreter, vs, ra, rb); } void PPULLVMRecompiler::SUBFE(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("SUBFE", &PPUInterpreter::SUBFE, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("SUBFE", &PPUInterpreter::SUBFE, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::ADDE(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("ADDE", &PPUInterpreter::ADDE, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("ADDE", &PPUInterpreter::ADDE, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::MTOCRF(u32 l, u32 crm, u32 rs) { - ThisCall3("MTOCRF", &PPUInterpreter::MTOCRF, &m_interpreter, l, crm, rs); + ThisCall("MTOCRF", &PPUInterpreter::MTOCRF, &m_interpreter, l, crm, rs); } void PPULLVMRecompiler::STDX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STDX", &PPUInterpreter::STDX, &m_interpreter, rs, ra, rb); + ThisCall("STDX", &PPUInterpreter::STDX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::STWCX_(u32 rs, u32 ra, u32 rb) { - ThisCall3("STWCX_", &PPUInterpreter::STWCX_, &m_interpreter, rs, ra, rb); + ThisCall("STWCX_", &PPUInterpreter::STWCX_, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::STWX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STWX", &PPUInterpreter::STWX, &m_interpreter, rs, ra, rb); + ThisCall("STWX", &PPUInterpreter::STWX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::STVEHX(u32 vs, u32 ra, u32 rb) { - ThisCall3("STVEHX", &PPUInterpreter::STVEHX, &m_interpreter, vs, ra, rb); + ThisCall("STVEHX", &PPUInterpreter::STVEHX, &m_interpreter, vs, ra, rb); } void PPULLVMRecompiler::STDUX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STDUX", &PPUInterpreter::STDUX, &m_interpreter, rs, ra, rb); + ThisCall("STDUX", &PPUInterpreter::STDUX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::STWUX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STWUX", &PPUInterpreter::STWUX, &m_interpreter, rs, ra, rb); + ThisCall("STWUX", &PPUInterpreter::STWUX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::STVEWX(u32 vs, u32 ra, u32 rb) { - ThisCall3("STVEWX", &PPUInterpreter::STVEWX, &m_interpreter, vs, ra, rb); + ThisCall("STVEWX", &PPUInterpreter::STVEWX, &m_interpreter, vs, ra, rb); } void PPULLVMRecompiler::ADDZE(u32 rd, u32 ra, u32 oe, bool rc) { - ThisCall4("ADDZE", &PPUInterpreter::ADDZE, &m_interpreter, rd, ra, oe, rc); + ThisCall("ADDZE", &PPUInterpreter::ADDZE, &m_interpreter, rd, ra, oe, rc); } void PPULLVMRecompiler::SUBFZE(u32 rd, u32 ra, u32 oe, bool rc) { - ThisCall4("SUBFZE", &PPUInterpreter::SUBFZE, &m_interpreter, rd, ra, oe, rc); + ThisCall("SUBFZE", &PPUInterpreter::SUBFZE, &m_interpreter, rd, ra, oe, rc); } void PPULLVMRecompiler::STDCX_(u32 rs, u32 ra, u32 rb) { - ThisCall3("STDCX_", &PPUInterpreter::STDCX_, &m_interpreter, rs, ra, rb); + ThisCall("STDCX_", &PPUInterpreter::STDCX_, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::STBX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STBX", &PPUInterpreter::STBX, &m_interpreter, rs, ra, rb); + ThisCall("STBX", &PPUInterpreter::STBX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::STVX(u32 vs, u32 ra, u32 rb) { - ThisCall3("STVX", &PPUInterpreter::STVX, &m_interpreter, vs, ra, rb); + ThisCall("STVX", &PPUInterpreter::STVX, &m_interpreter, vs, ra, rb); } void PPULLVMRecompiler::SUBFME(u32 rd, u32 ra, u32 oe, bool rc) { - ThisCall4("SUBFME", &PPUInterpreter::SUBFME, &m_interpreter, rd, ra, oe, rc); + ThisCall("SUBFME", &PPUInterpreter::SUBFME, &m_interpreter, rd, ra, oe, rc); } void PPULLVMRecompiler::MULLD(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("MULLD", &PPUInterpreter::MULLD, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("MULLD", &PPUInterpreter::MULLD, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::ADDME(u32 rd, u32 ra, u32 oe, bool rc) { - ThisCall4("ADDME", &PPUInterpreter::ADDME, &m_interpreter, rd, ra, oe, rc); + ThisCall("ADDME", &PPUInterpreter::ADDME, &m_interpreter, rd, ra, oe, rc); } void PPULLVMRecompiler::MULLW(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("MULLW", &PPUInterpreter::MULLW, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("MULLW", &PPUInterpreter::MULLW, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::DCBTST(u32 ra, u32 rb, u32 th) { - ThisCall3("DCBTST", &PPUInterpreter::DCBTST, &m_interpreter, ra, rb, th); + ThisCall("DCBTST", &PPUInterpreter::DCBTST, &m_interpreter, ra, rb, th); } void PPULLVMRecompiler::STBUX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STBUX", &PPUInterpreter::STBUX, &m_interpreter, rs, ra, rb); + ThisCall("STBUX", &PPUInterpreter::STBUX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::ADD(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("ADD", &PPUInterpreter::ADD, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("ADD", &PPUInterpreter::ADD, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::DCBT(u32 ra, u32 rb, u32 th) { - ThisCall3("DCBT", &PPUInterpreter::DCBT, &m_interpreter, ra, rb, th); + ThisCall("DCBT", &PPUInterpreter::DCBT, &m_interpreter, ra, rb, th); } void PPULLVMRecompiler::LHZX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LHZX", &PPUInterpreter::LHZX, &m_interpreter, rd, ra, rb); + ThisCall("LHZX", &PPUInterpreter::LHZX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::EQV(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("EQV", &PPUInterpreter::EQV, &m_interpreter, ra, rs, rb, rc); + ThisCall("EQV", &PPUInterpreter::EQV, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::ECIWX(u32 rd, u32 ra, u32 rb) { - ThisCall3("ECIWX", &PPUInterpreter::ECIWX, &m_interpreter, rd, ra, rb); + ThisCall("ECIWX", &PPUInterpreter::ECIWX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::LHZUX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LHZUX", &PPUInterpreter::LHZUX, &m_interpreter, rd, ra, rb); + ThisCall("LHZUX", &PPUInterpreter::LHZUX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::XOR(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("XOR", &PPUInterpreter::XOR, &m_interpreter, ra, rs, rb, rc); + ThisCall("XOR", &PPUInterpreter::XOR, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::MFSPR(u32 rd, u32 spr) { - ThisCall2("MFSPR", &PPUInterpreter::MFSPR, &m_interpreter, rd, spr); + ThisCall("MFSPR", &PPUInterpreter::MFSPR, &m_interpreter, rd, spr); } void PPULLVMRecompiler::LWAX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LWAX", &PPUInterpreter::LWAX, &m_interpreter, rd, ra, rb); + ThisCall("LWAX", &PPUInterpreter::LWAX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::DST(u32 ra, u32 rb, u32 strm, u32 t) { - ThisCall4("DST", &PPUInterpreter::DST, &m_interpreter, ra, rb, strm, t); + ThisCall("DST", &PPUInterpreter::DST, &m_interpreter, ra, rb, strm, t); } void PPULLVMRecompiler::LHAX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LHAX", &PPUInterpreter::LHAX, &m_interpreter, rd, ra, rb); + ThisCall("LHAX", &PPUInterpreter::LHAX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::LVXL(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVXL", &PPUInterpreter::LVXL, &m_interpreter, vd, ra, rb); + ThisCall("LVXL", &PPUInterpreter::LVXL, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::MFTB(u32 rd, u32 spr) { - ThisCall2("MFTB", &PPUInterpreter::MFTB, &m_interpreter, rd, spr); + ThisCall("MFTB", &PPUInterpreter::MFTB, &m_interpreter, rd, spr); } void PPULLVMRecompiler::LWAUX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LWAUX", &PPUInterpreter::LWAUX, &m_interpreter, rd, ra, rb); + ThisCall("LWAUX", &PPUInterpreter::LWAUX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::DSTST(u32 ra, u32 rb, u32 strm, u32 t) { - ThisCall4("DSTST", &PPUInterpreter::DSTST, &m_interpreter, ra, rb, strm, t); + ThisCall("DSTST", &PPUInterpreter::DSTST, &m_interpreter, ra, rb, strm, t); } void PPULLVMRecompiler::LHAUX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LHAUX", &PPUInterpreter::LHAUX, &m_interpreter, rd, ra, rb); + ThisCall("LHAUX", &PPUInterpreter::LHAUX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::STHX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STHX", &PPUInterpreter::STHX, &m_interpreter, rs, ra, rb); + ThisCall("STHX", &PPUInterpreter::STHX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::ORC(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("ORC", &PPUInterpreter::ORC, &m_interpreter, ra, rs, rb, rc); + ThisCall("ORC", &PPUInterpreter::ORC, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::ECOWX(u32 rs, u32 ra, u32 rb) { - ThisCall3("ECOWX", &PPUInterpreter::ECOWX, &m_interpreter, rs, ra, rb); + ThisCall("ECOWX", &PPUInterpreter::ECOWX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::STHUX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STHUX", &PPUInterpreter::STHUX, &m_interpreter, rs, ra, rb); + ThisCall("STHUX", &PPUInterpreter::STHUX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::OR(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("OR", &PPUInterpreter::OR, &m_interpreter, ra, rs, rb, rc); + ThisCall("OR", &PPUInterpreter::OR, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::DIVDU(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("DIVDU", &PPUInterpreter::DIVDU, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("DIVDU", &PPUInterpreter::DIVDU, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::DIVWU(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("DIVWU", &PPUInterpreter::DIVWU, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("DIVWU", &PPUInterpreter::DIVWU, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::MTSPR(u32 spr, u32 rs) { - ThisCall2("MTSPR", &PPUInterpreter::MTSPR, &m_interpreter, spr, rs); + ThisCall("MTSPR", &PPUInterpreter::MTSPR, &m_interpreter, spr, rs); } void PPULLVMRecompiler::NAND(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("NAND", &PPUInterpreter::NAND, &m_interpreter, ra, rs, rb, rc); + ThisCall("NAND", &PPUInterpreter::NAND, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::STVXL(u32 vs, u32 ra, u32 rb) { - ThisCall3("STVXL", &PPUInterpreter::STVXL, &m_interpreter, vs, ra, rb); + ThisCall("STVXL", &PPUInterpreter::STVXL, &m_interpreter, vs, ra, rb); } void PPULLVMRecompiler::DIVD(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("DIVD", &PPUInterpreter::DIVD, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("DIVD", &PPUInterpreter::DIVD, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::DIVW(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) { - ThisCall5("DIVW", &PPUInterpreter::DIVW, &m_interpreter, rd, ra, rb, oe, rc); + ThisCall("DIVW", &PPUInterpreter::DIVW, &m_interpreter, rd, ra, rb, oe, rc); } void PPULLVMRecompiler::LVLX(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVLX", &PPUInterpreter::LVLX, &m_interpreter, vd, ra, rb); + ThisCall("LVLX", &PPUInterpreter::LVLX, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::LDBRX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LDBRX", &PPUInterpreter::LDBRX, &m_interpreter, rd, ra, rb); + ThisCall("LDBRX", &PPUInterpreter::LDBRX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::LSWX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LSWX", &PPUInterpreter::LSWX, &m_interpreter, rd, ra, rb); + ThisCall("LSWX", &PPUInterpreter::LSWX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::LWBRX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LWBRX", &PPUInterpreter::LWBRX, &m_interpreter, rd, ra, rb); + ThisCall("LWBRX", &PPUInterpreter::LWBRX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::LFSX(u32 frd, u32 ra, u32 rb) { - ThisCall3("LFSX", &PPUInterpreter::LFSX, &m_interpreter, frd, ra, rb); + ThisCall("LFSX", &PPUInterpreter::LFSX, &m_interpreter, frd, ra, rb); } void PPULLVMRecompiler::SRW(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("SRW", &PPUInterpreter::SRW, &m_interpreter, ra, rs, rb, rc); + ThisCall("SRW", &PPUInterpreter::SRW, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::SRD(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("SRD", &PPUInterpreter::SRD, &m_interpreter, ra, rs, rb, rc); + ThisCall("SRD", &PPUInterpreter::SRD, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::LVRX(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVRX", &PPUInterpreter::LVRX, &m_interpreter, vd, ra, rb); + ThisCall("LVRX", &PPUInterpreter::LVRX, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::LSWI(u32 rd, u32 ra, u32 nb) { - ThisCall3("LSWI", &PPUInterpreter::LSWI, &m_interpreter, rd, ra, nb); + ThisCall("LSWI", &PPUInterpreter::LSWI, &m_interpreter, rd, ra, nb); } void PPULLVMRecompiler::LFSUX(u32 frd, u32 ra, u32 rb) { - ThisCall3("LFSUX", &PPUInterpreter::LFSUX, &m_interpreter, frd, ra, rb); + ThisCall("LFSUX", &PPUInterpreter::LFSUX, &m_interpreter, frd, ra, rb); } void PPULLVMRecompiler::SYNC(u32 l) { - ThisCall1("SYNC", &PPUInterpreter::SYNC, &m_interpreter, l); + ThisCall("SYNC", &PPUInterpreter::SYNC, &m_interpreter, l); } void PPULLVMRecompiler::LFDX(u32 frd, u32 ra, u32 rb) { - ThisCall3("LFDX", &PPUInterpreter::LFDX, &m_interpreter, frd, ra, rb); + ThisCall("LFDX", &PPUInterpreter::LFDX, &m_interpreter, frd, ra, rb); } void PPULLVMRecompiler::LFDUX(u32 frd, u32 ra, u32 rb) { - ThisCall3("LFDUX", &PPUInterpreter::LFDUX, &m_interpreter, frd, ra, rb); + ThisCall("LFDUX", &PPUInterpreter::LFDUX, &m_interpreter, frd, ra, rb); } void PPULLVMRecompiler::STVLX(u32 vs, u32 ra, u32 rb) { - ThisCall3("STVLX", &PPUInterpreter::STVLX, &m_interpreter, vs, ra, rb); + ThisCall("STVLX", &PPUInterpreter::STVLX, &m_interpreter, vs, ra, rb); } void PPULLVMRecompiler::STSWX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STSWX", &PPUInterpreter::STSWX, &m_interpreter, rs, ra, rb); + ThisCall("STSWX", &PPUInterpreter::STSWX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::STWBRX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STWBRX", &PPUInterpreter::STWBRX, &m_interpreter, rs, ra, rb); + ThisCall("STWBRX", &PPUInterpreter::STWBRX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::STFSX(u32 frs, u32 ra, u32 rb) { - ThisCall3("STFSX", &PPUInterpreter::STFSX, &m_interpreter, frs, ra, rb); + ThisCall("STFSX", &PPUInterpreter::STFSX, &m_interpreter, frs, ra, rb); } void PPULLVMRecompiler::STVRX(u32 vs, u32 ra, u32 rb) { - ThisCall3("STVRX", &PPUInterpreter::STVRX, &m_interpreter, vs, ra, rb); + ThisCall("STVRX", &PPUInterpreter::STVRX, &m_interpreter, vs, ra, rb); } void PPULLVMRecompiler::STFSUX(u32 frs, u32 ra, u32 rb) { - ThisCall3("STFSUX", &PPUInterpreter::STFSUX, &m_interpreter, frs, ra, rb); + ThisCall("STFSUX", &PPUInterpreter::STFSUX, &m_interpreter, frs, ra, rb); } void PPULLVMRecompiler::STSWI(u32 rd, u32 ra, u32 nb) { - ThisCall3("STSWI", &PPUInterpreter::STSWI, &m_interpreter, rd, ra, nb); + ThisCall("STSWI", &PPUInterpreter::STSWI, &m_interpreter, rd, ra, nb); } void PPULLVMRecompiler::STFDX(u32 frs, u32 ra, u32 rb) { - ThisCall3("STFDX", &PPUInterpreter::STFDX, &m_interpreter, frs, ra, rb); + ThisCall("STFDX", &PPUInterpreter::STFDX, &m_interpreter, frs, ra, rb); } void PPULLVMRecompiler::STFDUX(u32 frs, u32 ra, u32 rb) { - ThisCall3("STFDUX", &PPUInterpreter::STFDUX, &m_interpreter, frs, ra, rb); + ThisCall("STFDUX", &PPUInterpreter::STFDUX, &m_interpreter, frs, ra, rb); } void PPULLVMRecompiler::LVLXL(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVLXL", &PPUInterpreter::LVLXL, &m_interpreter, vd, ra, rb); + ThisCall("LVLXL", &PPUInterpreter::LVLXL, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::LHBRX(u32 rd, u32 ra, u32 rb) { - ThisCall3("LHBRX", &PPUInterpreter::LHBRX, &m_interpreter, rd, ra, rb); + ThisCall("LHBRX", &PPUInterpreter::LHBRX, &m_interpreter, rd, ra, rb); } void PPULLVMRecompiler::SRAW(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("SRAW", &PPUInterpreter::SRAW, &m_interpreter, ra, rs, rb, rc); + ThisCall("SRAW", &PPUInterpreter::SRAW, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::SRAD(u32 ra, u32 rs, u32 rb, bool rc) { - ThisCall4("SRAD", &PPUInterpreter::SRAD, &m_interpreter, ra, rs, rb, rc); + ThisCall("SRAD", &PPUInterpreter::SRAD, &m_interpreter, ra, rs, rb, rc); } void PPULLVMRecompiler::LVRXL(u32 vd, u32 ra, u32 rb) { - ThisCall3("LVRXL", &PPUInterpreter::LVRXL, &m_interpreter, vd, ra, rb); + ThisCall("LVRXL", &PPUInterpreter::LVRXL, &m_interpreter, vd, ra, rb); } void PPULLVMRecompiler::DSS(u32 strm, u32 a) { - ThisCall2("DSS", &PPUInterpreter::DSS, &m_interpreter, strm, a); + ThisCall("DSS", &PPUInterpreter::DSS, &m_interpreter, strm, a); } void PPULLVMRecompiler::SRAWI(u32 ra, u32 rs, u32 sh, bool rc) { - ThisCall4("SRAWI", &PPUInterpreter::SRAWI, &m_interpreter, ra, rs, sh, rc); + ThisCall("SRAWI", &PPUInterpreter::SRAWI, &m_interpreter, ra, rs, sh, rc); } void PPULLVMRecompiler::SRADI1(u32 ra, u32 rs, u32 sh, bool rc) { - ThisCall4("SRADI1", &PPUInterpreter::SRADI1, &m_interpreter, ra, rs, sh, rc); + ThisCall("SRADI1", &PPUInterpreter::SRADI1, &m_interpreter, ra, rs, sh, rc); } void PPULLVMRecompiler::SRADI2(u32 ra, u32 rs, u32 sh, bool rc) { - ThisCall4("SRADI2", &PPUInterpreter::SRADI2, &m_interpreter, ra, rs, sh, rc); + ThisCall("SRADI2", &PPUInterpreter::SRADI2, &m_interpreter, ra, rs, sh, rc); } void PPULLVMRecompiler::EIEIO() { - ThisCall0("EIEIO", &PPUInterpreter::EIEIO, &m_interpreter); + ThisCall("EIEIO", &PPUInterpreter::EIEIO, &m_interpreter); } void PPULLVMRecompiler::STVLXL(u32 vs, u32 ra, u32 rb) { - ThisCall3("STVLXL", &PPUInterpreter::STVLXL, &m_interpreter, vs, ra, rb); + ThisCall("STVLXL", &PPUInterpreter::STVLXL, &m_interpreter, vs, ra, rb); } void PPULLVMRecompiler::STHBRX(u32 rs, u32 ra, u32 rb) { - ThisCall3("STHBRX", &PPUInterpreter::STHBRX, &m_interpreter, rs, ra, rb); + ThisCall("STHBRX", &PPUInterpreter::STHBRX, &m_interpreter, rs, ra, rb); } void PPULLVMRecompiler::EXTSH(u32 ra, u32 rs, bool rc) { - ThisCall3("EXTSH", &PPUInterpreter::EXTSH, &m_interpreter, ra, rs, rc); + ThisCall("EXTSH", &PPUInterpreter::EXTSH, &m_interpreter, ra, rs, rc); } void PPULLVMRecompiler::STVRXL(u32 vs, u32 ra, u32 rb) { - ThisCall3("STVRXL", &PPUInterpreter::STVRXL, &m_interpreter, vs, ra, rb); + ThisCall("STVRXL", &PPUInterpreter::STVRXL, &m_interpreter, vs, ra, rb); } void PPULLVMRecompiler::EXTSB(u32 ra, u32 rs, bool rc) { - ThisCall3("EXTSB", &PPUInterpreter::EXTSB, &m_interpreter, ra, rs, rc); + ThisCall("EXTSB", &PPUInterpreter::EXTSB, &m_interpreter, ra, rs, rc); } void PPULLVMRecompiler::STFIWX(u32 frs, u32 ra, u32 rb) { - ThisCall3("STFIWX", &PPUInterpreter::STFIWX, &m_interpreter, frs, ra, rb); + ThisCall("STFIWX", &PPUInterpreter::STFIWX, &m_interpreter, frs, ra, rb); } void PPULLVMRecompiler::EXTSW(u32 ra, u32 rs, bool rc) { - ThisCall3("EXTSW", &PPUInterpreter::EXTSW, &m_interpreter, ra, rs, rc); + ThisCall("EXTSW", &PPUInterpreter::EXTSW, &m_interpreter, ra, rs, rc); } void PPULLVMRecompiler::ICBI(u32 ra, u32 rs) { - ThisCall2("ICBI", &PPUInterpreter::ICBI, &m_interpreter, ra, rs); + ThisCall("ICBI", &PPUInterpreter::ICBI, &m_interpreter, ra, rs); } void PPULLVMRecompiler::DCBZ(u32 ra, u32 rb) { - ThisCall2("DCBZ", &PPUInterpreter::DCBZ, &m_interpreter, ra, rb); + ThisCall("DCBZ", &PPUInterpreter::DCBZ, &m_interpreter, ra, rb); } void PPULLVMRecompiler::LWZ(u32 rd, u32 ra, s32 d) { - ThisCall3("LWZ", &PPUInterpreter::LWZ, &m_interpreter, rd, ra, d); + ThisCall("LWZ", &PPUInterpreter::LWZ, &m_interpreter, rd, ra, d); } void PPULLVMRecompiler::LWZU(u32 rd, u32 ra, s32 d) { - ThisCall3("LWZU", &PPUInterpreter::LWZU, &m_interpreter, rd, ra, d); + ThisCall("LWZU", &PPUInterpreter::LWZU, &m_interpreter, rd, ra, d); } void PPULLVMRecompiler::LBZ(u32 rd, u32 ra, s32 d) { - ThisCall3("LBZ", &PPUInterpreter::LBZ, &m_interpreter, rd, ra, d); + ThisCall("LBZ", &PPUInterpreter::LBZ, &m_interpreter, rd, ra, d); } void PPULLVMRecompiler::LBZU(u32 rd, u32 ra, s32 d) { - ThisCall3("LBZU", &PPUInterpreter::LBZU, &m_interpreter, rd, ra, d); + ThisCall("LBZU", &PPUInterpreter::LBZU, &m_interpreter, rd, ra, d); } void PPULLVMRecompiler::STW(u32 rs, u32 ra, s32 d) { - ThisCall3("STW", &PPUInterpreter::STW, &m_interpreter, rs, ra, d); + ThisCall("STW", &PPUInterpreter::STW, &m_interpreter, rs, ra, d); } void PPULLVMRecompiler::STWU(u32 rs, u32 ra, s32 d) { - ThisCall3("STWU", &PPUInterpreter::STWU, &m_interpreter, rs, ra, d); + ThisCall("STWU", &PPUInterpreter::STWU, &m_interpreter, rs, ra, d); } void PPULLVMRecompiler::STB(u32 rs, u32 ra, s32 d) { - ThisCall3("STB", &PPUInterpreter::STB, &m_interpreter, rs, ra, d); + ThisCall("STB", &PPUInterpreter::STB, &m_interpreter, rs, ra, d); } void PPULLVMRecompiler::STBU(u32 rs, u32 ra, s32 d) { - ThisCall3("STBU", &PPUInterpreter::STBU, &m_interpreter, rs, ra, d); + ThisCall("STBU", &PPUInterpreter::STBU, &m_interpreter, rs, ra, d); } void PPULLVMRecompiler::LHZ(u32 rd, u32 ra, s32 d) { - ThisCall3("LHZ", &PPUInterpreter::LHZ, &m_interpreter, rd, ra, d); + ThisCall("LHZ", &PPUInterpreter::LHZ, &m_interpreter, rd, ra, d); } void PPULLVMRecompiler::LHZU(u32 rd, u32 ra, s32 d) { - ThisCall3("LHZU", &PPUInterpreter::LHZU, &m_interpreter, rd, ra, d); + ThisCall("LHZU", &PPUInterpreter::LHZU, &m_interpreter, rd, ra, d); } void PPULLVMRecompiler::LHA(u32 rd, u32 ra, s32 d) { - ThisCall3("LHA", &PPUInterpreter::LHA, &m_interpreter, rd, ra, d); + ThisCall("LHA", &PPUInterpreter::LHA, &m_interpreter, rd, ra, d); } void PPULLVMRecompiler::LHAU(u32 rd, u32 ra, s32 d) { - ThisCall3("LHAU", &PPUInterpreter::LHAU, &m_interpreter, rd, ra, d); + ThisCall("LHAU", &PPUInterpreter::LHAU, &m_interpreter, rd, ra, d); } void PPULLVMRecompiler::STH(u32 rs, u32 ra, s32 d) { - ThisCall3("STH", &PPUInterpreter::STH, &m_interpreter, rs, ra, d); + ThisCall("STH", &PPUInterpreter::STH, &m_interpreter, rs, ra, d); } void PPULLVMRecompiler::STHU(u32 rs, u32 ra, s32 d) { - ThisCall3("STHU", &PPUInterpreter::STHU, &m_interpreter, rs, ra, d); + ThisCall("STHU", &PPUInterpreter::STHU, &m_interpreter, rs, ra, d); } void PPULLVMRecompiler::LMW(u32 rd, u32 ra, s32 d) { - ThisCall3("LMW", &PPUInterpreter::LMW, &m_interpreter, rd, ra, d); + ThisCall("LMW", &PPUInterpreter::LMW, &m_interpreter, rd, ra, d); } void PPULLVMRecompiler::STMW(u32 rs, u32 ra, s32 d) { - ThisCall3("STMW", &PPUInterpreter::STMW, &m_interpreter, rs, ra, d); + ThisCall("STMW", &PPUInterpreter::STMW, &m_interpreter, rs, ra, d); } void PPULLVMRecompiler::LFS(u32 frd, u32 ra, s32 d) { - ThisCall3("LFS", &PPUInterpreter::LFS, &m_interpreter, frd, ra, d); + ThisCall("LFS", &PPUInterpreter::LFS, &m_interpreter, frd, ra, d); } void PPULLVMRecompiler::LFSU(u32 frd, u32 ra, s32 ds) { - ThisCall3("LFSU", &PPUInterpreter::LFSU, &m_interpreter, frd, ra, ds); + ThisCall("LFSU", &PPUInterpreter::LFSU, &m_interpreter, frd, ra, ds); } void PPULLVMRecompiler::LFD(u32 frd, u32 ra, s32 d) { - ThisCall3("LFD", &PPUInterpreter::LFD, &m_interpreter, frd, ra, d); + ThisCall("LFD", &PPUInterpreter::LFD, &m_interpreter, frd, ra, d); } void PPULLVMRecompiler::LFDU(u32 frd, u32 ra, s32 ds) { - ThisCall3("LFDU", &PPUInterpreter::LFDU, &m_interpreter, frd, ra, ds); + ThisCall("LFDU", &PPUInterpreter::LFDU, &m_interpreter, frd, ra, ds); } void PPULLVMRecompiler::STFS(u32 frs, u32 ra, s32 d) { - ThisCall3("STFS", &PPUInterpreter::STFS, &m_interpreter, frs, ra, d); + ThisCall("STFS", &PPUInterpreter::STFS, &m_interpreter, frs, ra, d); } void PPULLVMRecompiler::STFSU(u32 frs, u32 ra, s32 d) { - ThisCall3("STFSU", &PPUInterpreter::STFSU, &m_interpreter, frs, ra, d); + ThisCall("STFSU", &PPUInterpreter::STFSU, &m_interpreter, frs, ra, d); } void PPULLVMRecompiler::STFD(u32 frs, u32 ra, s32 d) { - ThisCall3("STFD", &PPUInterpreter::STFD, &m_interpreter, frs, ra, d); + ThisCall("STFD", &PPUInterpreter::STFD, &m_interpreter, frs, ra, d); } void PPULLVMRecompiler::STFDU(u32 frs, u32 ra, s32 d) { - ThisCall3("STFDU", &PPUInterpreter::STFDU, &m_interpreter, frs, ra, d); + ThisCall("STFDU", &PPUInterpreter::STFDU, &m_interpreter, frs, ra, d); } void PPULLVMRecompiler::LD(u32 rd, u32 ra, s32 ds) { - ThisCall3("LD", &PPUInterpreter::LD, &m_interpreter, rd, ra, ds); + ThisCall("LD", &PPUInterpreter::LD, &m_interpreter, rd, ra, ds); } void PPULLVMRecompiler::LDU(u32 rd, u32 ra, s32 ds) { - ThisCall3("LDU", &PPUInterpreter::LDU, &m_interpreter, rd, ra, ds); + ThisCall("LDU", &PPUInterpreter::LDU, &m_interpreter, rd, ra, ds); } void PPULLVMRecompiler::LWA(u32 rd, u32 ra, s32 ds) { - ThisCall3("LWA", &PPUInterpreter::LWA, &m_interpreter, rd, ra, ds); + ThisCall("LWA", &PPUInterpreter::LWA, &m_interpreter, rd, ra, ds); } void PPULLVMRecompiler::FDIVS(u32 frd, u32 fra, u32 frb, bool rc) { - ThisCall4("FDIVS", &PPUInterpreter::FDIVS, &m_interpreter, frd, fra, frb, rc); + ThisCall("FDIVS", &PPUInterpreter::FDIVS, &m_interpreter, frd, fra, frb, rc); } void PPULLVMRecompiler::FSUBS(u32 frd, u32 fra, u32 frb, bool rc) { - ThisCall4("FSUBS", &PPUInterpreter::FSUBS, &m_interpreter, frd, fra, frb, rc); + ThisCall("FSUBS", &PPUInterpreter::FSUBS, &m_interpreter, frd, fra, frb, rc); } void PPULLVMRecompiler::FADDS(u32 frd, u32 fra, u32 frb, bool rc) { - ThisCall4("FADDS", &PPUInterpreter::FADDS, &m_interpreter, frd, fra, frb, rc); + ThisCall("FADDS", &PPUInterpreter::FADDS, &m_interpreter, frd, fra, frb, rc); } void PPULLVMRecompiler::FSQRTS(u32 frd, u32 frb, bool rc) { - ThisCall3("FSQRTS", &PPUInterpreter::FSQRTS, &m_interpreter, frd, frb, rc); + ThisCall("FSQRTS", &PPUInterpreter::FSQRTS, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FRES(u32 frd, u32 frb, bool rc) { - ThisCall3("FRES", &PPUInterpreter::FRES, &m_interpreter, frd, frb, rc); + ThisCall("FRES", &PPUInterpreter::FRES, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FMULS(u32 frd, u32 fra, u32 frc, bool rc) { - ThisCall4("FMULS", &PPUInterpreter::FMULS, &m_interpreter, frd, fra, frc, rc); + ThisCall("FMULS", &PPUInterpreter::FMULS, &m_interpreter, frd, fra, frc, rc); } void PPULLVMRecompiler::FMADDS(u32 frd, u32 fra, u32 frc, u32 frb, bool rc) { - ThisCall5("FMADDS", &PPUInterpreter::FMADDS, &m_interpreter, frd, fra, frc, frb, rc); + ThisCall("FMADDS", &PPUInterpreter::FMADDS, &m_interpreter, frd, fra, frc, frb, rc); } void PPULLVMRecompiler::FMSUBS(u32 frd, u32 fra, u32 frc, u32 frb, bool rc) { - ThisCall5("FMSUBS", &PPUInterpreter::FMSUBS, &m_interpreter, frd, fra, frc, frb, rc); + ThisCall("FMSUBS", &PPUInterpreter::FMSUBS, &m_interpreter, frd, fra, frc, frb, rc); } void PPULLVMRecompiler::FNMSUBS(u32 frd, u32 fra, u32 frc, u32 frb, bool rc) { - ThisCall5("FNMSUBS", &PPUInterpreter::FNMSUBS, &m_interpreter, frd, fra, frc, frb, rc); + ThisCall("FNMSUBS", &PPUInterpreter::FNMSUBS, &m_interpreter, frd, fra, frc, frb, rc); } void PPULLVMRecompiler::FNMADDS(u32 frd, u32 fra, u32 frc, u32 frb, bool rc) { - ThisCall5("FNMADDS", &PPUInterpreter::FNMADDS, &m_interpreter, frd, fra, frc, frb, rc); + ThisCall("FNMADDS", &PPUInterpreter::FNMADDS, &m_interpreter, frd, fra, frc, frb, rc); } void PPULLVMRecompiler::STD(u32 rs, u32 ra, s32 d) { - ThisCall3("STD", &PPUInterpreter::STD, &m_interpreter, rs, ra, d); + ThisCall("STD", &PPUInterpreter::STD, &m_interpreter, rs, ra, d); } void PPULLVMRecompiler::STDU(u32 rs, u32 ra, s32 ds) { - ThisCall3("STDU", &PPUInterpreter::STDU, &m_interpreter, rs, ra, ds); + ThisCall("STDU", &PPUInterpreter::STDU, &m_interpreter, rs, ra, ds); } void PPULLVMRecompiler::MTFSB1(u32 crbd, bool rc) { - ThisCall2("MTFSB1", &PPUInterpreter::MTFSB1, &m_interpreter, crbd, rc); + ThisCall("MTFSB1", &PPUInterpreter::MTFSB1, &m_interpreter, crbd, rc); } void PPULLVMRecompiler::MCRFS(u32 crbd, u32 crbs) { - ThisCall2("MCRFS", &PPUInterpreter::MCRFS, &m_interpreter, crbd, crbs); + ThisCall("MCRFS", &PPUInterpreter::MCRFS, &m_interpreter, crbd, crbs); } void PPULLVMRecompiler::MTFSB0(u32 crbd, bool rc) { - ThisCall2("MTFSB0", &PPUInterpreter::MTFSB0, &m_interpreter, crbd, rc); + ThisCall("MTFSB0", &PPUInterpreter::MTFSB0, &m_interpreter, crbd, rc); } void PPULLVMRecompiler::MTFSFI(u32 crfd, u32 i, bool rc) { - ThisCall3("MTFSFI", &PPUInterpreter::MTFSFI, &m_interpreter, crfd, i, rc); + ThisCall("MTFSFI", &PPUInterpreter::MTFSFI, &m_interpreter, crfd, i, rc); } void PPULLVMRecompiler::MFFS(u32 frd, bool rc) { - ThisCall2("MFFS", &PPUInterpreter::MFFS, &m_interpreter, frd, rc); + ThisCall("MFFS", &PPUInterpreter::MFFS, &m_interpreter, frd, rc); } void PPULLVMRecompiler::MTFSF(u32 flm, u32 frb, bool rc) { - ThisCall3("MTFSF", &PPUInterpreter::MTFSF, &m_interpreter, flm, frb, rc); + ThisCall("MTFSF", &PPUInterpreter::MTFSF, &m_interpreter, flm, frb, rc); } void PPULLVMRecompiler::FCMPU(u32 crfd, u32 fra, u32 frb) { - ThisCall3("FCMPU", &PPUInterpreter::FCMPU, &m_interpreter, crfd, fra, frb); + ThisCall("FCMPU", &PPUInterpreter::FCMPU, &m_interpreter, crfd, fra, frb); } void PPULLVMRecompiler::FRSP(u32 frd, u32 frb, bool rc) { - ThisCall3("FRSP", &PPUInterpreter::FRSP, &m_interpreter, frd, frb, rc); + ThisCall("FRSP", &PPUInterpreter::FRSP, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FCTIW(u32 frd, u32 frb, bool rc) { - ThisCall3("FCTIW", &PPUInterpreter::FCTIW, &m_interpreter, frd, frb, rc); + ThisCall("FCTIW", &PPUInterpreter::FCTIW, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FCTIWZ(u32 frd, u32 frb, bool rc) { - ThisCall3("FCTIWZ", &PPUInterpreter::FCTIWZ, &m_interpreter, frd, frb, rc); + ThisCall("FCTIWZ", &PPUInterpreter::FCTIWZ, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FDIV(u32 frd, u32 fra, u32 frb, bool rc) { - ThisCall4("FDIV", &PPUInterpreter::FDIV, &m_interpreter, frd, fra, frb, rc); + ThisCall("FDIV", &PPUInterpreter::FDIV, &m_interpreter, frd, fra, frb, rc); } void PPULLVMRecompiler::FSUB(u32 frd, u32 fra, u32 frb, bool rc) { - ThisCall4("FSUB", &PPUInterpreter::FSUB, &m_interpreter, frd, fra, frb, rc); + ThisCall("FSUB", &PPUInterpreter::FSUB, &m_interpreter, frd, fra, frb, rc); } void PPULLVMRecompiler::FADD(u32 frd, u32 fra, u32 frb, bool rc) { - ThisCall4("FADD", &PPUInterpreter::FADD, &m_interpreter, frd, fra, frb, rc); + ThisCall("FADD", &PPUInterpreter::FADD, &m_interpreter, frd, fra, frb, rc); } void PPULLVMRecompiler::FSQRT(u32 frd, u32 frb, bool rc) { - ThisCall3("FSQRT", &PPUInterpreter::FSQRT, &m_interpreter, frd, frb, rc); + ThisCall("FSQRT", &PPUInterpreter::FSQRT, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FSEL(u32 frd, u32 fra, u32 frc, u32 frb, bool rc) { - ThisCall5("FSEL", &PPUInterpreter::FSEL, &m_interpreter, frd, fra, frc, frb, rc); + ThisCall("FSEL", &PPUInterpreter::FSEL, &m_interpreter, frd, fra, frc, frb, rc); } void PPULLVMRecompiler::FMUL(u32 frd, u32 fra, u32 frc, bool rc) { - ThisCall4("FMUL", &PPUInterpreter::FMUL, &m_interpreter, frd, fra, frc, rc); + ThisCall("FMUL", &PPUInterpreter::FMUL, &m_interpreter, frd, fra, frc, rc); } void PPULLVMRecompiler::FRSQRTE(u32 frd, u32 frb, bool rc) { - ThisCall3("FRSQRTE", &PPUInterpreter::FRSQRTE, &m_interpreter, frd, frb, rc); + ThisCall("FRSQRTE", &PPUInterpreter::FRSQRTE, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FMSUB(u32 frd, u32 fra, u32 frc, u32 frb, bool rc) { - ThisCall5("FMSUB", &PPUInterpreter::FMSUB, &m_interpreter, frd, fra, frc, frb, rc); + ThisCall("FMSUB", &PPUInterpreter::FMSUB, &m_interpreter, frd, fra, frc, frb, rc); } void PPULLVMRecompiler::FMADD(u32 frd, u32 fra, u32 frc, u32 frb, bool rc) { - ThisCall5("FMADD", &PPUInterpreter::FMADD, &m_interpreter, frd, fra, frc, frb, rc); + ThisCall("FMADD", &PPUInterpreter::FMADD, &m_interpreter, frd, fra, frc, frb, rc); } void PPULLVMRecompiler::FNMSUB(u32 frd, u32 fra, u32 frc, u32 frb, bool rc) { - ThisCall5("FNMSUB", &PPUInterpreter::FNMSUB, &m_interpreter, frd, fra, frc, frb, rc); + ThisCall("FNMSUB", &PPUInterpreter::FNMSUB, &m_interpreter, frd, fra, frc, frb, rc); } void PPULLVMRecompiler::FNMADD(u32 frd, u32 fra, u32 frc, u32 frb, bool rc) { - ThisCall5("FNMADD", &PPUInterpreter::FNMADD, &m_interpreter, frd, fra, frc, frb, rc); + ThisCall("FNMADD", &PPUInterpreter::FNMADD, &m_interpreter, frd, fra, frc, frb, rc); } void PPULLVMRecompiler::FCMPO(u32 crfd, u32 fra, u32 frb) { - ThisCall3("FCMPO", &PPUInterpreter::FCMPO, &m_interpreter, crfd, fra, frb); + ThisCall("FCMPO", &PPUInterpreter::FCMPO, &m_interpreter, crfd, fra, frb); } void PPULLVMRecompiler::FNEG(u32 frd, u32 frb, bool rc) { - ThisCall3("FNEG", &PPUInterpreter::FNEG, &m_interpreter, frd, frb, rc); + ThisCall("FNEG", &PPUInterpreter::FNEG, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FMR(u32 frd, u32 frb, bool rc) { - ThisCall3("FMR", &PPUInterpreter::FMR, &m_interpreter, frd, frb, rc); + ThisCall("FMR", &PPUInterpreter::FMR, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FNABS(u32 frd, u32 frb, bool rc) { - ThisCall3("FNABS", &PPUInterpreter::FNABS, &m_interpreter, frd, frb, rc); + ThisCall("FNABS", &PPUInterpreter::FNABS, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FABS(u32 frd, u32 frb, bool rc) { - ThisCall3("FABS", &PPUInterpreter::FABS, &m_interpreter, frd, frb, rc); + ThisCall("FABS", &PPUInterpreter::FABS, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FCTID(u32 frd, u32 frb, bool rc) { - ThisCall3("FCTID", &PPUInterpreter::FCTID, &m_interpreter, frd, frb, rc); + ThisCall("FCTID", &PPUInterpreter::FCTID, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FCTIDZ(u32 frd, u32 frb, bool rc) { - ThisCall3("FCTIDZ", &PPUInterpreter::FCTIDZ, &m_interpreter, frd, frb, rc); + ThisCall("FCTIDZ", &PPUInterpreter::FCTIDZ, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::FCFID(u32 frd, u32 frb, bool rc) { - ThisCall3("FCFID", &PPUInterpreter::FCFID, &m_interpreter, frd, frb, rc); + ThisCall("FCFID", &PPUInterpreter::FCFID, &m_interpreter, frd, frb, rc); } void PPULLVMRecompiler::UNK(const u32 code, const u32 opcode, const u32 gcode) { - //ThisCall3("UNK", &PPUInterpreter::UNK, &m_interpreter, code, opcode, gcode); + //ThisCall("UNK", &PPUInterpreter::UNK, &m_interpreter, code, opcode, gcode); } Value * PPULLVMRecompiler::GetBit(Value * val, u32 n) { @@ -2256,192 +2280,37 @@ void PPULLVMRecompiler::SetVr(u32 vr, Value * val_x128) { m_ir_builder.CreateStore(val_i128, vr_i128_ptr); } -template -void PPULLVMRecompiler::ThisCall0(const char * name, F function, C * this_p) { - static FunctionType * fn_type = nullptr; +template +void PPULLVMRecompiler::ThisCall(const char * name, F function, C * this_ptr, Args... args) { + auto this_call_fn = new std::function(std::bind(function, this_ptr, args...)); + m_this_call_ptrs_list.push_back(this_call_fn); - if (fn_type == nullptr) { - static std::vector fn_args; - fn_args.push_back(Type::getInt64PtrTy(m_llvm_context)); - fn_type = FunctionType::get(Type::getVoidTy(m_llvm_context), fn_args, false); + auto this_call_fn_i64 = m_ir_builder.getInt64((uint64_t)this_call_fn); + auto this_call_fn_ptr = m_ir_builder.CreateIntToPtr(this_call_fn_i64, Type::getInt64PtrTy(m_llvm_context)); + std::vector execute_this_call_fn_args; + execute_this_call_fn_args.push_back(this_call_fn_ptr); + auto call_execute_this_call_fn_instr = m_ir_builder.CreateCall(m_execute_this_call_fn, execute_this_call_fn_args); + + std::string comment = fmt::Format("%s.%s", name, ArgsToString(args...).c_str()); + call_execute_this_call_fn_instr->setMetadata(comment, m_execute_this_call_fn_comment_md_node); + + auto i = m_interpreter_invocation_stats.find(name); + if (i == m_interpreter_invocation_stats.end()) { + i = m_interpreter_invocation_stats.insert(m_interpreter_invocation_stats.end(), std::make_pair(name, 0)); } - auto fn_ptr = m_module->getFunction(name); - if (!fn_ptr) { - fn_ptr = Function::Create(fn_type, GlobalValue::ExternalLinkage, name, m_module); - fn_ptr->setCallingConv(CallingConv::C); - m_execution_engine->addGlobalMapping(fn_ptr, (void *&)function); - } - - auto this_i64 = m_ir_builder.getInt64((uint64_t)this_p); - auto this_ptr = m_ir_builder.CreateIntToPtr(this_i64, Type::getInt64PtrTy(m_llvm_context)); - m_ir_builder.CreateCall(fn_ptr, this_ptr); + i->second++; } -template -void PPULLVMRecompiler::ThisCall1(const char * name, F function, C * this_p, T1 arg1) { - static FunctionType * fn_type = nullptr; - - if (fn_type == nullptr) { - static std::vector fn_args; - fn_args.push_back(Type::getInt64PtrTy(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_type = FunctionType::get(Type::getVoidTy(m_llvm_context), fn_args, false); - } - - auto fn_ptr = m_module->getFunction(name); - if (!fn_ptr) { - fn_ptr = Function::Create(fn_type, GlobalValue::ExternalLinkage, name, m_module); - fn_ptr->setCallingConv(CallingConv::C); - m_execution_engine->addGlobalMapping(fn_ptr, (void *&)function); - } - - auto this_i64 = m_ir_builder.getInt64((uint64_t)this_p); - auto this_ptr = m_ir_builder.CreateIntToPtr(this_i64, Type::getInt64PtrTy(m_llvm_context)); - m_ir_builder.CreateCall2(fn_ptr, this_ptr, m_ir_builder.getInt32(arg1)); +void PPULLVMRecompiler::ExecuteThisCall(std::function * function) { + (*function)(); } -template -void PPULLVMRecompiler::ThisCall2(const char * name, F function, C * this_p, T1 arg1, T2 arg2) { - static FunctionType * fn_type = nullptr; - - if (fn_type == nullptr) { - static std::vector fn_args; - fn_args.push_back(Type::getInt64PtrTy(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_type = FunctionType::get(Type::getVoidTy(m_llvm_context), fn_args, false); - } - - auto fn_ptr = m_module->getFunction(name); - if (!fn_ptr) { - fn_ptr = Function::Create(fn_type, GlobalValue::ExternalLinkage, name, m_module); - fn_ptr->setCallingConv(CallingConv::C); - m_execution_engine->addGlobalMapping(fn_ptr, (void *&)function); - } - - auto this_i64 = m_ir_builder.getInt64((uint64_t)this_p); - auto this_ptr = m_ir_builder.CreateIntToPtr(this_i64, Type::getInt64PtrTy(m_llvm_context)); - m_ir_builder.CreateCall3(fn_ptr, this_ptr, m_ir_builder.getInt32(arg1), m_ir_builder.getInt32(arg2)); +template +std::string PPULLVMRecompiler::ArgsToString(T arg1, Args... args) { + return fmt::Format("%d", arg1) + "." + ArgsToString(args...); } -template -void PPULLVMRecompiler::ThisCall3(const char * name, F function, C * this_p, T1 arg1, T2 arg2, T3 arg3) { - static FunctionType * fn_type = nullptr; - - if (fn_type == nullptr) { - static std::vector fn_args; - fn_args.push_back(Type::getInt64PtrTy(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_type = FunctionType::get(Type::getVoidTy(m_llvm_context), fn_args, false); - } - - auto fn_ptr = m_module->getFunction(name); - if (!fn_ptr) { - fn_ptr = Function::Create(fn_type, GlobalValue::ExternalLinkage, name, m_module); - fn_ptr->setCallingConv(CallingConv::C); - m_execution_engine->addGlobalMapping(fn_ptr, (void *&)function); - } - - auto this_i64 = m_ir_builder.getInt64((uint64_t)this_p); - auto this_ptr = m_ir_builder.CreateIntToPtr(this_i64, Type::getInt64PtrTy(m_llvm_context)); - m_ir_builder.CreateCall4(fn_ptr, this_ptr, m_ir_builder.getInt32(arg1), m_ir_builder.getInt32(arg2), m_ir_builder.getInt32(arg3)); -} - -template -void PPULLVMRecompiler::ThisCall4(const char * name, F function, C * this_p, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { - static FunctionType * fn_type = nullptr; - - if (fn_type == nullptr) { - static std::vector fn_args; - fn_args.push_back(Type::getInt64PtrTy(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_type = FunctionType::get(Type::getVoidTy(m_llvm_context), fn_args, false); - } - - auto fn_ptr = m_module->getFunction(name); - if (!fn_ptr) { - fn_ptr = Function::Create(fn_type, GlobalValue::ExternalLinkage, name, m_module); - fn_ptr->setCallingConv(CallingConv::C); - m_execution_engine->addGlobalMapping(fn_ptr, (void *&)function); - } - - auto this_i64 = m_ir_builder.getInt64((uint64_t)this_p); - auto this_ptr = m_ir_builder.CreateIntToPtr(this_i64, Type::getInt64PtrTy(m_llvm_context)); - m_ir_builder.CreateCall5(fn_ptr, this_ptr, m_ir_builder.getInt32(arg1), m_ir_builder.getInt32(arg2), m_ir_builder.getInt32(arg3), m_ir_builder.getInt32(arg4)); -} - -template -void PPULLVMRecompiler::ThisCall5(const char * name, F function, C * this_p, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) { - static FunctionType * fn_type = nullptr; - - if (fn_type == nullptr) { - static std::vector fn_args; - fn_args.push_back(Type::getInt64PtrTy(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_type = FunctionType::get(Type::getVoidTy(m_llvm_context), fn_args, false); - } - - auto fn_ptr = m_module->getFunction(name); - if (!fn_ptr) { - fn_ptr = Function::Create(fn_type, GlobalValue::ExternalLinkage, name, m_module); - fn_ptr->setCallingConv(CallingConv::C); - m_execution_engine->addGlobalMapping(fn_ptr, (void *&)function); - } - - auto this_i64 = m_ir_builder.getInt64((uint64_t)this_p); - auto this_ptr = m_ir_builder.CreateIntToPtr(this_i64, Type::getInt64PtrTy(m_llvm_context)); - std::vector args; - args.push_back(this_ptr); - args.push_back(m_ir_builder.getInt32(arg1)); - args.push_back(m_ir_builder.getInt32(arg2)); - args.push_back(m_ir_builder.getInt32(arg3)); - args.push_back(m_ir_builder.getInt32(arg4)); - args.push_back(m_ir_builder.getInt32(arg5)); - m_ir_builder.CreateCall(fn_ptr, args); -} - -template -void PPULLVMRecompiler::ThisCall6(const char * name, F function, C * this_p, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) { - static FunctionType * fn_type = nullptr; - - if (fn_type == nullptr) { - static std::vector fn_args; - fn_args.push_back(Type::getInt64PtrTy(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_args.push_back(Type::getInt32Ty(m_llvm_context)); - fn_type = FunctionType::get(Type::getVoidTy(m_llvm_context), fn_args, false); - } - - auto fn_ptr = m_module->getFunction(name); - if (!fn_ptr) { - fn_ptr = Function::Create(fn_type, GlobalValue::ExternalLinkage, name, m_module); - fn_ptr->setCallingConv(CallingConv::C); - m_execution_engine->addGlobalMapping(fn_ptr, (void *&)function); - } - - auto this_i64 = m_ir_builder.getInt64((uint64_t)this_p); - auto this_ptr = m_ir_builder.CreateIntToPtr(this_i64, Type::getInt64PtrTy(m_llvm_context)); - std::vector args; - args.push_back(this_ptr); - args.push_back(m_ir_builder.getInt32(arg1)); - args.push_back(m_ir_builder.getInt32(arg2)); - args.push_back(m_ir_builder.getInt32(arg3)); - args.push_back(m_ir_builder.getInt32(arg4)); - args.push_back(m_ir_builder.getInt32(arg5)); - args.push_back(m_ir_builder.getInt32(arg6)); - m_ir_builder.CreateCall(fn_ptr, args); +std::string PPULLVMRecompiler::ArgsToString() { + return ""; } diff --git a/rpcs3/Emu/Cell/PPULLVMRecompiler.h b/rpcs3/Emu/Cell/PPULLVMRecompiler.h index aea0e3b5d5..8330fb365b 100644 --- a/rpcs3/Emu/Cell/PPULLVMRecompiler.h +++ b/rpcs3/Emu/Cell/PPULLVMRecompiler.h @@ -11,6 +11,8 @@ #include "llvm/ExecutionEngine/JIT.h" #include "llvm/MC/MCDisassembler.h" +struct PPURegState; + /// LLVM based PPU emulator class PPULLVMRecompiler : public CPUDecoder, protected PPUOpcodes { public: @@ -449,6 +451,12 @@ private: /// Module to which all generated code is output to llvm::Module * m_module; + /// Function in m_module that corresponds to ExecuteThisCall + llvm::Function * m_execute_this_call_fn; + + /// A comment metadata node for m_execute_this_call_fn + llvm::MDNode * m_execute_this_call_fn_comment_md_node; + /// Global variable in m_module that corresponds to m_ppu.GPR llvm::GlobalVariable * m_pc; @@ -476,6 +484,18 @@ private: /// PPU Interpreter PPUInterpreter m_interpreter; + /// Time spent compiling + std::chrono::duration m_compilation_time; + + /// Time spent executing + std::chrono::duration m_execution_time; + + /// Contains the number of times the interpreter was invoked for an instruction + std::map m_interpreter_invocation_stats; + + /// List of std::function pointers created by ThisCall() + std::list *> m_this_call_ptrs_list; + /// Get a bit llvm::Value * GetBit(llvm::Value * val, u32 n); @@ -557,33 +577,23 @@ private: /// Set VR to the specified value void SetVr(u32 vr, llvm::Value * val_x128); - /// Call a member function with no arguments - template - void ThisCall0(const char * name, F function, C * this_p); + /// Call a member function + template + void ThisCall(const char * name, F function, C * this_ptr, Args... args); - /// Call a member function with one argument - template - void ThisCall1(const char * name, F function, C * this_p, T1 arg1); + /// Execute a this call + static void ExecuteThisCall(std::function * function); - /// Call a member function with two arguments - template - void ThisCall2(const char * name, F function, C * this_p, T1 arg1, T2 arg2); + /// Convert args to a string + template + static std::string ArgsToString(T arg1, Args... args); - /// Call a member function with three arguments - template - void ThisCall3(const char * name, F function, C * this_p, T1 arg1, T2 arg2, T3 arg3); + /// Terminator for ArgsToString(T arg1, Args... args); + static std::string ArgsToString(); - /// Call a member function with four arguments - template - void ThisCall4(const char * name, F function, C * this_p, T1 arg1, T2 arg2, T3 arg3, T4 arg4); - - /// Call a member function with five arguments - template - void ThisCall5(const char * name, F function, C * this_p, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); - - /// Call a member function with six arguments - template - void ThisCall6(const char * name, F function, C * this_p, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); + /// Test an instruction against the interpreter + template + void VerifyInstructionAgainstInterpreter(const char * name, PPULLVMRecompilerFn recomp_fn, PPUInterpreterFn interp_fn, PPURegState & input_reg_state, Args... args); /// Excute a test void RunTest(const char * name, std::function test_case, std::function input, std::function check_result); diff --git a/rpcs3/Emu/Cell/PPULLVMRecompilerTests.cpp b/rpcs3/Emu/Cell/PPULLVMRecompilerTests.cpp index 1282458ce6..340f1fc1ce 100644 --- a/rpcs3/Emu/Cell/PPULLVMRecompilerTests.cpp +++ b/rpcs3/Emu/Cell/PPULLVMRecompilerTests.cpp @@ -8,6 +8,182 @@ using namespace llvm; +#define VERIFY_INSTRUCTION_AGAINST_INTERPRETER(fn, tc, input, ...) \ +VerifyInstructionAgainstInterpreter(fmt::Format("%s.%d", #fn, tc).c_str(), &PPULLVMRecompiler::fn, &PPUInterpreter::fn, input, __VA_ARGS__) + +#define VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(fn, s, n, ...) { \ + PPURegState input; \ + for (int i = s; i < (n + s); i++) { \ + input.SetRandom(); \ + VERIFY_INSTRUCTION_AGAINST_INTERPRETER(fn, i, input, __VA_ARGS__); \ + } \ +} + +/// Register state of a PPU +struct PPURegState { + /// Floating point registers + PPCdouble FPR[32]; + + ///Floating point status and control register + FPSCRhdr FPSCR; + + /// General purpose reggisters + u64 GPR[32]; + + /// Vector purpose registers + VPR_reg VPR[32]; + + /// Condition register + CRhdr CR; + + /// Fixed point exception register + XERhdr XER; + + /// Vector status and control register + VSCRhdr VSCR; + + /// Link register + u64 LR; + + /// Count register + u64 CTR; + + /// SPR general purpose registers + u64 SPRG[8]; + + /// Time base register + u64 TB; + + void Load(PPUThread & ppu) { + for (int i = 0; i < 32; i++) { + FPR[i] = ppu.FPR[i]; + GPR[i] = ppu.GPR[i]; + VPR[i] = ppu.VPR[i]; + + if (i < 8) { + SPRG[i] = ppu.SPRG[i]; + } + } + + FPSCR = ppu.FPSCR; + CR = ppu.CR; + XER = ppu.XER; + VSCR = ppu.VSCR; + LR = ppu.LR; + CTR = ppu.CTR; + TB = ppu.TB; + } + + void Store(PPUThread & ppu) { + for (int i = 0; i < 32; i++) { + ppu.FPR[i] = FPR[i]; + ppu.GPR[i] = GPR[i]; + ppu.VPR[i] = VPR[i]; + + if (i < 8) { + ppu.SPRG[i] = SPRG[i]; + } + } + + ppu.FPSCR = FPSCR; + ppu.CR = CR; + ppu.XER = XER; + ppu.VSCR = VSCR; + ppu.LR = LR; + ppu.CTR = CTR; + ppu.TB = TB; + } + + void SetRandom() { + std::mt19937_64 rng; + + rng.seed(std::mt19937_64::default_seed); + for (int i = 0; i < 32; i++) { + FPR[i] = (double)rng(); + GPR[i] = rng(); + VPR[i]._u64[0] = rng(); + VPR[i]._u64[1] = rng(); + + if (i < 8) { + SPRG[i] = rng(); + } + } + + FPSCR.FPSCR = (u32)rng(); + CR.CR = (u32)rng(); + XER.XER = 0; + XER.CA = (u32)rng(); + XER.SO = (u32)rng(); + XER.OV = (u32)rng(); + VSCR.VSCR = (u32)rng(); + VSCR.X = 0; + VSCR.Y = 0; + LR = rng(); + CTR = rng(); + TB = rng(); + } + + std::string ToString() const { + std::string ret; + + for (int i = 0; i < 32; i++) { + ret += fmt::Format("GPR[%02d] = 0x%016llx FPR[%02d] = %16g VPR[%02d] = 0x%s [%s]\n", i, GPR[i], i, FPR[i]._double, i, VPR[i].ToString(true).c_str(), VPR[i].ToString().c_str()); + } + + for (int i = 0; i < 8; i++) { + ret += fmt::Format("SPRG[%d] = 0x%016llx\n", i, SPRG[i]); + } + + ret += fmt::Format("CR = 0x%08x LR = 0x%016llx CTR = 0x%016llx TB=0x%016llx\n", CR.CR, LR, CTR, TB); + ret += fmt::Format("XER = 0x%016llx [CA=%d | OV=%d | SO=%d]\n", XER.XER, fmt::by_value(XER.CA), fmt::by_value(XER.OV), fmt::by_value(XER.SO)); + ret += fmt::Format("FPSCR = 0x%08x " + "[RN=%d | NI=%d | XE=%d | ZE=%d | UE=%d | OE=%d | VE=%d | " + "VXCVI=%d | VXSQRT=%d | VXSOFT=%d | FPRF=%d | " + "FI=%d | FR=%d | VXVC=%d | VXIMZ=%d | " + "VXZDZ=%d | VXIDI=%d | VXISI=%d | VXSNAN=%d | " + "XX=%d | ZX=%d | UX=%d | OX=%d | VX=%d | FEX=%d | FX=%d]\n", + FPSCR.FPSCR, + fmt::by_value(FPSCR.RN), + fmt::by_value(FPSCR.NI), fmt::by_value(FPSCR.XE), fmt::by_value(FPSCR.ZE), fmt::by_value(FPSCR.UE), fmt::by_value(FPSCR.OE), fmt::by_value(FPSCR.VE), + fmt::by_value(FPSCR.VXCVI), fmt::by_value(FPSCR.VXSQRT), fmt::by_value(FPSCR.VXSOFT), fmt::by_value(FPSCR.FPRF), + fmt::by_value(FPSCR.FI), fmt::by_value(FPSCR.FR), fmt::by_value(FPSCR.VXVC), fmt::by_value(FPSCR.VXIMZ), + fmt::by_value(FPSCR.VXZDZ), fmt::by_value(FPSCR.VXIDI), fmt::by_value(FPSCR.VXISI), fmt::by_value(FPSCR.VXSNAN), + fmt::by_value(FPSCR.XX), fmt::by_value(FPSCR.ZX), fmt::by_value(FPSCR.UX), fmt::by_value(FPSCR.OX), fmt::by_value(FPSCR.VX), fmt::by_value(FPSCR.FEX), fmt::by_value(FPSCR.FX)); + ret += fmt::Format("VSCR = 0x%08x [NJ=%d | SAT=%d]\n", VSCR.VSCR, fmt::by_value(VSCR.NJ), fmt::by_value(VSCR.SAT)); + + return ret; + } +}; + +template +void PPULLVMRecompiler::VerifyInstructionAgainstInterpreter(const char * name, PPULLVMRecompilerFn recomp_fn, PPUInterpreterFn interp_fn, PPURegState & input_reg_state, Args... args) { + auto test_case = [&]() { + (this->*recomp_fn)(args...); + }; + auto input = [&]() { + input_reg_state.Store(m_ppu); + }; + auto check_result = [&](std::string & msg) { + PPURegState recomp_output_reg_state; + PPURegState interp_output_reg_state; + + recomp_output_reg_state.Load(m_ppu); + input_reg_state.Store(m_ppu); + (&m_interpreter->*interp_fn)(args...); + interp_output_reg_state.Load(m_ppu); + + if (interp_output_reg_state.ToString() != recomp_output_reg_state.ToString()) { + msg = std::string("Input register states:\n") + input_reg_state.ToString() + + std::string("\nOutput register states:\n") + recomp_output_reg_state.ToString() + + std::string("\nInterpreter output register states:\n") + interp_output_reg_state.ToString(); + return false; + } + + return true; + }; + RunTest(name, test_case, input, check_result); +} + void PPULLVMRecompiler::RunTest(const char * name, std::function test_case, std::function input, std::function check_result) { // Create the unit test function auto function = cast(m_module->getOrInsertFunction(name, Type::getVoidTy(m_llvm_context), (Type *)nullptr)); @@ -46,9 +222,9 @@ void PPULLVMRecompiler::RunTest(const char * name, std::function test_ca std::string msg; bool pass = check_result(msg); if (pass) { - LOG_NOTICE(PPU, "[UT %s] Test passed. %s.", name, msg.c_str()); + LOG_NOTICE(PPU, "[UT %s] Test passed. %s", name, msg.c_str()); } else { - LOG_ERROR(PPU, "[UT %s] Test failed. %s.", name, msg.c_str()); + LOG_ERROR(PPU, "[UT %s] Test failed. %s", name, msg.c_str()); } m_execution_engine->freeMachineCodeForFunction(function); @@ -61,790 +237,81 @@ void PPULLVMRecompiler::RunAllTests() { LOG_NOTICE(PPU, "Running Unit Tests"); - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - MFVSCR(1); - }; - input = [this]() { - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x9ABCDEF0; - m_ppu.VSCR.VSCR = 0x12345678; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[1]=%s", m_ppu.VPR[1].ToString(true).c_str()); - return m_ppu.VPR[1].Equals((u32)0x12345678, (u32)0, (u32)0, (u32)0); - }; - RunTest("MFVSCR.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - MTVSCR(1); - }; - input = [this]() { - m_ppu.VPR[1]._u32[0] = 0x9ABCDEF0; - m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x11112222; - m_ppu.VSCR.VSCR = 0x12345678; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[1]=0x%s, VSCR=0x%lX", m_ppu.VPR[1].ToString(true).c_str(), m_ppu.VSCR.VSCR); - return m_ppu.VSCR.VSCR == 0x9ABCDEF0; - }; - RunTest("MTVSCR.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDCUW(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x9ABCDEF0; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x99999999; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = 0x77777777; - m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 1; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=0x%s, VPR[1]=0x%s, VPR[2]=0x%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)1, (u32)1, (u32)0, (u32)0); - }; - RunTest("VADDCUW.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDFP(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._f[0] = m_ppu.VPR[0]._f[1] = m_ppu.VPR[0]._f[2] = m_ppu.VPR[0]._f[3] = 100.0f; - m_ppu.VPR[1]._f[0] = m_ppu.VPR[1]._f[1] = m_ppu.VPR[1]._f[2] = m_ppu.VPR[1]._f[3] = 500.0f; - m_ppu.VPR[2]._f[0] = m_ppu.VPR[2]._f[1] = m_ppu.VPR[2]._f[2] = m_ppu.VPR[2]._f[3] = 900.0f; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString().c_str(), - m_ppu.VPR[1].ToString().c_str(), - m_ppu.VPR[2].ToString().c_str()); - return m_ppu.VPR[0].Equals(1400.0f, 1400.0f, 1400.0f, 1400.0f); - }; - RunTest("VADDFP.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDSBS(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12F06690; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12F06690; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x24E07F80, (u32)0x24E07F80, (u32)0x24E07F80, (u32)0x24E07F80); - }; - RunTest("VADDSBS.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDSHS(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = 0x12006600; - m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0xFF009000; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x24007FFF, (u32)0x24007FFF, (u32)0xFE008000, (u32)0xFE008000); - }; - RunTest("VADDSHS.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDSWS(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[2]._u32[0] = 0x66000000; - m_ppu.VPR[1]._u32[1] = m_ppu.VPR[2]._u32[1] = 0x90000000; - m_ppu.VPR[1]._u32[2] = m_ppu.VPR[2]._u32[2] = 0x12000000; - m_ppu.VPR[1]._u32[3] = m_ppu.VPR[2]._u32[3] = 0xFF000000; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x7FFFFFFF, (u32)0x80000000, (u32)0x24000000, (u32)0xFE000000); - }; - RunTest("VADDSWS.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDUBM(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12368890; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12368890; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x246C1020, (u32)0x246C1020, (u32)0x246C1020, (u32)0x246C1020); - }; - RunTest("VADDUBM.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDUBS(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12368890; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12368890; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x246CFFFF, (u32)0x246CFFFF, (u32)0x246CFFFF, (u32)0x246CFFFF); - }; - RunTest("VADDUBS.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDUHM(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12368890; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12368890; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x246C1120, (u32)0x246C1120, (u32)0x246C1120, (u32)0x246C1120); - }; - RunTest("VADDUHM.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDUHS(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12368890; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12368890; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x246CFFFF, (u32)0x246CFFFF, (u32)0x246CFFFF, (u32)0x246CFFFF); - }; - RunTest("VADDUHS.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDUWM(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[2]._u32[0] = 0x12345678; - m_ppu.VPR[1]._u32[1] = m_ppu.VPR[2]._u32[1] = 0x87654321; - m_ppu.VPR[1]._u32[2] = m_ppu.VPR[2]._u32[2] = 0x12345678; - m_ppu.VPR[1]._u32[3] = m_ppu.VPR[2]._u32[3] = 0x87654321; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x2468ACF0, (u32)0x0ECA8642, (u32)0x2468ACF0, (u32)0x0ECA8642); - }; - RunTest("VADDUWM.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VADDUWS(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[2]._u32[0] = 0x12345678; - m_ppu.VPR[1]._u32[1] = m_ppu.VPR[2]._u32[1] = 0x87654321; - m_ppu.VPR[1]._u32[2] = m_ppu.VPR[2]._u32[2] = 0x12345678; - m_ppu.VPR[1]._u32[3] = m_ppu.VPR[2]._u32[3] = 0x87654321; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x2468ACF0, (u32)0xFFFFFFFF, (u32)0x2468ACF0, (u32)0xFFFFFFFF); - }; - RunTest("VADDUWS.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VAND(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0xAAAAAAAA; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0xFFFF0000; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0xAAAA0000, (u32)0xAAAA0000, (u32)0xAAAA0000, (u32)0xAAAA0000); - }; - RunTest("VAND.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VANDC(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0xAAAAAAAA; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0xFFFF0000; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x0000AAAA, (u32)0x0000AAAA, (u32)0x0000AAAA, (u32)0x0000AAAA); - }; - RunTest("VANDC.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VAVGSB(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x89ABCDEF; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0xCEF01234, (u32)0xCEF01234, (u32)0xCEF01234, (u32)0xCEF01234); - }; - RunTest("VAVGSB.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VAVGSH(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x89ABCDEF; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0xCDF01234, (u32)0xCDF01234, (u32)0xCDF01234, (u32)0xCDF01234); - }; - RunTest("VAVGSH.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VAVGSW(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x89ABCDEF; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0xCDF01234, (u32)0xCDF01234, (u32)0xCDF01234, (u32)0xCDF01234); - }; - RunTest("VAVGSW.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VAVGUB(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x89ABCDEF; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x4E7092B4, (u32)0x4E7092B4, (u32)0x4E7092B4, (u32)0x4E7092B4); - }; - RunTest("VAVGUB.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VAVGUH(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x89ABCDEF; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x4DF09234, (u32)0x4DF09234, (u32)0x4DF09234, (u32)0x4DF09234); - }; - RunTest("VAVGUH.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VAVGUW(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x89ABCDEF; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x4DF01234, (u32)0x4DF01234, (u32)0x4DF01234, (u32)0x4DF01234); - }; - RunTest("VAVGUW.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCFSX(0, 0, 1); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x99999999; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s", - m_ppu.VPR[0].ToString().c_str(), - m_ppu.VPR[1].ToString().c_str()); - return m_ppu.VPR[0].Equals(-1717986944.0f, -1717986944.0f, -1717986944.0f, -1717986944.0f); - }; - RunTest("VCFSX.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCFSX(0, 3, 1); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x99999999; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s", - m_ppu.VPR[0].ToString().c_str(), - m_ppu.VPR[1].ToString().c_str()); - return m_ppu.VPR[0].Equals(-214748368.0f, -214748368.0f, -214748368.0f, -214748368.0f); - }; - RunTest("VCFSX.2", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCFUX(0, 0, 1); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x99999999; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s", - m_ppu.VPR[0].ToString().c_str(), - m_ppu.VPR[1].ToString().c_str()); - return m_ppu.VPR[0].Equals(2576980480.0f, 2576980480.0f, 2576980480.0f, 2576980480.0f); - }; - RunTest("VCFUX.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCFUX(0, 3, 1); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x99999999; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s", - m_ppu.VPR[0].ToString().c_str(), - m_ppu.VPR[1].ToString().c_str()); - return m_ppu.VPR[0].Equals(322122560.0f, 322122560.0f, 322122560.0f, 322122560.0f); - }; - RunTest("VCFUX.2", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPBFP(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._f[0] = m_ppu.VPR[1]._f[1] = 150.0f; - m_ppu.VPR[1]._f[2] = m_ppu.VPR[1]._f[3] = 50.0f; - m_ppu.VPR[2]._f[0] = m_ppu.VPR[2]._f[1] = m_ppu.VPR[2]._f[2] = m_ppu.VPR[2]._f[3] = 100.0f; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString().c_str(), - m_ppu.VPR[2].ToString().c_str()); - return m_ppu.VPR[0].Equals((u32)0x80000000, (u32)0x80000000, (u32)0x00000000, (u32)0x00000000); - }; - RunTest("VCMPBFP.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPBFP_(0, 1, 2); - }; - input = [this]() { - m_ppu.CR.CR = 0xFFFFFFFF; - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._f[0] = m_ppu.VPR[1]._f[1] = 150.0f; - m_ppu.VPR[1]._f[2] = m_ppu.VPR[1]._f[3] = 50.0f; - m_ppu.VPR[2]._f[0] = m_ppu.VPR[2]._f[1] = m_ppu.VPR[2]._f[2] = m_ppu.VPR[2]._f[3] = 100.0f; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s, CR=0x%X", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString().c_str(), - m_ppu.VPR[2].ToString().c_str(), m_ppu.CR.CR); - return m_ppu.VPR[0].Equals((u32)0x80000000, (u32)0x80000000, (u32)0x00000000, (u32)0x00000000) && (m_ppu.CR.CR == 0xFFFFFF0F); - }; - RunTest("VCMPBFP_.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPBFP_(0, 1, 2); - }; - input = [this]() { - m_ppu.CR.CR = 0xFFFFFFFF; - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._f[0] = m_ppu.VPR[1]._f[1] = 50.0f; - m_ppu.VPR[1]._f[2] = m_ppu.VPR[1]._f[3] = 50.0f; - m_ppu.VPR[2]._f[0] = m_ppu.VPR[2]._f[1] = m_ppu.VPR[2]._f[2] = m_ppu.VPR[2]._f[3] = 100.0f; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s, CR=0x%X", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString().c_str(), - m_ppu.VPR[2].ToString().c_str(), m_ppu.CR.CR); - return m_ppu.VPR[0].Equals((u32)0x00000000, (u32)0x00000000, (u32)0x00000000, (u32)0x00000000) && (m_ppu.CR.CR == 0xFFFFFF2F); - }; - RunTest("VCMPBFP_.2", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPEQFP(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._f[0] = m_ppu.VPR[1]._f[1] = 50.0f; - m_ppu.VPR[1]._f[2] = m_ppu.VPR[1]._f[3] = 100.0f; - m_ppu.VPR[2]._f[0] = m_ppu.VPR[2]._f[1] = m_ppu.VPR[2]._f[2] = m_ppu.VPR[2]._f[3] = 100.0f; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString().c_str(), - m_ppu.VPR[2].ToString().c_str()); - return m_ppu.VPR[0].Equals((u32)0x00000000, (u32)0x00000000, (u32)0xFFFFFFFF, (u32)0xFFFFFFFF); - }; - RunTest("VCMPEQFP.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPEQFP_(0, 1, 2); - }; - input = [this]() { - m_ppu.CR.CR = 0xFFFFFFFF; - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._f[0] = m_ppu.VPR[1]._f[1] = m_ppu.VPR[1]._f[2] = m_ppu.VPR[1]._f[3] = 50.0f; - m_ppu.VPR[2]._f[0] = m_ppu.VPR[2]._f[1] = m_ppu.VPR[2]._f[2] = m_ppu.VPR[2]._f[3] = 100.0f; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s, CR=0x%X", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString().c_str(), - m_ppu.VPR[2].ToString().c_str(), m_ppu.CR.CR); - return m_ppu.VPR[0].Equals((u32)0x00000000, (u32)0x00000000, (u32)0x00000000, (u32)0x00000000) && (m_ppu.CR.CR == 0xFFFFFF2F); - }; - RunTest("VCMPEQFP_.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPEQFP_(0, 1, 2); - }; - input = [this]() { - m_ppu.CR.CR = 0xFFFFFFFF; - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._f[0] = m_ppu.VPR[1]._f[1] = m_ppu.VPR[1]._f[2] = m_ppu.VPR[1]._f[3] = 100.0f; - m_ppu.VPR[2]._f[0] = m_ppu.VPR[2]._f[1] = m_ppu.VPR[2]._f[2] = m_ppu.VPR[2]._f[3] = 100.0f; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s, CR=0x%X", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString().c_str(), - m_ppu.VPR[2].ToString().c_str(), m_ppu.CR.CR); - return m_ppu.VPR[0].Equals((u32)0xFFFFFFFF, (u32)0xFFFFFFFF, (u32)0xFFFFFFFF, (u32)0xFFFFFFFF) && (m_ppu.CR.CR == 0xFFFFFF8F); - }; - RunTest("VCMPEQFP_.2", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPEQFP_(0, 1, 2); - }; - input = [this]() { - m_ppu.CR.CR = 0xFFFFFFFF; - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._f[0] = m_ppu.VPR[1]._f[1] = 100.0f; - m_ppu.VPR[1]._f[2] = m_ppu.VPR[1]._f[3] = 50.0f; - m_ppu.VPR[2]._f[0] = m_ppu.VPR[2]._f[1] = m_ppu.VPR[2]._f[2] = m_ppu.VPR[2]._f[3] = 100.0f; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s, CR=0x%X", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString().c_str(), - m_ppu.VPR[2].ToString().c_str(), m_ppu.CR.CR); - return m_ppu.VPR[0].Equals((u32)0xFFFFFFFF, (u32)0xFFFFFFFF, (u32)0x00000000, (u32)0x00000000) && (m_ppu.CR.CR == 0xFFFFFF0F); - }; - RunTest("VCMPEQFP_.3", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPEQUB(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12348765; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0xFFFF0000, (u32)0xFFFF0000, (u32)0xFFFF0000, (u32)0xFFFF0000); - }; - RunTest("VCMPEQUB.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPEQUH(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12348765; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0xFFFF0000, (u32)0xFFFF0000, (u32)0xFFFF0000, (u32)0xFFFF0000); - }; - RunTest("VCMPEQUH.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPEQUW(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = 0x12345678; - m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x87654321; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12345678; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0xFFFFFFFF, (u32)0xFFFFFFFF, (u32)0x00000000, (u32)0x00000000); - }; - RunTest("VCMPEQUW.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPGEFP(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._f[0] = 50.0f; - m_ppu.VPR[1]._f[1] = 100.0f; - m_ppu.VPR[1]._f[2] = m_ppu.VPR[1]._f[3] = 200.0f; - m_ppu.VPR[2]._f[0] = m_ppu.VPR[2]._f[1] = m_ppu.VPR[2]._f[2] = m_ppu.VPR[2]._f[3] = 100.0f; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString().c_str(), - m_ppu.VPR[2].ToString().c_str()); - return m_ppu.VPR[0].Equals((u32)0x00000000, (u32)0xFFFFFFFF, (u32)0xFFFFFFFF, (u32)0xFFFFFFFF); - }; - RunTest("VCMPGEFP.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPGTFP(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._f[0] = 50.0f; - m_ppu.VPR[1]._f[1] = 100.0f; - m_ppu.VPR[1]._f[2] = m_ppu.VPR[1]._f[3] = 200.0f; - m_ppu.VPR[2]._f[0] = m_ppu.VPR[2]._f[1] = m_ppu.VPR[2]._f[2] = m_ppu.VPR[2]._f[3] = 100.0f; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString().c_str(), - m_ppu.VPR[2].ToString().c_str()); - return m_ppu.VPR[0].Equals((u32)0x00000000, (u32)0x00000000, (u32)0xFFFFFFFF, (u32)0xFFFFFFFF); - }; - RunTest("VCMPGTFP.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPGTSB(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x0034FF79; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0xFF00FF00, (u32)0xFF00FF00, (u32)0xFF00FF00, (u32)0xFF00FF00); - }; - RunTest("VCMPGTSB.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPGTSH(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12348765; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x0000FFFF, (u32)0x0000FFFF, (u32)0x0000FFFF, (u32)0x0000FFFF); - }; - RunTest("VCMPGTSH.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPGTSW(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = 0x12345678; - m_ppu.VPR[1]._u32[1] = 0x12345679; - m_ppu.VPR[1]._u32[2] = 0x12345677; - m_ppu.VPR[1]._u32[3] = 0x87654321; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12345678; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x00000000, (u32)0xFFFFFFFF, (u32)0x00000000, (u32)0x00000000); - }; - RunTest("VCMPGTSW.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPGTUB(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12345678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x0034FF79; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0xFF000000, (u32)0xFF000000, (u32)0xFF000000, (u32)0xFF000000); - }; - RunTest("VCMPGTUB.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPGTUH(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = m_ppu.VPR[1]._u32[1] = m_ppu.VPR[1]._u32[2] = m_ppu.VPR[1]._u32[3] = 0x12355678; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12348765; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0xFFFF0000, (u32)0xFFFF0000, (u32)0xFFFF0000, (u32)0xFFFF0000); - }; - RunTest("VCMPGTUH.1", test_case, input, check_result); - - /////////////////////////////////////////////////////////////////////////// - test_case = [this]() { - VCMPGTUW(0, 1, 2); - }; - input = [this]() { - m_ppu.VPR[0]._u32[0] = m_ppu.VPR[0]._u32[1] = m_ppu.VPR[0]._u32[2] = m_ppu.VPR[0]._u32[3] = 0x00000000; - m_ppu.VPR[1]._u32[0] = 0x12345678; - m_ppu.VPR[1]._u32[1] = 0x12345679; - m_ppu.VPR[1]._u32[2] = 0x12345677; - m_ppu.VPR[1]._u32[3] = 0x87654321; - m_ppu.VPR[2]._u32[0] = m_ppu.VPR[2]._u32[1] = m_ppu.VPR[2]._u32[2] = m_ppu.VPR[2]._u32[3] = 0x12345678; - }; - check_result = [this](std::string & msg) { - msg = fmt::Format("VPR[0]=%s, VPR[1]=%s, VPR[2]=%s", - m_ppu.VPR[0].ToString(true).c_str(), - m_ppu.VPR[1].ToString(true).c_str(), - m_ppu.VPR[2].ToString(true).c_str()); - return m_ppu.VPR[0].Equals((u32)0x00000000, (u32)0xFFFFFFFF, (u32)0x00000000, (u32)0xFFFFFFFF); - }; - RunTest("VCMPGTUW.1", test_case, input, check_result); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(MFVSCR, 0, 5, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(MTVSCR, 0, 5, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDCUW, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDFP, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDSBS, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDSHS, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDSWS, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDUBM, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDUBS, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDUHM, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDUHS, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDUWM, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VADDUWS, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VAND, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VANDC, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VAVGSB, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VAVGSH, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VAVGSW, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VAVGUB, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VAVGUH, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VAVGUW, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCFSX, 0, 5, 0, 0, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCFSX, 5, 5, 0, 3, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCFUX, 0, 5, 0, 0, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCFUX, 5, 5, 0, 2, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPBFP, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPBFP, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPBFP_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPBFP_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQFP, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQFP, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQFP_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQFP_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUB, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUB, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUB_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUB_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUH, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUH, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUH_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUH_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUW, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUW, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUW_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPEQUW_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGEFP, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGEFP, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGEFP_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGEFP_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTFP, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTFP, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTFP_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTFP_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSB, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSB, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSB_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSB_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSH, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSH, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSH_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSH_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSW, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSW, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSW_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTSW_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUB, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUB, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUB_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUB_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUH, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUH, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUH_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUH_, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUW, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUW, 5, 5, 0, 1, 1); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUW_, 0, 5, 0, 1, 2); + VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(VCMPGTUW_, 5, 5, 0, 1, 1); } diff --git a/rpcs3/stdafx.h b/rpcs3/stdafx.h index e1c4825f87..7e67a2723a 100644 --- a/rpcs3/stdafx.h +++ b/rpcs3/stdafx.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "Utilities/GNU.h"