# ADD

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Instruction ADD[S] Addition Data processing All -

## ADD[S]

ADD will add two values.

Operand 1 is a register, operand 2 can be a register, shifted register, or an immediate value (which may be shifted).

If the S bit is set (ADDS), the N and Z flags are set according to the result, and the C and V flags are set as follows: C if the result generated a carry (unsigned overflow); V if the result generated a signed overflow.

ADD is useful for basic addition. Use ADC to perform addition with the Carry flag considered.

### Syntax

```  ADD<suffix>  <dest>, <op 1>, <op 2>
```

### Function

```  dest = op_1 + op_2
```

### Example

```  ADD  R0, R0, R1    ; Adds R1 to R0
ADD  R0, R0, #1    ; Increment R0 by one
```

### Technical

The instruction bit pattern is as follows:

31 - 28 27 26 25 24 - 21 20 19 - 16 15 - 12 11 - 0
condition 0 0 I 0 1 0 0 S op_1 dest op_2/shift

Note: If the I bit is zero, and bits 4 and 7 are both one (with bits 5,6 zero), the instruction is UMULL, not ADD.