RSC

From ARMwiki
(Difference between revisions)
Jump to: navigation, search
(Created.)

Revision as of 07:55, 22 December 2011

RSC
Instruction RSC[S]
Function Subtraction
Category Data processing
ARM family All
Notes -

Contents

RSC[S]

RSC will subtract one value from another, with Borrow (NOT Carry). As for RSB, the subtraction is performed in reverse, with operand 2 being the value subtracted from.

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 (RSCS), 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.

RSC is used for multi-word negation. When used with RSB, you can perform 64 bit (etc) calculations.

Syntax

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

Function

  dest = op_2 - op_1 - NOT(Carry)

Example

To negate a 64 bit value (held in R0,R1) and write the result to R4,R5; you would:

  RSBS R4, R0, #0
  SBC  R5, R1, #0

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 1 1 1 1 S op_1 dest op_2/shift
Personal tools
Namespaces

Variants
Actions
Navigation
Contents
Toolbox