ccmn

Conditional Compare Negative (Immediate 64-bit)

CCMN <Xn>, #<imm>, #<nzcv>, <cond>

Compares 64-bit register with negative immediate if condition is true.

Details

Conditional Compare Negative (Immediate), 64-bit. If the condition is true, performs an arithmetic compare of Xn + imm5, otherwise loads the NZCV flags with the immediate value nzcv. The comparison sets or clears N, Z, C, V flags accordingly. AArch64-only instruction.

Pseudocode Operation

if ConditionHolds(cond) then temp ← Xn + imm5; N ← temp[63]; Z ← (temp == 0); C ← UnsignedOverflow(Xn, imm5); V ← SignedOverflow(Xn, imm5) else N ← nzcv[3]; Z ← nzcv[2]; C ← nzcv[1]; V ← nzcv[0]

Example

CCMN x1, #16, #nzcv, cond

Encoding

Binary Layout
1
0
1
11010010
imm5
cond
1
0
Rn
0
nzcv
 
Format Cond Comp
Opcode 0xBA400800
Extension Base

Operands

  • Xn
    Reg
  • imm
    Imm
  • nzcv
    Flags
  • cond
    Condition

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x3A400800 CCMN <Wn>, #<imm>, #<nzcv>, <cond> A64 0 | 0 | 1 | 11010010 | imm5 | cond | 1 | 0 | Rn | 0 | nzcv
0xBA400800 CCMN <Xn>, #<imm>, #<nzcv>, <cond> A64 1 | 0 | 1 | 11010010 | imm5 | cond | 1 | 0 | Rn | 0 | nzcv
0x3A400000 CCMN <Wn>, <Wm>, #<nzcv>, <cond> A64 0 | 0 | 1 | 11010010 | Rm | cond | 0 | 0 | Rn | 0 | nzcv
0xBA400000 CCMN <Xn>, <Xm>, #<nzcv>, <cond> A64 1 | 0 | 1 | 11010010 | Rm | cond | 0 | 0 | Rn | 0 | nzcv

Description

Conditional Compare Negative (immediate) sets the value of the condition flags to the result of the comparison of a register value and a negated immediate value if the condition is TRUE, and an immediate value otherwise.

Operation

if ConditionHolds(cond) then
    bits(datasize) operand1 = X[n, datasize];
    (-, flags) = AddWithCarry(operand1, imm, '0');
PSTATE.<N,Z,C,V> = flags;