A64: Implement CCMP (immediate)

This commit is contained in:
Lioncash 2018-02-04 19:21:02 -05:00 committed by MerryMage
parent ab4664de61
commit 5a65313236
2 changed files with 14 additions and 1 deletions

View file

@ -302,7 +302,7 @@ INST(SBCS, "SBCS", "z1111
INST(CCMN_reg, "CCMN (register)", "z0111010010mmmmmcccc00nnnnn0ffff")
INST(CCMP_reg, "CCMP (register)", "z1111010010mmmmmcccc00nnnnn0ffff")
INST(CCMN_imm, "CCMN (immediate)", "z0111010010iiiiicccc10nnnnn0ffff")
//INST(CCMP_imm, "CCMP (immediate)", "z1111010010iiiiicccc10nnnnn0ffff")
INST(CCMP_imm, "CCMP (immediate)", "z1111010010iiiiicccc10nnnnn0ffff")
// Data Processing - Register - Conditional select
INST(CSEL, "CSEL", "z0011010100mmmmmcccc00nnnnnddddd")

View file

@ -47,4 +47,17 @@ bool TranslatorVisitor::CCMN_imm(bool sf, Imm<5> imm5, Cond cond, Reg Rn, Imm<4>
return true;
}
bool TranslatorVisitor::CCMP_imm(bool sf, Imm<5> imm5, Cond cond, Reg Rn, Imm<4> nzcv) {
const size_t datasize = sf ? 64 : 32;
const u32 flags = nzcv.ZeroExtend<u32>() << 28;
const IR::U32U64 operand1 = X(datasize, Rn);
const IR::U32U64 operand2 = I(datasize, imm5.ZeroExtend<u32>());
const IR::NZCV then_flags = ir.NZCVFrom(ir.AddWithCarry(operand1, ir.Not(operand2), ir.Imm1(1)));
const IR::NZCV else_flags = ir.NZCVFromPackedFlags(ir.Imm32(flags));
ir.SetNZCV(ir.ConditionalSelect(cond, then_flags, else_flags));
return true;
}
} // namespace Dynarmic::A64