Arithmetic
<operation>{cond}{S} Rd,Rn,<Operand2>
<operation>
ADD – add
- Rd := Rn + Operand2
ADC – add with carry
- Rd := Rn + Operand2 + Carry
SUB – subtract
- Rd := Rn − Operand2
SBC – subtract with carry
- Rd := Rn − Operand2 − NOT(Carry)
RSB – reverse subtract
- Rd := Operand2 − Rn
RSC – reverse subtract with carry
- Rd := Operand2 − Rn − NOT(Carry)
Examples
ADD r0, r1, r2
- R0 = R1 + R2
SUB r5, r3, #10
- R5 = R3 − 10
RSB r2, r5, #0xFF00
- R2 = 0xFF00 − R5
Remarks
RSBandRSCsubtract in reverse order (e.g. y − x not x − y).Multiplication has a different format and is described later.
There is no divide instruction – the compiler uses a run-time library function or shifts to perform division.