ARM Instruction Set - Data processing
ARM7TDMI Data Sheet
ARM DDI 0029E
4-11
O
The second operand may be a shifted register (Rm) or a rotated 8 bit immediate value
(Imm) according to the value of the I bit in the instruction. The condition codes in the
CPSR may be preserved or updated as a result of this instruction, according to the
value of the S bit in the instruction.
Certain operations (TST, TEQ, CMP, CMN) do not write the result to Rd. They are used
only to perform tests and to set the condition codes on the result and always have the
S bit set. The instructions and their effects are listed in
·
Table 4-3: ARM Data
processing instructions
on page 4-11
.
4.5.1 CPSR flags
The data processing operations may be classified as logical or arithmetic. The logical
operations (AND, EOR, TST, TEQ, ORR, MOV, BIC, MVN) perform the logical action
on all corresponding bits of the operand or operands to produce the result. If the S bit
is set (and Rd is not R15, see below) the V flag in the CPSR will be unaffected, the C
flag will be set to the carry out from the barrel shifter (or preserved when the shift
operation is LSL #0), the Z flag will be set if and only if the result is all zeros, and the
N flag will be set to the logical value of bit 31 of the result
.
Assembler
Mnemonic
OpCode
Action
AND
0000
operand1 AND operand2
EOR
0001
operand1 EOR operand2
SUB
0010
operand1 - operand2
RSB
0011
operand2 - operand1
ADD
0100
operand1 + operand2
ADC
0101
operand1 + operand2 + carry
SBC
0110
operand1 - operand2 + carry - 1
RSC
0111
operand2 - operand1 + carry - 1
TST
1000
as AND, but result is not written
TEQ
1001
as EOR, but result is not written
CMP
1010
as SUB, but result is not written
CMN
1011
as ADD, but result is not written
ORR
1100
operand1 OR operand2
MOV
1101
operand2
(operand1 is ignored)
BIC
1110
operand1 AND NOT operand2
(Bit clear)
MVN
1111
NOT operand2
(operand1 is ignored)
Table 4-3: ARM Data processing instructions