Some conversion updates.

git-svn-id: http://svn.purei.org/purei/trunk@331 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
jpd002 2008-05-28 02:29:57 +00:00
parent 741bceb412
commit ad75d7dfb3
7 changed files with 74 additions and 81 deletions

View File

@ -388,8 +388,7 @@ void CCOP_VU::VRSQRT()
//10
void CCOP_VU::VRINIT()
{
throw runtime_error("Reimplement.");
// VUShared::RINIT(m_pB, m_pCtx, m_nFS, m_nFSF);
VUShared::RINIT(m_codeGen, m_nFS, m_nFSF);
}
//////////////////////////////////////////////////
@ -411,8 +410,7 @@ void CCOP_VU::VWAITQ()
//10
void CCOP_VU::VRXOR()
{
throw runtime_error("Reimplement.");
// VUShared::RXOR(m_pB, m_pCtx, m_nFS, m_nFSF);
VUShared::RXOR(m_codeGen, m_nFS, m_nFSF);
}
//////////////////////////////////////////////////

View File

@ -1178,6 +1178,10 @@ void CCodeGen::Cmp(CONDITION nCondition)
//setb res[l]
m_Assembler.SetbEb(CX86Assembler::MakeByteRegisterAddress(m_nRegisterLookupEx[resultRegister]));
break;
case CONDITION_GT:
//setgt res[l]
m_Assembler.SetgEb(CX86Assembler::MakeByteRegisterAddress(m_nRegisterLookupEx[resultRegister]));
break;
default:
throw exception();
break;
@ -1206,6 +1210,19 @@ void CCodeGen::Cmp(CONDITION nCondition)
Cmp(nCondition);
}
else if(FitsPattern<RegisterConstant>())
{
RegisterConstant::PatternValue ops = GetPattern<RegisterConstant>();
unsigned int register1 = ops.first;
unsigned int register2 = AllocateRegister();
LoadConstantInRegister(register2, ops.second);
PushReg(register1);
PushReg(register2);
Cmp(nCondition);
}
else if(FitsPattern<RelativeRelative>())
{
RelativeRelative::PatternValue ops = GetPattern<RelativeRelative>();

View File

@ -285,23 +285,16 @@ void CMA_VU::CLower::B()
//25
void CMA_VU::CLower::JALR()
{
throw runtime_error("Reimplement.");
//CCodeGen::Begin(m_pB);
//{
// //Save PC
// CCodeGen::PushRel(offsetof(CMIPS, m_State.nPC));
// CCodeGen::PushCst(0x0C);
// CCodeGen::Add();
// CCodeGen::PullRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIT]));
//Save PC
m_codeGen->PushCst(m_nAddress + 0x0C);
m_codeGen->PullRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIT]));
// //Compute new PC
// CCodeGen::PushRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIS]));
// //Decomment -> CCodeGen::Shl(3);
// CCodeGen::PushCst(0x4000);
// CCodeGen::Add();
// CCodeGen::PullRel(offsetof(CMIPS, m_State.nDelayedJumpAddr));
//}
//CCodeGen::End();
//Compute new PC
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIS]));
m_codeGen->Shl(3);
m_codeGen->PushCst(0x4000);
m_codeGen->Add();
m_codeGen->PullRel(offsetof(CMIPS, m_State.nDelayedJumpAddr));
}
//28
@ -343,53 +336,41 @@ void CMA_VU::CLower::IBNE()
//2C
void CMA_VU::CLower::IBLTZ()
{
throw runtime_error("Reimplement.");
//CCodeGen::Begin(m_pB);
//{
// CCodeGen::PushVar(&m_pCtx->m_State.nCOP2VI[m_nIS]);
// CCodeGen::PushCst(0x8000);
// CCodeGen::And();
//
// CCodeGen::PushCst(0);
// CCodeGen::Cmp(CCodeGen::CONDITION_EQ);
//TODO: Merge IBLTZ and IBGEZ
m_codeGen->PushCst(0);
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIS]));
m_codeGen->PushCst(0x8000);
m_codeGen->And();
// SetBranchAddress(false, VUShared::GetBranch(m_nImm11) + 4);
//}
//CCodeGen::End();
m_codeGen->Cmp(CCodeGen::CONDITION_EQ);
SetBranchAddress(false, VUShared::GetBranch(m_nImm11) + 4);
}
//2D
void CMA_VU::CLower::IBGTZ()
{
throw runtime_error("Reimplement.");
//CCodeGen::Begin(m_pB);
//{
// CCodeGen::PushRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIS]));
// CCodeGen::SeX16();
//TODO: Merge IBGTZ and IBLEZ
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIS]));
m_codeGen->SeX16();
// CCodeGen::PushCst(0);
// CCodeGen::Cmp(CCodeGen::CONDITION_GT);
//
// SetBranchAddress(true, VUShared::GetBranch(m_nImm11) + 4);
//}
//CCodeGen::End();
m_codeGen->PushCst(0);
m_codeGen->Cmp(CCodeGen::CONDITION_GT);
SetBranchAddress(true, VUShared::GetBranch(m_nImm11) + 4);
}
//2E
void CMA_VU::CLower::IBLEZ()
{
throw runtime_error("Reimplement.");
//CCodeGen::Begin(m_pB);
//{
// CCodeGen::PushRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIS]));
// CCodeGen::SeX16();
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIS]));
m_codeGen->SeX16();
// CCodeGen::PushCst(0);
// CCodeGen::Cmp(CCodeGen::CONDITION_LE);
//
// SetBranchAddress(true, VUShared::GetBranch(m_nImm11) + 4);
//}
//CCodeGen::End();
m_codeGen->PushCst(0);
m_codeGen->Cmp(CCodeGen::CONDITION_GT);
SetBranchAddress(false, VUShared::GetBranch(m_nImm11) + 4);
}
//2F
@ -668,23 +649,18 @@ void CMA_VU::CLower::RGET()
//0F
void CMA_VU::CLower::ILWR()
{
throw runtime_error("Reimplement.");
//CCodeGen::Begin(m_pB);
//{
// Push context
// CCodeGen::PushRef(m_pCtx);
//Push context
m_codeGen->PushRef(m_pCtx);
// Compute Address
// CCodeGen::PushRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIS]));
// Decomment -> CCodeGen::Shl(4);
// CCodeGen::PushCst(GetDestOffset(m_nDest));
// CCodeGen::Add();
//Compute Address
m_codeGen->PushRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIS]));
m_codeGen->Shl(4);
m_codeGen->PushCst(GetDestOffset(m_nDest));
m_codeGen->Add();
// CCodeGen::Call(reinterpret_cast<void*>(&CMemoryUtils::GetWordProxy), 2, true);
m_codeGen->Call(reinterpret_cast<void*>(&CMemoryUtils::GetWordProxy), 2, true);
// CCodeGen::PullRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIT]));
//}
//CCodeGen::End();
m_codeGen->PullRel(offsetof(CMIPS, m_State.nCOP2VI[m_nIT]));
}
//10

View File

@ -525,19 +525,14 @@ void VUShared::RSQRT(CCodeGen* codeGen, uint8 nFs, uint8 nFsf, uint8 nFt, uint8
codeGen->FP_PullSingle(destination);
}
void VUShared::RXOR(CCodeGen* codeGen, CMIPS* pCtx, uint8 nFs, uint8 nFsf)
void VUShared::RXOR(CCodeGen* codeGen, uint8 nFs, uint8 nFsf)
{
throw runtime_error("Reimplement.");
//CCodeGen::Begin(pB);
//{
// CCodeGen::PushRel(offsetof(CMIPS, m_State.nCOP2[nFs].nV[nFsf]));
// CCodeGen::PushRel(offsetof(CMIPS, m_State.nCOP2R));
// CCodeGen::Xor();
// CCodeGen::PushCst(0x007FFFFF);
// CCodeGen::And();
// CCodeGen::PullRel(offsetof(CMIPS, m_State.nCOP2R));
//}
//CCodeGen::End();
codeGen->PushRel(offsetof(CMIPS, m_State.nCOP2[nFs].nV[nFsf]));
codeGen->PushRel(offsetof(CMIPS, m_State.nCOP2R));
codeGen->Xor();
codeGen->PushCst(0x007FFFFF);
codeGen->And();
codeGen->PullRel(offsetof(CMIPS, m_State.nCOP2R));
}
void VUShared::SQRT(CCodeGen* codeGen, uint8 nFt, uint8 nFtf, uint32 address, unsigned int pipeMult)

View File

@ -71,7 +71,7 @@ namespace VUShared
void OPMULA(CCodeGen*, uint8, uint8);
void RINIT(CCodeGen*, uint8, uint8);
void RSQRT(CCodeGen*, uint8, uint8, uint8, uint8, uint32, unsigned int);
void RXOR(CCodeGen*, CMIPS*, uint8, uint8);
void RXOR(CCodeGen*, uint8, uint8);
void SQRT(CCodeGen*, uint8, uint8, uint32, unsigned int);
void SUB(CCodeGen*, uint8, uint8, uint8, uint8);
void SUBbc(CCodeGen*, uint8, uint8, uint8, uint8, uint8);

View File

@ -503,6 +503,12 @@ void CX86Assembler::SetlEb(const CAddress& address)
WriteEvOp(0x9C, 0x00, false, address);
}
void CX86Assembler::SetgEb(const CAddress& address)
{
WriteByte(0x0F);
WriteEvOp(0x9F, 0x00, false, address);
}
void CX86Assembler::ShlEd(const CAddress& address)
{
WriteEvOp(0xD3, 0x04, false, address);

View File

@ -164,6 +164,7 @@ public:
void SeteEb(const CAddress&);
void SetneEb(const CAddress&);
void SetlEb(const CAddress&);
void SetgEb(const CAddress&);
void ShrEd(const CAddress&);
void ShrEd(const CAddress&, uint8);
void ShrdEd(const CAddress&, REGISTER);