Thumb Instruction Reference
5-20 Copyright © 2000, 2001 ARM Limited. All rights reserved. ARM DUI 0068B
5.2.4 ADD, pc or sp relative
Add an immediate constant to the value from sp or pc, and place the result into a low
register.
Syntax
ADD Rd, Rp, #expr
where:
Rd
is the destination register.
Rd
must be in the range
r0
-
r7
.
Rp
is either
sp
or
pc
.
expr
is an expression that evaluates (at assembly time) to a multiple of 4 in the
range 0-1020.
Usage
This instruction adds the value of
expr
to the value from
Rp
, and places the result in
Rd
.
Note
If
Rp
is the pc, the value used is:
(the address of the current instruction + 4) AND
&FFFFFFFC
.
Condition flags
This instruction does not affect the flags.
Architectures
This instruction is available in all T variants of the ARM architecture.
Examples
ADD r6,sp,#64
ADD r2,pc,#980
ADD r0,pc,#lit-{PC} ; lit - {PC} must evaluate, at assembly
; time, to a multiple of 4 in the range
; 0 to 1020