S3C2501X
3.18 INSTRUCTION SET EXAMPLES
The following examples show ways in which the basic ARM9TDMI instructions can combine to give efficient
code. None of these methods saves a great deal of execution time (although they may save some), mostly they
just save code.
3.18.1 USING THE CONDITIONAL INSTRUCTIONS
Using Conditionals for Logical OR
CMP
BEQ
CMP
BEQ
This can be replaced by
CMP
CMPNE
BEQ
Absolute Value
TEQ
RSBMI
Multiplication by 4, 5 or 6 (Run Time)
MOV
CMP
ADDCS
ADDHI
Combining Discrete and Range Tests
TEQ
CMPNE
MOVLS
Rn,#p
Label
Rm,#q
Label
Rn,#p
Rm,#q
Label
Rn,#0
Rn,Rn,#0
Rc,Ra,LSL#2
Rb,#5
Rc,Rc,Ra
Rc,Rc,Ra
Rc,#127
Rc, # " " - 1
Rc,# " "
; If Rn=p OR Rm=q THEN GOTO Label.
; If condition not satisfied try other test.
; Test sign
; and 2's complement if necessary.
; Multiply by 4,
; Test value,
; Complete multiply by 5,
; Complete multiply by 6.
; Discrete test,
; Range test
; IF Rc<= " " OR Rc=ASCII(127)
; THEN Rc:= " "
INSTRUCTION SET
3-59