Thumb Instruction Reference

5.2.1ADD and SUB, low registers

Add and subtract. There are three forms of these instructions that operate on low registers. You can:

add or subtract the contents of two registers, and place the result in a third register

add a small integer to, or subtract it from, the value in a register, and place the result in a different register

add a larger integer to, or subtract it from, the value in a register, and return the result to the same register.

Syntax

op Rd, Rn, Rm

op Rd, Rn, #expr3 op Rd, #expr8

where:

 

op

is either ADD or SUB.

Rd

is the destination register. It is also used for the first operand in op

 

Rd,#expr8 instructions.

Rn

is a register containing the first operand.

Rm

is a register containing the second operand.

expr3

is an expression evaluating (at assembly time) to an integer in the range

 

–7 to +7.

expr8

is an expression evaluating (at assembly time) to an integer in the range

 

–255 to +255.

Usage

op Rd,Rn,Rm performs an Rn + Rm or an Rn Rm operation, and places the result in Rd.

op Rd,Rn,#expr3 performs an Rn + expr3 or an Rn expr3 operation, and places the result in Rd.

op Rd,#expr8 performs an Rd + expr8 or an Rd expr8 operation, and places the result in

Rd.

5-16

Copyright © 2000, 2001 ARM Limited. All rights reserved.

ARM DUI 0068B

Page 210
Image 210
ARM VERSION 1.2 manual ADD and SUB, low registers, To +7, 255 to +255