diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index 8e3d9558..dd4bb3d9 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -300,7 +300,7 @@ INST(SBCS, "SBCS", "z1111 // Data Processing - Register - Conditional compare INST(CCMN_reg, "CCMN (register)", "z0111010010mmmmmcccc00nnnnn0ffff") -//INST(CCMP_reg, "CCMP (register)", "z1111010010mmmmmcccc00nnnnn0ffff") +INST(CCMP_reg, "CCMP (register)", "z1111010010mmmmmcccc00nnnnn0ffff") //INST(CCMN_imm, "CCMN (immediate)", "z0111010010iiiiicccc10nnnnn0ffff") //INST(CCMP_imm, "CCMP (immediate)", "z1111010010iiiiicccc10nnnnn0ffff") diff --git a/src/frontend/A64/translate/impl/data_processing_conditional_compare.cpp b/src/frontend/A64/translate/impl/data_processing_conditional_compare.cpp index a617b07e..34513226 100644 --- a/src/frontend/A64/translate/impl/data_processing_conditional_compare.cpp +++ b/src/frontend/A64/translate/impl/data_processing_conditional_compare.cpp @@ -21,4 +21,17 @@ bool TranslatorVisitor::CCMN_reg(bool sf, Reg Rm, Cond cond, Reg Rn, Imm<4> nzcv return true; } +bool TranslatorVisitor::CCMP_reg(bool sf, Reg Rm, Cond cond, Reg Rn, Imm<4> nzcv) { + const size_t datasize = sf ? 64 : 32; + const u32 flags = nzcv.ZeroExtend() << 28; + + const IR::U32U64 operand1 = X(datasize, Rn); + const IR::U32U64 operand2 = X(datasize, Rm); + + 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