
ARM Instruction Set - TEQ, TST, CMP & CMN
ARM7TDMI Data Sheet
ARM DDI 0029E
4-16
O
4.5.4 Writing to R15
When Rd is a register other than R15, the condition code flags in the CPSR may be
updated from the ALU flags as described above.
When Rd is R15 and the S flag in the instruction is not set the result of the operation
is placed in R15 and the CPSR is unaffected.
When Rd is R15 and the S flag is set the result of the operation is placed in R15 and
the SPSR corresponding to the current mode is moved to the CPSR. This allows state
changes which atomically restore both PC and CPSR. This form of instruction should
not be used in User mode.
4.5.5 Using R15 as an operand
If R15 (the PC) is used as an operand in a data processing instruction the register is
used directly.
The PC value will be the address of the instruction, plus 8 or 12 bytes due to instruction
prefetching. If the shift amount is specified in the instruction, the PC will be 8 bytes
ahead. If a register is used to specify the shift amount the PC will be 12 bytes ahead.
4.5.6 TEQ, TST, CMP and CMN opcodes
Note
TEQ, TST, CMP and CMN do not write the result of their operation but do set flags in
the CPSR. An assembler should always set the S flag for these instructions even if this
is not specified in the mnemonic.
The TEQP form of the TEQ instruction used in earlier ARM processors must not be
used: the PSR transfer operations should be used instead.
The action of TEQP in the ARM7TDMI is to move SPSR_<mode> to the CPSR if the
processor is in a privileged mode and to do nothing if in User mode.
4.5.7 Instruction cycle times
Data Processing instructions vary in the number of incremental cycles taken as
follows:
S, N and I are as defined in
·
6.2 Cycle Types
on page 6-2.
Processing Type
Cycles
Normal Data Processing
1S
Data Processing with register specified shift
1S + 1I
Data Processing with PC written
2S + 1N
Data Processing with register specified shift and PC written
2S + 1N + 1I
Table 4-4: Incremental cycle times