1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-07 23:29:06 +00:00

Handle bclrx set and clear.

This commit is contained in:
Thomas Harte 2022-03-25 06:25:06 -04:00
parent 089e03afe8
commit 7d4fe55d63
2 changed files with 23 additions and 10 deletions

View File

@ -137,7 +137,12 @@ enum class Operation: uint8_t {
/// version as the branch target. Other processors will use the decremented version.
bcctrx,
bclrx, cmp, cmpi, cmpl, cmpli,
/// Branch conditional to link register.
///
/// bi(), bo() and lk() are as per bcx.
bclrx,
cmp, cmpi, cmpl, cmpli,
cntlzwx, crand, crandc, creqv, crnand, crnor, cror, crorc, crxor, dcbf,
dcbst, dcbt, dcbtst, dcbz, divwx, divwux, eciwx, ecowx, eieio, eqvx,
extsbx, extshx, fabsx, faddx, faddsx, fcmpo, fcmpu, fctiwx, fctiwzx,

View File

@ -53,35 +53,43 @@ using namespace InstructionSet::PowerPC;
NSAssert(FALSE, @"Didn't handle %@", line);
break;
case Operation::bclrx:
case Operation::bcctrx: {
NSString *baseOperation = nil;
switch(instruction.branch_options()) {
case BranchOptions::Always: baseOperation = @"bctr"; break;
case BranchOptions::Always: baseOperation = @"b"; break;
case BranchOptions::Clear:
switch(Condition(instruction.bi() & 3)) {
default: break;
case Condition::Negative: baseOperation = @"bgectr"; break;
case Condition::Positive: baseOperation = @"blectr"; break;
case Condition::Zero: baseOperation = @"bnectr"; break;
case Condition::Negative: baseOperation = @"bge"; break;
case Condition::Positive: baseOperation = @"ble"; break;
case Condition::Zero: baseOperation = @"bne"; break;
case Condition::SummaryOverflow:
baseOperation = @"bsoctr";
baseOperation = @"bns";
break;
}
break;
case BranchOptions::Set:
switch(Condition(instruction.bi() & 3)) {
default: break;
case Condition::Negative: baseOperation = @"bltctr"; break;
case Condition::Positive: baseOperation = @"bgtctr"; break;
case Condition::Zero: baseOperation = @"beqctr"; break;
case Condition::Negative: baseOperation = @"blt"; break;
case Condition::Positive: baseOperation = @"bgt"; break;
case Condition::Zero: baseOperation = @"beq"; break;
case Condition::SummaryOverflow:
baseOperation = @"bnsctr";
baseOperation = @"bso";
break;
}
break;
default: break;
}
if(instruction.operation == Operation::bcctrx) {
baseOperation = [baseOperation stringByAppendingString:@"ctr"];
} else {
baseOperation = [baseOperation stringByAppendingString:@"lr"];
}
if(!baseOperation) {
NSAssert(FALSE, @"Didn't handle bi %d for bo %d, %@", instruction.bi() & 3, instruction.bo(), line);
} else {