SUBS (shifted register)

Data processing (register)

fixed bit field field the encoding fixes should be

Integer arithmetic add sub shifted register

313029282726252423222120191817161514131211109876543210
sf1101011shift0Rmimm6RnRd
opS

x1101011xx0xxxxxxxxxxxxxxxxxxxxx

Decode Sail

let 'd = UInt(Rd);
let 'n = UInt(Rn);
let 'm = UInt(Rm);
let 'datasize = if sf == 0b1 then 64 else 32;
let sub_op : bool = op == 0b1;
let setflags : bool = S == 0b1;
if shift == 0b11 then {
    throw(Error_Undefined())
};
if sf == 0b0 & [imm6[5]] == 0b1 then {
    throw(Error_Undefined())
};
let shift_type : ShiftType = DecodeShift(shift);
let 'shift_amount = UInt(imm6);
execute_aarch64_instrs_integer_arithmetic_add_sub_shiftedreg(d, datasize, m, n, setflags, shift_amount, shift_type, sub_op)

Operation Sail

result : bits('datasize) = undefined;
let operand1 : bits('datasize) = X_read(n, datasize);
operand2 : bits('datasize) = ShiftReg(m, shift_type, shift_amount, datasize);
nzcv : bits(4) = undefined;
carry_in : bits(1) = undefined;
if sub_op then {
    operand2 = not_vec(operand2);
    carry_in = 0b1
} else {
    carry_in = 0b0
};
(result, nzcv) = AddWithCarry(operand1, operand2, carry_in);
if setflags then {
    (PSTATE.N @ PSTATE.Z @ PSTATE.C @ PSTATE.V) = nzcv
};
X_set(d, datasize) = result

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.