CMN (register)

A32: data processing and miscellaneous instructions / T32: 16-bit instructions

fixed bit field field the encoding fixes should be

A1

313029282726252423222120191817161514131211109876543210
cond00010111Rn0000imm5stype0Rm

xxxx00010111xxxx0000xxxxxxx0xxxx
cond != 1111

Decode Sail

if ConditionPassed() then {
    assert(cond != 0b1111);
    shift_n : int = undefined;
    shift_t : SRType = undefined;
    let 'n = UInt(Rn);
    let 'm = UInt(Rm);
    (shift_t, shift_n) = DecodeImmShift(stype, imm5);
    let 'shift_n = shift_n;
    execute_aarch32_instrs_CMN_r_Op_A_txt(m, n, shift_n, shift_t)
};
()

T1

1514131211109876543210
0100001011RmRn

0100001011xxxxxx

Decode Sail

if ConditionPassed() then {
    shift_n : int = undefined;
    shift_t : SRType = undefined;
    let 'n = UInt(Rn);
    let 'm = UInt(Rm);
    (shift_t, shift_n) = (SRType_LSL, 0);
    let 'shift_n = shift_n;
    execute_aarch32_instrs_CMN_r_Op_A_txt(m, n, shift_n, shift_t)
};
()

Operation Sail

nzcv : bits(4) = undefined;
result : bits(32) = undefined;
let shifted : bits(32) = Shift(R_read(m), shift_t, shift_n, PSTATE.C);
(result, nzcv) = AddWithCarry(R_read(n), shifted, 0b0);
(PSTATE.N @ PSTATE.Z @ PSTATE.C @ PSTATE.V) = nzcv

Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.