SBC[S] : Subtract with Carry

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.