RSB
Reverse Subtract without carry.
Syntax
RSB
{S
}{
}
{cond
},
Rd
,
Rn
Operand2
where:
S
is an optional suffix. If S is specified, the condition flags are updated on the result of the operation.
cond
is an optional condition code.
Rd
is the destination register.
Rn
is the register holding the first operand.
Operand2
is a flexible second operand.
Operation
The RSB
instruction subtracts the
value in Rn
from the value of Operand2
.
This is useful because of the wide range of options for Operand2
.
In certain circumstances, the assembler can substitute one instruction for another. Be aware of this when reading disassembly listings.
Use of PC and SP in T32 instructions
You cannot use PC (R15
) for
or
any operand.Rd
You cannot use SP (R13
) for
or
any operand.Rd
Use of PC and SP in A32 instructions
You cannot use PC for Rd
or
any operand in an RSB
instruction that
has a register-controlled shift.
Use of PC for any operand, in instructions without register-controlled shift, is deprecated.
If you use PC (R15
) as Rn
or Rm
,
the value used is the address of the instruction plus 8.
If you use PC as Rd
:
- Execution branches to the address corresponding to the result.
- If you use the S suffix, see the
SUBS pc,lr
instruction.
Use of SP and PC in A32 instructions is deprecated.
Condition flags
If S is specified, the RSB
instruction
updates the N, Z, C and V flags according to the result.
16-bit instructions
The following forms of this instruction are available in T32 code, and are 16-bit instructions:
RSBS
Rd
,Rn
, #0
andRd
must both be Lo registers. This form can only be used outside an IT block.Rn
RSB{
cond
}Rd
,Rn
, #0
andRd
must both be Lo registers. This form can only be used inside an IT block.Rn
Example
RSB r4, r4, #1280 ; subtracts contents of R4 from 1280