# SBC

Instruction | SBC[S] |
---|---|

Function | Subtraction |

Category | Data processing |

ARM family | All |

Notes | - |

## Contents |

## SBC[S]

SBC will subtract one value from another, with Borrow (NOT Carry).

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 (* SBCS*), 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 borrow (a not-carry; unsigned underflow);

**V**if the result generated a signed overflow.

* SBC* is used for multi-word subtraction. When used with SUB, you can perform 64 bit (etc) calculations.

If you should need to perform the subtraction in reverse (i.e. the shifted register/immediate minus register), look at RSB (Reverse SuBtract) and RSC (Reverse Subtract with Carry).

### Syntax

SBC<suffix> <dest>, <op 1>, <op 2>

### Function

dest = op_1 - op_2 - NOT(Carry)

### Example

If R0 and R1 hold a 64 bit value, and R2 and R3 hold a second, you can subtract the second from the first, leaving the difference in R4 and R5. In each case, the first register specified (R0, R2, R4) holds the least significant word.

SUBS R4, R0, R2 SBC R5, R1, R3

### 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 1 0 | S | op_1 | dest | op_2/shift |