Merge pull request #7631 from MerryMage/crXXX-AeqB

Jit_SystemRegisters: Special-case crXXX for CRBA == CRBB
This commit is contained in:
Markus Wick 2018-12-23 17:55:09 +01:00 committed by GitHub
commit 54f37c3bae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 14 deletions

View File

@ -552,23 +552,40 @@ void Jit64::crXXX(UGeckoInstruction inst)
JITDISABLE(bJITSystemRegistersOff); JITDISABLE(bJITSystemRegistersOff);
DEBUG_ASSERT_MSG(DYNA_REC, inst.OPCD == 19, "Invalid crXXX"); DEBUG_ASSERT_MSG(DYNA_REC, inst.OPCD == 19, "Invalid crXXX");
// Special case: crclr // TODO(merry): Futher optimizations can be performed here. For example,
if (inst.CRBA == inst.CRBB && inst.CRBA == inst.CRBD && inst.SUBOP10 == 193) // instead of extracting each CR field bit then setting it, the operation
{ // could be performed on the internal format directly instead and the
ClearCRFieldBit(inst.CRBD >> 2, 3 - (inst.CRBD & 3)); // relevant bit result can be masked out.
return;
}
// Special case: crset if (inst.CRBA == inst.CRBB)
if (inst.CRBA == inst.CRBB && inst.CRBA == inst.CRBD && inst.SUBOP10 == 289)
{ {
SetCRFieldBit(inst.CRBD >> 2, 3 - (inst.CRBD & 3)); switch (inst.SUBOP10)
return; {
} // crclr
case 129: // crandc: A && ~B => 0
case 193: // crxor: A ^ B => 0
ClearCRFieldBit(inst.CRBD >> 2, 3 - (inst.CRBD & 3));
return;
// TODO(delroth): Potential optimizations could be applied here. For // crset
// instance, if the two CR bits being loaded are the same, two loads are case 289: // creqv: ~(A ^ B) => 1
// not required. case 417: // crorc: A || ~B => 1
SetCRFieldBit(inst.CRBD >> 2, 3 - (inst.CRBD & 3));
return;
case 257: // crand: A && B => A
case 449: // cror: A || B => A
GetCRFieldBit(inst.CRBA >> 2, 3 - (inst.CRBA & 3), RSCRATCH, false);
SetCRFieldBit(inst.CRBD >> 2, 3 - (inst.CRBD & 3), RSCRATCH);
return;
case 33: // crnor: ~(A || B) => ~A
case 225: // crnand: ~(A && B) => ~A
GetCRFieldBit(inst.CRBA >> 2, 3 - (inst.CRBA & 3), RSCRATCH, true);
SetCRFieldBit(inst.CRBD >> 2, 3 - (inst.CRBD & 3), RSCRATCH);
return;
}
}
// creqv or crnand or crnor // creqv or crnand or crnor
bool negateA = inst.SUBOP10 == 289 || inst.SUBOP10 == 225 || inst.SUBOP10 == 33; bool negateA = inst.SUBOP10 == 289 || inst.SUBOP10 == 225 || inst.SUBOP10 == 33;