SAM3X8E Atmel Corporation, SAM3X8E Datasheet - Page 98

no-image

SAM3X8E

Manufacturer Part Number
SAM3X8E
Description
Manufacturer
Atmel Corporation
Datasheets
11.11.7.3
The example below shows the use of a conditional instruction to find the absolute value of a number. R0 = ABS(R1).
11.11.7.4
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.
11.11.8
11.11.8.1
To use an instruction width suffix, place it immediately after the instruction mnemonic and condition code, if any. The exam-
ple below shows instructions with the instruction width suffix.
98
98
MOVS
IT
RSBMI
CMP
ITT
CMPGT
MOVGT
BCS.W
ADDS.W R0, R0, R1 ; creates a 32-bit instruction even though the same
SAM3X/A
SAM3X/A
Instruction width selection
Absolute value
Compare and update value
Instruction width selection
label
R0, R1
MI
R0, R1, #0
R0, R1
GT
R2, R3
R4, R5
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,
you can force a specific instruction size by using an instruction width suffix. The .W suffix forces
a 32-bit instruction encoding. The .N suffix forces a 16-bit instruction encoding.
If you specify an instruction width suffix and the assembler cannot generate an instruction
encoding of the requested width, it generates an error.
In some cases it might be necessary to specify the .W suffix, for example if the operand is the
label of an instruction or literal data, as in the case of branch instructions. This is because the
assembler might not automatically generate the right size encoding.
; creates a 32-bit instruction even for a short branch
; operation can be done by a 16-bit instruction
; Compare R0 and R1, setting flags
; IT instruction for the two GT conditions
; If 'greater than', compare R2 and R3, setting flags
; If still 'greater than', do R4 = R5
; R0 = R1, setting flags
; IT instruction for the negative condition
; If negative, R0 = -R1
11057A–ATARM–17-Feb-12
11057A–ATARM–17-Feb-12

Related parts for SAM3X8E