93
11100B–ATARM–31-Jul-12
SAM4S Series [Preliminary]
A conditional execution can be used with the IT instruction to reduce the number of branch
instructions in code.
also shows the relationship between condition code suffixes and the N, Z, C, and V
flags.
Absolute Value
The example below shows the use of a conditional instruction to find the absolute value of a
number. R0 = ABS(R1).
MOVS
R0, R1
; R0 = R1, setting flags
IT MI
;
IT
instruction for the negative condition
RSBMI
R0, R1, #0
; If negative, R0 = -R1
Compare and Update Value
The example below shows the use of conditional instructions to update the value of R4 if the
signed values R0 is greater than R1 and R2 is greater than R3.
CMP R0,
R1
;
Compare R0 and R1, setting flags
ITT GT
;
IT
instruction for the two GT conditions
CMPGT
R2, R3
; If 'greater than', compare R2 and R3, setting flags
MOVGT
R4, R5
; If still 'greater than', do R4 = R5
11.6.3.8
Instruction Width Selection
There are many instructions that can generate either a 16-bit encoding or a 32-bit encoding
depending on the operands and destination register specified. For some of these instructions,
Table 11-16. Condition Code Suffixes
Suffix
Flags
Meaning
EQ
Z = 1
Equal
NE
Z = 0
Not equal
CS or
HS
C = 1
Higher or same, unsigned
≥
CC or
LO
C = 0
Lower, unsigned <
MI
N = 1
Negative
PL
N = 0
Positive or zero
VS
V = 1
Overflow
VC
V = 0
No overflow
HI
C = 1 and Z = 0
Higher, unsigned >
LS
C = 0 or Z = 1
Lower or same, unsigned
≤
GE
N = V
Greater than or equal, signed
≥
LT
N
!
= V
Less than, signed <
GT
Z = 0 and N = V
Greater than, signed >
LE
Z = 1 and N
! =
V
Less than or equal, signed
≤
AL
Can have any
value
Always. This is the default when no suffix is
specified.
Содержание SAM4S Series
Страница 44: ...44 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Страница 412: ...412 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Страница 1105: ...1105 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Страница 1142: ...1142 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 3 100 ball VFBGA Package Drawing ...
Страница 1143: ...1143 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 4 64 lead LQFP Package Drawing ...
Страница 1145: ...1145 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 5 64 lead QFN Package Drawing ...