Conditional compare (immediate)
This instruction sets the value of the condition flags to the result of the comparison of a register value and an immediate value if the condition is TRUE, and an immediate value otherwise.
31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | |||||||||||||||||||
sf | op | S | imm5 | cond | o2 | Rn | o3 | nzcv |
---|
CCMP <Wn>, #<imm>, #<nzcv>, <cond>
CCMP <Xn>, #<imm>, #<nzcv>, <cond>
constant integer n = UInt(Rn); constant integer datasize = 32 << UInt(sf); constant bits(4) condition = cond; bits(4) flags = nzcv; constant bits(datasize) imm = ZeroExtend(imm5, datasize);
if ConditionHolds(condition) then constant bits(datasize) operand1 = X[n, datasize]; constant bits(datasize) operand2 = imm; (-, flags) = AddWithCarry(operand1, NOT(operand2), '1'); PSTATE.= flags;
If PSTATE.DIT is 1: