S3C2501X
INSTRUCTION SET
3-59
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
Rn,#p
; If Rn=p OR Rm=q THEN GOTO Label.
BEQ
Label
CMP
Rm,#q
BEQ
Label
This can be replaced by
CMP
Rn,#p
CMPNE
Rm,#q
; If condition not satisfied try other test.
BEQ
Label
Absolute Value
TEQ
Rn,#0
; Test sign
RSBMI
Rn,Rn,#0
; and 2's complement if necessary.
Multiplication by 4, 5 or 6 (Run Time)
MOV
Rc,Ra,LSL#2
; Multiply by 4,
CMP
Rb,#5
; Test value,
ADDCS
Rc,Rc,Ra
; Complete multiply by 5,
ADDHI
Rc,Rc,Ra
; Complete multiply by 6.
Combining Discrete and Range Tests
TEQ
Rc,#127
; Discrete test,
CMPNE
Rc, # “ ” - 1
; Range test
MOVLS
Rc,# “ ”
; IF Rc<= ” ” OR Rc=ASCII(127)
; THEN Rc:= ” ”
Summary of Contents for S3C2501X
Page 18: ......
Page 275: ...MEMORY CONTROLLER S3C2501X 5 60 NOTES ...
Page 289: ...I2C CONTROLLER S3C2501X 6 14 NOTES ...
Page 373: ...GDMA CONTROLLER S3C2501X 9 24 NOTES ...
Page 435: ...I O PORTS S3C2501X 12 12 NOTES ...