mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
PPCRec: Simplify PPC and IML logic instructions
Also implement PPC NAND instruction
This commit is contained in:
@@ -562,24 +562,6 @@ bool PPCRecompilerX64Gen_imlInstruction_r_r(PPCRecFunction_t* PPCRecFunction, pp
|
||||
{
|
||||
x64Gen_movSignExtend_reg64Low32_reg64Low16(x64GenContext, imlInstruction->op_r_r.regR, reg32ToReg16(imlInstruction->op_r_r.regA));
|
||||
}
|
||||
else if( imlInstruction->operation == PPCREC_IML_OP_OR || imlInstruction->operation == PPCREC_IML_OP_AND || imlInstruction->operation == PPCREC_IML_OP_XOR )
|
||||
{
|
||||
if( imlInstruction->operation == PPCREC_IML_OP_OR )
|
||||
{
|
||||
// registerResult |= registerA
|
||||
x64Gen_or_reg64Low32_reg64Low32(x64GenContext, imlInstruction->op_r_r.regR, imlInstruction->op_r_r.regA);
|
||||
}
|
||||
else if( imlInstruction->operation == PPCREC_IML_OP_AND )
|
||||
{
|
||||
// registerResult &= registerA
|
||||
x64Gen_and_reg64Low32_reg64Low32(x64GenContext, imlInstruction->op_r_r.regR, imlInstruction->op_r_r.regA);
|
||||
}
|
||||
else
|
||||
{
|
||||
// registerResult ^= registerA
|
||||
x64Gen_xor_reg64Low32_reg64Low32(x64GenContext, imlInstruction->op_r_r.regR, imlInstruction->op_r_r.regA);
|
||||
}
|
||||
}
|
||||
else if( imlInstruction->operation == PPCREC_IML_OP_NOT )
|
||||
{
|
||||
// copy register content if different registers
|
||||
@@ -652,18 +634,6 @@ bool PPCRecompilerX64Gen_imlInstruction_r_s32(PPCRecFunction_t* PPCRecFunction,
|
||||
{
|
||||
x64Gen_mov_reg64Low32_imm32(x64GenContext, imlInstruction->op_r_immS32.regR, (uint32)imlInstruction->op_r_immS32.immS32);
|
||||
}
|
||||
else if( imlInstruction->operation == PPCREC_IML_OP_AND )
|
||||
{
|
||||
x64Gen_and_reg64Low32_imm32(x64GenContext, imlInstruction->op_r_immS32.regR, (uint32)imlInstruction->op_r_immS32.immS32);
|
||||
}
|
||||
else if( imlInstruction->operation == PPCREC_IML_OP_OR )
|
||||
{
|
||||
x64Gen_or_reg64Low32_imm32(x64GenContext, imlInstruction->op_r_immS32.regR, (uint32)imlInstruction->op_r_immS32.immS32);
|
||||
}
|
||||
else if( imlInstruction->operation == PPCREC_IML_OP_XOR )
|
||||
{
|
||||
x64Gen_xor_reg64Low32_imm32(x64GenContext, imlInstruction->op_r_immS32.regR, (uint32)imlInstruction->op_r_immS32.immS32);
|
||||
}
|
||||
else if( imlInstruction->operation == PPCREC_IML_OP_LEFT_ROTATE )
|
||||
{
|
||||
if( (imlInstruction->op_r_immS32.immS32&0x80) )
|
||||
|
||||
@@ -32,16 +32,6 @@ void IMLInstruction::CheckRegisterUsage(IMLUsedRegisters* registersUsed) const
|
||||
registersUsed->readGPR1 = op_r_r.regR;
|
||||
registersUsed->readGPR2 = op_r_r.regA;
|
||||
}
|
||||
else if (
|
||||
operation == PPCREC_IML_OP_OR ||
|
||||
operation == PPCREC_IML_OP_AND ||
|
||||
operation == PPCREC_IML_OP_XOR)
|
||||
{
|
||||
// result is read and written, operand is read
|
||||
registersUsed->writtenGPR1 = op_r_r.regR;
|
||||
registersUsed->readGPR1 = op_r_r.regR;
|
||||
registersUsed->readGPR2 = op_r_r.regA;
|
||||
}
|
||||
else if (
|
||||
operation == PPCREC_IML_OP_ASSIGN ||
|
||||
operation == PPCREC_IML_OP_ENDIAN_SWAP ||
|
||||
@@ -60,17 +50,18 @@ void IMLInstruction::CheckRegisterUsage(IMLUsedRegisters* registersUsed) const
|
||||
}
|
||||
else if (type == PPCREC_IML_TYPE_R_S32)
|
||||
{
|
||||
cemu_assert_debug(operation != PPCREC_IML_OP_ADD &&
|
||||
operation != PPCREC_IML_OP_SUB &&
|
||||
operation != PPCREC_IML_OP_AND &&
|
||||
operation != PPCREC_IML_OP_OR &&
|
||||
operation != PPCREC_IML_OP_XOR); // deprecated, use r_r_s32 for these
|
||||
|
||||
if (operation == PPCREC_IML_OP_MTCRF)
|
||||
{
|
||||
// operand register is read only
|
||||
registersUsed->readGPR1 = op_r_immS32.regR;
|
||||
}
|
||||
else if (operation == PPCREC_IML_OP_ADD || // deprecated
|
||||
operation == PPCREC_IML_OP_SUB ||
|
||||
operation == PPCREC_IML_OP_AND ||
|
||||
operation == PPCREC_IML_OP_OR ||
|
||||
operation == PPCREC_IML_OP_XOR ||
|
||||
operation == PPCREC_IML_OP_LEFT_ROTATE)
|
||||
else if (operation == PPCREC_IML_OP_LEFT_ROTATE)
|
||||
{
|
||||
// operand register is read and write
|
||||
registersUsed->readGPR1 = op_r_immS32.regR;
|
||||
@@ -87,7 +78,7 @@ void IMLInstruction::CheckRegisterUsage(IMLUsedRegisters* registersUsed) const
|
||||
{
|
||||
if (operation == PPCREC_IML_OP_ASSIGN)
|
||||
{
|
||||
// result is written, but also considered read (in case the condition fails)
|
||||
// result is written, but also considered read (in case the condition is false the input is preserved)
|
||||
registersUsed->readGPR1 = op_conditional_r_s32.regR;
|
||||
registersUsed->writtenGPR1 = op_conditional_r_s32.regR;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user