small code cleanup in JIT: use JITIL's nice JITDISABLE macro

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4477 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-10-29 04:40:26 +00:00
parent 31e61da40d
commit 5b4d12c1f3
9 changed files with 1788 additions and 1867 deletions

View File

@ -77,7 +77,10 @@ void Jit(u32 em_address);
// #define INSTRUCTION_START PPCTables::CountInstruction(inst); // #define INSTRUCTION_START PPCTables::CountInstruction(inst);
#define INSTRUCTION_START #define INSTRUCTION_START
#define JITDISABLE(type) \
if (Core::g_CoreStartupParameter.bJITOff || \
Core::g_CoreStartupParameter.bJIT##type##Off) \
{Default(inst); return;}
class TrampolineCache : public Gen::XCodeBlock class TrampolineCache : public Gen::XCodeBlock
{ {

View File

@ -73,9 +73,8 @@ void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool dupe, void (XEm
void Jit64::fp_arith_s(UGeckoInstruction inst) void Jit64::fp_arith_s(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(FloatingPoint)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -104,9 +103,8 @@ void Jit64::fp_arith_s(UGeckoInstruction inst)
void Jit64::fmaddXX(UGeckoInstruction inst) void Jit64::fmaddXX(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(FloatingPoint)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -162,9 +160,8 @@ void Jit64::fmaddXX(UGeckoInstruction inst)
void Jit64::fsign(UGeckoInstruction inst) void Jit64::fsign(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(FloatingPoint)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -195,8 +192,7 @@ void Jit64::fsign(UGeckoInstruction inst)
void Jit64::fmrx(UGeckoInstruction inst) void Jit64::fmrx(UGeckoInstruction inst)
{ {
INSTRUCTION_START INSTRUCTION_START
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) JITDISABLE(FloatingPoint)
{Default(inst); return;} // turn off from debugger
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -213,9 +209,9 @@ void Jit64::fcmpx(UGeckoInstruction inst)
{ {
// TODO : This still causes crashes in Nights, and broken graphics // TODO : This still causes crashes in Nights, and broken graphics
// in Paper Mario, Super Paper Mario as well as SoulCalibur 2 prolly others too.. :( // in Paper Mario, Super Paper Mario as well as SoulCalibur 2 prolly others too.. :(
INSTRUCTION_START; INSTRUCTION_START
if(Core::g_CoreStartupParameter.bJITOff || jo.fpAccurateFcmp JITDISABLE(FloatingPoint)
|| Core::g_CoreStartupParameter.bJITFloatingPointOff) { if (jo.fpAccurateFcmp) {
Default(inst); return; // turn off from debugger Default(inst); return; // turn off from debugger
} }

View File

@ -24,22 +24,22 @@
#include "JitRegCache.h" #include "JitRegCache.h"
#include "JitAsm.h" #include "JitAsm.h"
// Assumes that the flags were just set through an addition. // Assumes that the flags were just set through an addition.
void Jit64::GenerateCarry(Gen::X64Reg temp_reg) { void Jit64::GenerateCarry(Gen::X64Reg temp_reg) {
// USES_XER // USES_XER
SETcc(CC_C, R(temp_reg)); SETcc(CC_C, R(temp_reg));
AND(32, M(&PowerPC::ppcState.spr[SPR_XER]), Imm32(~(1 << 29))); AND(32, M(&PowerPC::ppcState.spr[SPR_XER]), Imm32(~(1 << 29)));
SHL(32, R(temp_reg), Imm8(29)); SHL(32, R(temp_reg), Imm8(29));
OR(32, M(&PowerPC::ppcState.spr[SPR_XER]), R(temp_reg)); OR(32, M(&PowerPC::ppcState.spr[SPR_XER]), R(temp_reg));
} }
u32 Add(u32 a, u32 b) {return a + b;} u32 Add(u32 a, u32 b) {return a + b;}
u32 Or (u32 a, u32 b) {return a | b;} u32 Or (u32 a, u32 b) {return a | b;}
u32 And(u32 a, u32 b) {return a & b;} u32 And(u32 a, u32 b) {return a & b;}
u32 Xor(u32 a, u32 b) {return a ^ b;} u32 Xor(u32 a, u32 b) {return a ^ b;}
void Jit64::regimmop(int d, int a, bool binary, u32 value, Operation doop, void (XEmitter::*op)(int, const Gen::OpArg&, const Gen::OpArg&), bool Rc, bool carry) void Jit64::regimmop(int d, int a, bool binary, u32 value, Operation doop, void (XEmitter::*op)(int, const Gen::OpArg&, const Gen::OpArg&), bool Rc, bool carry)
{ {
gpr.Lock(d, a); gpr.Lock(d, a);
if (a || binary || carry) // yeh nasty special case addic if (a || binary || carry) // yeh nasty special case addic
{ {
@ -83,14 +83,12 @@
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
gpr.UnlockAll(); gpr.UnlockAll();
} }
void Jit64::reg_imm(UGeckoInstruction inst) void Jit64::reg_imm(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int d = inst.RD, a = inst.RA, s = inst.RS; int d = inst.RD, a = inst.RA, s = inst.RS;
switch (inst.OPCD) switch (inst.OPCD)
{ {
@ -124,15 +122,13 @@
Default(inst); Default(inst);
break; break;
} }
} }
void Jit64::cmpXX(UGeckoInstruction inst) void Jit64::cmpXX(UGeckoInstruction inst)
{ {
// USES_CR // USES_CR
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int b = inst.RB; int b = inst.RB;
int crf = inst.CRFD; int crf = inst.CRFD;
@ -244,14 +240,12 @@
} }
gpr.UnlockAll(); gpr.UnlockAll();
} }
void Jit64::orx(UGeckoInstruction inst) void Jit64::orx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
int b = inst.RB; int b = inst.RB;
@ -283,16 +277,14 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
// m_GPR[_inst.RA] = m_GPR[_inst.RS] ^ m_GPR[_inst.RB]; // m_GPR[_inst.RA] = m_GPR[_inst.RS] ^ m_GPR[_inst.RB];
void Jit64::xorx(UGeckoInstruction inst) void Jit64::xorx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
int b = inst.RB; int b = inst.RB;
@ -315,14 +307,12 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::andx(UGeckoInstruction inst) void Jit64::andx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, s = inst.RS, b = inst.RB; int a = inst.RA, s = inst.RS, b = inst.RB;
if (a != s && a != b) { if (a != s && a != b) {
gpr.LoadToX64(a, false, true); gpr.LoadToX64(a, false, true);
@ -339,14 +329,12 @@
// result is already in eax // result is already in eax
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::extsbx(UGeckoInstruction inst) void Jit64::extsbx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, int a = inst.RA,
s = inst.RS; s = inst.RS;
gpr.LoadToX64(a, a == s, true); gpr.LoadToX64(a, a == s, true);
@ -359,14 +347,12 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::extshx(UGeckoInstruction inst) void Jit64::extshx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, s = inst.RS; int a = inst.RA, s = inst.RS;
gpr.KillImmediate(s); gpr.KillImmediate(s);
gpr.LoadToX64(a, a == s, true); gpr.LoadToX64(a, a == s, true);
@ -378,14 +364,12 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::subfic(UGeckoInstruction inst) void Jit64::subfic(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, d = inst.RD; int a = inst.RA, d = inst.RD;
gpr.FlushLockX(ECX); gpr.FlushLockX(ECX);
gpr.Lock(a, d); gpr.Lock(a, d);
@ -399,10 +383,10 @@
gpr.UnlockAll(); gpr.UnlockAll();
gpr.UnlockAllX(); gpr.UnlockAllX();
// This instruction has no RC flag // This instruction has no RC flag
} }
void Jit64::subfcx(UGeckoInstruction inst) void Jit64::subfcx(UGeckoInstruction inst)
{ {
INSTRUCTION_START; INSTRUCTION_START;
Default(inst); Default(inst);
return; return;
@ -415,10 +399,10 @@
if (_inst.OE) PanicAlert("OE: subfcx"); if (_inst.OE) PanicAlert("OE: subfcx");
if (_inst.Rc) Helper_UpdateCR0(m_GPR[_inst.RD]); if (_inst.Rc) Helper_UpdateCR0(m_GPR[_inst.RD]);
*/ */
} }
void Jit64::subfex(UGeckoInstruction inst) void Jit64::subfex(UGeckoInstruction inst)
{ {
INSTRUCTION_START; INSTRUCTION_START;
Default(inst); Default(inst);
return; return;
@ -432,14 +416,12 @@
if (_inst.OE) PanicAlert("OE: subfcx"); if (_inst.OE) PanicAlert("OE: subfcx");
if (_inst.Rc) Helper_UpdateCR0(m_GPR[_inst.RD]); if (_inst.Rc) Helper_UpdateCR0(m_GPR[_inst.RD]);
*/ */
} }
void Jit64::subfx(UGeckoInstruction inst) void Jit64::subfx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.Lock(a, b, d); gpr.Lock(a, b, d);
if (d != a && d != b) { if (d != a && d != b) {
@ -456,28 +438,24 @@
// result is already in eax // result is already in eax
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::mulli(UGeckoInstruction inst) void Jit64::mulli(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, d = inst.RD; int a = inst.RA, d = inst.RD;
gpr.Lock(a, d); gpr.Lock(a, d);
gpr.LoadToX64(d, (d == a), true); gpr.LoadToX64(d, (d == a), true);
gpr.KillImmediate(a); gpr.KillImmediate(a);
IMUL(32, gpr.RX(d), gpr.R(a), Imm32((u32)(s32)inst.SIMM_16)); IMUL(32, gpr.RX(d), gpr.R(a), Imm32((u32)(s32)inst.SIMM_16));
gpr.UnlockAll(); gpr.UnlockAll();
} }
void Jit64::mullwx(UGeckoInstruction inst) void Jit64::mullwx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.Lock(a, b, d); gpr.Lock(a, b, d);
gpr.LoadToX64(d, (d == a || d == b), true); gpr.LoadToX64(d, (d == a || d == b), true);
@ -494,14 +472,12 @@
MOV(32, R(EAX), gpr.R(d)); MOV(32, R(EAX), gpr.R(d));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::mulhwux(UGeckoInstruction inst) void Jit64::mulhwux(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.FlushLockX(EDX); gpr.FlushLockX(EDX);
gpr.Lock(a, b, d); gpr.Lock(a, b, d);
@ -525,10 +501,10 @@
} else { } else {
MOV(32, gpr.R(d), R(EDX)); MOV(32, gpr.R(d), R(EDX));
} }
} }
// skipped some of the special handling in here - if we get crashes, let the interpreter handle this op // skipped some of the special handling in here - if we get crashes, let the interpreter handle this op
void Jit64::divwux(UGeckoInstruction inst) { void Jit64::divwux(UGeckoInstruction inst) {
Default(inst); return; Default(inst); return;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
@ -549,23 +525,21 @@
if (inst.Rc) { if (inst.Rc) {
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
u32 Helper_Mask(u8 mb, u8 me) u32 Helper_Mask(u8 mb, u8 me)
{ {
return (((mb > me) ? return (((mb > me) ?
~(((u32)-1 >> mb) ^ ((me >= 31) ? 0 : (u32) -1 >> (me + 1))) ~(((u32)-1 >> mb) ^ ((me >= 31) ? 0 : (u32) -1 >> (me + 1)))
: :
(((u32)-1 >> mb) ^ ((me >= 31) ? 0 : (u32) -1 >> (me + 1)))) (((u32)-1 >> mb) ^ ((me >= 31) ? 0 : (u32) -1 >> (me + 1))))
); );
} }
void Jit64::addx(UGeckoInstruction inst) void Jit64::addx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
_assert_msg_(DYNA_REC, !inst.OE, "Add - OE enabled :("); _assert_msg_(DYNA_REC, !inst.OE, "Add - OE enabled :(");
@ -614,16 +588,14 @@
{ {
Default(inst); return; Default(inst); return;
} }
} }
// This can be optimized // This can be optimized
void Jit64::addex(UGeckoInstruction inst) void Jit64::addex(UGeckoInstruction inst)
{ {
// USES_XER // USES_XER
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.FlushLockX(ECX); gpr.FlushLockX(ECX);
gpr.Lock(a, b, d); gpr.Lock(a, b, d);
@ -643,14 +615,12 @@
{ {
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::rlwinmx(UGeckoInstruction inst) void Jit64::rlwinmx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
if (gpr.R(s).IsImm() && !inst.Rc) if (gpr.R(s).IsImm() && !inst.Rc)
@ -700,15 +670,13 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::rlwimix(UGeckoInstruction inst) void Jit64::rlwimix(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
if (gpr.R(a).IsImm() || gpr.R(s).IsImm()) if (gpr.R(a).IsImm() || gpr.R(s).IsImm())
@ -736,14 +704,12 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::rlwnmx(UGeckoInstruction inst) void Jit64::rlwnmx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, s = inst.RS; int a = inst.RA, b = inst.RB, s = inst.RS;
if (gpr.R(a).IsImm()) if (gpr.R(a).IsImm())
{ {
@ -767,14 +733,12 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::negx(UGeckoInstruction inst) void Jit64::negx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int d = inst.RD; int d = inst.RD;
gpr.Lock(a, d); gpr.Lock(a, d);
@ -788,14 +752,12 @@
MOV(32, R(EAX), gpr.R(d)); MOV(32, R(EAX), gpr.R(d));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::srwx(UGeckoInstruction inst) void Jit64::srwx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int b = inst.RB; int b = inst.RB;
int s = inst.RS; int s = inst.RS;
@ -817,14 +779,12 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::slwx(UGeckoInstruction inst) void Jit64::slwx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int b = inst.RB; int b = inst.RB;
int s = inst.RS; int s = inst.RS;
@ -846,15 +806,13 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::srawx(UGeckoInstruction inst) void Jit64::srawx(UGeckoInstruction inst)
{ {
// USES_XER // USES_XER
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int b = inst.RB; int b = inst.RB;
int s = inst.RS; int s = inst.RS;
@ -893,14 +851,12 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
void Jit64::srawix(UGeckoInstruction inst) void Jit64::srawix(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
int amount = inst.SH; int amount = inst.SH;
@ -938,15 +894,13 @@
MOV(32, R(EAX), gpr.R(a)); MOV(32, R(EAX), gpr.R(a));
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
} }
} }
// count leading zeroes // count leading zeroes
void Jit64::cntlzwx(UGeckoInstruction inst) void Jit64::cntlzwx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Integer)
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
if (gpr.R(a).IsImm() || gpr.R(s).IsImm() || s == a) if (gpr.R(a).IsImm() || gpr.R(s).IsImm() || s == a)
@ -969,4 +923,4 @@
CALL((u8*)asm_routines.computeRc); CALL((u8*)asm_routines.computeRc);
// TODO: Check PPC manual too // TODO: Check PPC manual too
} }
} }

View File

@ -33,12 +33,12 @@
#include "JitAsm.h" #include "JitAsm.h"
#include "JitRegCache.h" #include "JitRegCache.h"
void Jit64::lbzx(UGeckoInstruction inst) void Jit64::lbzx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff INSTRUCTION_START
|| Core::g_CoreStartupParameter.bJITLoadStorelbzxOff) JITDISABLE(LoadStore)
{Default(inst); return;} // turn off from debugger if (Core::g_CoreStartupParameter.bJITLoadStorelbzxOff)
INSTRUCTION_START; Default(inst); return;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.Lock(a, b, d); gpr.Lock(a, b, d);
@ -58,13 +58,12 @@
#endif #endif
gpr.UnlockAll(); gpr.UnlockAll();
gpr.UnlockAllX(); gpr.UnlockAllX();
} }
void Jit64::lwzx(UGeckoInstruction inst) void Jit64::lwzx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStore)
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.Lock(a, b, d); gpr.Lock(a, b, d);
@ -84,13 +83,12 @@
#endif #endif
gpr.UnlockAll(); gpr.UnlockAll();
gpr.UnlockAllX(); gpr.UnlockAllX();
} }
void Jit64::lhax(UGeckoInstruction inst) void Jit64::lhax(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStore)
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.Lock(a, b, d); gpr.Lock(a, b, d);
@ -109,14 +107,14 @@
gpr.UnlockAll(); gpr.UnlockAll();
gpr.UnlockAllX(); gpr.UnlockAllX();
} }
void Jit64::lXz(UGeckoInstruction inst) void Jit64::lXz(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff INSTRUCTION_START
|| Core::g_CoreStartupParameter.bJITLoadStorelXzOff) JITDISABLE(LoadStore)
{Default(inst); return;} // turn off from debugger if (Core::g_CoreStartupParameter.bJITLoadStorelXzOff)
INSTRUCTION_START; Default(inst); return;
int d = inst.RD; int d = inst.RD;
int a = inst.RA; int a = inst.RA;
@ -221,20 +219,19 @@
case 32: case 32:
BSWAP(32, gpr.R(d).GetSimpleReg()); BSWAP(32, gpr.R(d).GetSimpleReg());
break; break;
// Careful in the backpatch - need to properly nop over first // Careful in the backpatch - need to properly nop over first
// case 16: // case 16:
// BSWAP(32, gpr.R(d).GetSimpleReg()); // BSWAP(32, gpr.R(d).GetSimpleReg());
// SHR(32, gpr.R(d), Imm8(16)); // SHR(32, gpr.R(d), Imm8(16));
// break; // break;
} }
gpr.UnlockAll(); gpr.UnlockAll();
} }
void Jit64::lha(UGeckoInstruction inst) void Jit64::lha(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStore)
INSTRUCTION_START;
int d = inst.RD; int d = inst.RD;
int a = inst.RA; int a = inst.RA;
@ -249,13 +246,12 @@
gpr.UnlockAll(); gpr.UnlockAll();
gpr.UnlockAllX(); gpr.UnlockAllX();
return; return;
} }
void Jit64::lwzux(UGeckoInstruction inst) void Jit64::lwzux(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStore)
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
if (!a || a == d || a == b) if (!a || a == d || a == b)
@ -274,17 +270,16 @@
gpr.UnlockAll(); gpr.UnlockAll();
return; return;
} }
// Zero cache line.
void Jit64::dcbz(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(LoadStore)
// Zero cache line.
void Jit64::dcbz(UGeckoInstruction inst)
{
Default(inst); return; Default(inst); return;
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff)
{Default(inst); return;} // turn off from debugger
INSTRUCTION_START;
MOV(32, R(EAX), gpr.R(inst.RB)); MOV(32, R(EAX), gpr.R(inst.RB));
if (inst.RA) if (inst.RA)
ADD(32, R(EAX), gpr.R(inst.RA)); ADD(32, R(EAX), gpr.R(inst.RA));
@ -298,13 +293,12 @@
MOVAPS(MDisp(EAX, (u32)Memory::base), XMM0); MOVAPS(MDisp(EAX, (u32)Memory::base), XMM0);
MOVAPS(MDisp(EAX, (u32)Memory::base + 16), XMM0); MOVAPS(MDisp(EAX, (u32)Memory::base + 16), XMM0);
#endif #endif
} }
void Jit64::stX(UGeckoInstruction inst) void Jit64::stX(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStore)
INSTRUCTION_START;
int s = inst.RS; int s = inst.RS;
int a = inst.RA; int a = inst.RA;
@ -379,7 +373,7 @@
} }
/* // TODO - figure out why Beyond Good and Evil hates this /* // TODO - figure out why Beyond Good and Evil hates this
#ifdef _M_X64 #ifdef _M_X64
if (accessSize == 32 && !update && jo.enableFastMem) if (accessSize == 32 && !update && jo.enableFastMem)
{ {
// Fast and daring - requires 64-bit // Fast and daring - requires 64-bit
@ -389,7 +383,7 @@
MOV(accessSize, MComplex(RBX, gpr.RX(a), SCALE_1, (u32)offset), R(EAX)); MOV(accessSize, MComplex(RBX, gpr.RX(a), SCALE_1, (u32)offset), R(EAX));
return; return;
} }
#endif*/ #endif*/
//Still here? Do regular path. //Still here? Do regular path.
gpr.Lock(s, a); gpr.Lock(s, a);
@ -428,13 +422,12 @@
{ {
Default(inst); Default(inst);
} }
} }
void Jit64::stXx(UGeckoInstruction inst) void Jit64::stXx(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStore)
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, s = inst.RS; int a = inst.RA, b = inst.RB, s = inst.RS;
if (!a || a == s || a == b) if (!a || a == s || a == b)
@ -466,7 +459,7 @@
gpr.UnlockAll(); gpr.UnlockAll();
gpr.UnlockAllX(); gpr.UnlockAllX();
return; return;
} }
// A few games use these heavily in video codecs. // A few games use these heavily in video codecs.
void Jit64::lmw(UGeckoInstruction inst) void Jit64::lmw(UGeckoInstruction inst)

View File

@ -51,9 +51,8 @@ u32 GC_ALIGNED16(temp32);
void Jit64::lfs(UGeckoInstruction inst) void Jit64::lfs(UGeckoInstruction inst)
{ {
if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStoreFloating)
INSTRUCTION_START;
int d = inst.RD; int d = inst.RD;
int a = inst.RA; int a = inst.RA;
@ -88,9 +87,8 @@ void Jit64::lfs(UGeckoInstruction inst)
void Jit64::lfd(UGeckoInstruction inst) void Jit64::lfd(UGeckoInstruction inst)
{ {
if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStoreFloating)
INSTRUCTION_START;
int d = inst.RD; int d = inst.RD;
int a = inst.RA; int a = inst.RA;
@ -155,10 +153,8 @@ void Jit64::lfd(UGeckoInstruction inst)
void Jit64::stfd(UGeckoInstruction inst) void Jit64::stfd(UGeckoInstruction inst)
{ {
if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStoreFloating)
INSTRUCTION_START;
int s = inst.RS; int s = inst.RS;
int a = inst.RA; int a = inst.RA;
@ -234,9 +230,8 @@ void Jit64::stfd(UGeckoInstruction inst)
void Jit64::stfs(UGeckoInstruction inst) void Jit64::stfs(UGeckoInstruction inst)
{ {
if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStoreFloating)
INSTRUCTION_START;
bool update = inst.OPCD & 1; bool update = inst.OPCD & 1;
int s = inst.RS; int s = inst.RS;
@ -291,9 +286,8 @@ void Jit64::stfs(UGeckoInstruction inst)
void Jit64::stfsx(UGeckoInstruction inst) void Jit64::stfsx(UGeckoInstruction inst)
{ {
if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStoreFloating)
INSTRUCTION_START;
// We can take a shortcut here - it's not likely that a hardware access would use this instruction. // We can take a shortcut here - it's not likely that a hardware access would use this instruction.
gpr.FlushLockX(ABI_PARAM1); gpr.FlushLockX(ABI_PARAM1);
@ -311,9 +305,8 @@ void Jit64::stfsx(UGeckoInstruction inst)
void Jit64::lfsx(UGeckoInstruction inst) void Jit64::lfsx(UGeckoInstruction inst)
{ {
if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStoreFloating)
INSTRUCTION_START;
fpr.Lock(inst.RS); fpr.Lock(inst.RS);
fpr.LoadToX64(inst.RS, false, true); fpr.LoadToX64(inst.RS, false, true);

View File

@ -91,9 +91,8 @@ const double GC_ALIGNED16(m_dequantizeTableD[]) =
// We will have to break block after quantizers are written to. // We will have to break block after quantizers are written to.
void Jit64::psq_st(UGeckoInstruction inst) void Jit64::psq_st(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStorePairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStorePaired)
INSTRUCTION_START;
js.block_flags |= BLOCK_USE_GQR0 << inst.I; js.block_flags |= BLOCK_USE_GQR0 << inst.I;
if (js.blockSetsQuantizers || !Core::GetStartupParameter().bOptimizeQuantizers) if (js.blockSetsQuantizers || !Core::GetStartupParameter().bOptimizeQuantizers)
@ -296,9 +295,8 @@ void Jit64::psq_st(UGeckoInstruction inst)
void Jit64::psq_l(UGeckoInstruction inst) void Jit64::psq_l(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStorePairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(LoadStorePaired)
INSTRUCTION_START;
js.block_flags |= BLOCK_USE_GQR0 << inst.I; js.block_flags |= BLOCK_USE_GQR0 << inst.I;

View File

@ -34,16 +34,15 @@
// cmppd, andpd, andnpd, or // cmppd, andpd, andnpd, or
// lfsx, ps_merge01 etc // lfsx, ps_merge01 etc
const u64 GC_ALIGNED16(psSignBits[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL}; const u64 GC_ALIGNED16(psSignBits[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL};
const u64 GC_ALIGNED16(psAbsMask[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL}; const u64 GC_ALIGNED16(psAbsMask[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL};
const double GC_ALIGNED16(psOneOne[2]) = {1.0, 1.0}; const double GC_ALIGNED16(psOneOne[2]) = {1.0, 1.0};
const double GC_ALIGNED16(psZeroZero[2]) = {0.0, 0.0}; const double GC_ALIGNED16(psZeroZero[2]) = {0.0, 0.0};
void Jit64::ps_mr(UGeckoInstruction inst) void Jit64::ps_mr(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Paired)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -53,15 +52,14 @@
return; return;
fpr.LoadToX64(d, false); fpr.LoadToX64(d, false);
MOVAPD(fpr.RX(d), fpr.R(b)); MOVAPD(fpr.RX(d), fpr.R(b));
} }
void Jit64::ps_sel(UGeckoInstruction inst) void Jit64::ps_sel(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Paired)
INSTRUCTION_START;
Default(inst); Default(inst); return;
return;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
@ -86,13 +84,12 @@
ORPD(fpr.RX(d), R(XMM6)); ORPD(fpr.RX(d), R(XMM6));
fpr.UnlockAll(); fpr.UnlockAll();
fpr.UnlockAllX(); fpr.UnlockAllX();
} }
void Jit64::ps_sign(UGeckoInstruction inst) void Jit64::ps_sign(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Paired)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -124,13 +121,12 @@
} }
fpr.UnlockAll(); fpr.UnlockAll();
} }
void Jit64::ps_rsqrte(UGeckoInstruction inst) void Jit64::ps_rsqrte(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Paired)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -142,25 +138,25 @@
DIVPD(XMM1, R(XMM0)); DIVPD(XMM1, R(XMM0));
MOVAPD(fpr.R(d), XMM1); MOVAPD(fpr.R(d), XMM1);
fpr.UnlockAll(); fpr.UnlockAll();
} }
//add a, b, c //add a, b, c
//mov a, b //mov a, b
//add a, c //add a, c
//we need: //we need:
/* /*
psq_l psq_l
psq_stu psq_stu
*/ */
/* /*
add a,b,a add a,b,a
*/ */
//There's still a little bit more optimization that can be squeezed out of this //There's still a little bit more optimization that can be squeezed out of this
void Jit64::tri_op(int d, int a, int b, bool reversible, void (XEmitter::*op)(X64Reg, OpArg)) void Jit64::tri_op(int d, int a, int b, bool reversible, void (XEmitter::*op)(X64Reg, OpArg))
{ {
fpr.Lock(d, a, b); fpr.Lock(d, a, b);
if (d == a) if (d == a)
@ -197,13 +193,12 @@
} }
ForceSinglePrecisionP(fpr.RX(d)); ForceSinglePrecisionP(fpr.RX(d));
fpr.UnlockAll(); fpr.UnlockAll();
} }
void Jit64::ps_arith(UGeckoInstruction inst) void Jit64::ps_arith(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Paired)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -222,13 +217,12 @@
default: default:
_assert_msg_(DYNA_REC, 0, "ps_arith WTF!!!"); _assert_msg_(DYNA_REC, 0, "ps_arith WTF!!!");
} }
} }
void Jit64::ps_sum(UGeckoInstruction inst) void Jit64::ps_sum(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Paired)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -263,14 +257,13 @@
} }
ForceSinglePrecisionP(fpr.RX(d)); ForceSinglePrecisionP(fpr.RX(d));
fpr.UnlockAll(); fpr.UnlockAll();
} }
void Jit64::ps_muls(UGeckoInstruction inst) void Jit64::ps_muls(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Paired)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -302,15 +295,14 @@
} }
ForceSinglePrecisionP(fpr.RX(d)); ForceSinglePrecisionP(fpr.RX(d));
fpr.UnlockAll(); fpr.UnlockAll();
} }
//TODO: find easy cases and optimize them, do a breakout like ps_arith //TODO: find easy cases and optimize them, do a breakout like ps_arith
void Jit64::ps_mergeXX(UGeckoInstruction inst) void Jit64::ps_mergeXX(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Paired)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -340,15 +332,14 @@
fpr.LoadToX64(d, false); fpr.LoadToX64(d, false);
MOVAPD(fpr.RX(d), Gen::R(XMM0)); MOVAPD(fpr.RX(d), Gen::R(XMM0));
fpr.UnlockAll(); fpr.UnlockAll();
} }
//TODO: add optimized cases //TODO: add optimized cases
void Jit64::ps_maddXX(UGeckoInstruction inst) void Jit64::ps_maddXX(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(Paired)
INSTRUCTION_START;
if (inst.Rc) { if (inst.Rc) {
Default(inst); return; Default(inst); return;
} }
@ -400,4 +391,4 @@
MOVAPD(fpr.RX(d), Gen::R(XMM0)); MOVAPD(fpr.RX(d), Gen::R(XMM0));
ForceSinglePrecisionP(fpr.RX(d)); ForceSinglePrecisionP(fpr.RX(d));
fpr.UnlockAll(); fpr.UnlockAll();
} }

View File

@ -29,11 +29,10 @@
#include "Jit.h" #include "Jit.h"
#include "JitRegCache.h" #include "JitRegCache.h"
void Jit64::mtspr(UGeckoInstruction inst) void Jit64::mtspr(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(SystemRegisters)
INSTRUCTION_START;
u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F); u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F);
int d = inst.RD; int d = inst.RD;
@ -78,13 +77,12 @@
gpr.LoadToX64(d, true); gpr.LoadToX64(d, true);
MOV(32, M(&PowerPC::ppcState.spr[iIndex]), gpr.R(d)); MOV(32, M(&PowerPC::ppcState.spr[iIndex]), gpr.R(d));
gpr.UnlockAll(); gpr.UnlockAll();
} }
void Jit64::mfspr(UGeckoInstruction inst) void Jit64::mfspr(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(SystemRegisters)
INSTRUCTION_START;
u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F); u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F);
int d = inst.RD; int d = inst.RD;
switch (iIndex) switch (iIndex)
@ -92,7 +90,7 @@
case SPR_WPAR: case SPR_WPAR:
Default(inst); Default(inst);
return; return;
// case SPR_DEC: // case SPR_DEC:
//MessageBox(NULL, "Read from DEC", "????", MB_OK); //MessageBox(NULL, "Read from DEC", "????", MB_OK);
//break; //break;
case SPR_TL: case SPR_TL:
@ -106,49 +104,45 @@
gpr.UnlockAll(); gpr.UnlockAll();
break; break;
} }
} }
// ======================================================================================= // =======================================================================================
// Don't interpret this, if we do we get thrown out // Don't interpret this, if we do we get thrown out
// -------------- // --------------
void Jit64::mtmsr(UGeckoInstruction inst) void Jit64::mtmsr(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(SystemRegisters)
INSTRUCTION_START;
gpr.LoadToX64(inst.RS, true, false); gpr.LoadToX64(inst.RS, true, false);
MOV(32, M(&MSR), gpr.R(inst.RS)); MOV(32, M(&MSR), gpr.R(inst.RS));
gpr.Flush(FLUSH_ALL); gpr.Flush(FLUSH_ALL);
fpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL);
WriteExit(js.compilerPC + 4, 0); WriteExit(js.compilerPC + 4, 0);
} }
// ============== // ==============
void Jit64::mfmsr(UGeckoInstruction inst) void Jit64::mfmsr(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(SystemRegisters)
INSTRUCTION_START;
//Privileged? //Privileged?
gpr.LoadToX64(inst.RD, false); gpr.LoadToX64(inst.RD, false);
MOV(32, gpr.R(inst.RD), M(&MSR)); MOV(32, gpr.R(inst.RD), M(&MSR));
} }
void Jit64::mftb(UGeckoInstruction inst) void Jit64::mftb(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(SystemRegisters)
INSTRUCTION_START;
mfspr(inst); mfspr(inst);
} }
void Jit64::mfcr(UGeckoInstruction inst) void Jit64::mfcr(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(SystemRegisters)
INSTRUCTION_START;
// USES_CR // USES_CR
int d = inst.RD; int d = inst.RD;
gpr.LoadToX64(d, false, true); gpr.LoadToX64(d, false, true);
@ -160,13 +154,12 @@
} }
OR(8, R(EAX), M(&PowerPC::ppcState.cr_fast[7])); OR(8, R(EAX), M(&PowerPC::ppcState.cr_fast[7]));
MOV(32, gpr.R(d), R(EAX)); MOV(32, gpr.R(d), R(EAX));
} }
void Jit64::mtcrf(UGeckoInstruction inst) void Jit64::mtcrf(UGeckoInstruction inst)
{ {
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) INSTRUCTION_START
{Default(inst); return;} // turn off from debugger JITDISABLE(SystemRegisters)
INSTRUCTION_START;
// USES_CR // USES_CR
u32 mask = 0; u32 mask = 0;
@ -197,4 +190,4 @@
OR(32, R(EAX), R(ECX)); OR(32, R(EAX), R(ECX));
MOV(32, M(&PowerPC::ppcState.cr), R(EAX)); MOV(32, M(&PowerPC::ppcState.cr), R(EAX));
} }
} }

View File

@ -31,8 +31,8 @@
//#define INSTRUCTION_START Default(inst); return; //#define INSTRUCTION_START Default(inst); return;
#define INSTRUCTION_START #define INSTRUCTION_START
void Jit64::mtspr(UGeckoInstruction inst) void Jit64::mtspr(UGeckoInstruction inst)
{ {
INSTRUCTION_START INSTRUCTION_START
JITDISABLE(SystemRegisters) JITDISABLE(SystemRegisters)
u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F); u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F);
@ -61,10 +61,10 @@
Default(inst); Default(inst);
return; return;
} }
} }
void Jit64::mfspr(UGeckoInstruction inst) void Jit64::mfspr(UGeckoInstruction inst)
{ {
INSTRUCTION_START INSTRUCTION_START
JITDISABLE(SystemRegisters) JITDISABLE(SystemRegisters)
u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F); u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F);
@ -90,36 +90,36 @@
Default(inst); Default(inst);
return; return;
} }
} }
// ======================================================================================= // =======================================================================================
// Don't interpret this, if we do we get thrown out // Don't interpret this, if we do we get thrown out
// -------------- // --------------
void Jit64::mtmsr(UGeckoInstruction inst) void Jit64::mtmsr(UGeckoInstruction inst)
{ {
ibuild.EmitStoreMSR(ibuild.EmitLoadGReg(inst.RS)); ibuild.EmitStoreMSR(ibuild.EmitLoadGReg(inst.RS));
ibuild.EmitBranchUncond(ibuild.EmitIntConst(js.compilerPC + 4)); ibuild.EmitBranchUncond(ibuild.EmitIntConst(js.compilerPC + 4));
} }
// ============== // ==============
void Jit64::mfmsr(UGeckoInstruction inst) void Jit64::mfmsr(UGeckoInstruction inst)
{ {
INSTRUCTION_START INSTRUCTION_START
JITDISABLE(SystemRegisters) JITDISABLE(SystemRegisters)
ibuild.EmitStoreGReg(ibuild.EmitLoadMSR(), inst.RD); ibuild.EmitStoreGReg(ibuild.EmitLoadMSR(), inst.RD);
} }
void Jit64::mftb(UGeckoInstruction inst) void Jit64::mftb(UGeckoInstruction inst)
{ {
INSTRUCTION_START; INSTRUCTION_START;
JITDISABLE(SystemRegisters) JITDISABLE(SystemRegisters)
mfspr(inst); mfspr(inst);
} }
void Jit64::mfcr(UGeckoInstruction inst) void Jit64::mfcr(UGeckoInstruction inst)
{ {
Default(inst); return; Default(inst); return;
#if 0 #if 0
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff)
@ -137,10 +137,10 @@
OR(8, R(EAX), M(&PowerPC::ppcState.cr_fast[7])); OR(8, R(EAX), M(&PowerPC::ppcState.cr_fast[7]));
MOV(32, gpr.R(d), R(EAX)); MOV(32, gpr.R(d), R(EAX));
#endif #endif
} }
void Jit64::mtcrf(UGeckoInstruction inst) void Jit64::mtcrf(UGeckoInstruction inst)
{ {
Default(inst); return; Default(inst); return;
#if 0 #if 0
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff)
@ -177,4 +177,4 @@
MOV(32, M(&PowerPC::ppcState.cr), R(EAX)); MOV(32, M(&PowerPC::ppcState.cr), R(EAX));
} }
#endif #endif
} }