129
SAM4CP [DATASHEET]
43051E–ATPL–08/14
Examples
SMLABB R5, R6, R4, R1 ; Multiplies bottom halfwords of R6 and R4, adds
; R1 and writes to R5
SMLATB R5, R6, R4, R1 ; Multiplies top halfword of R6 with bottom halfword
; of R4, adds R1 and writes to R5
SMLATT R5, R6, R4, R1 ; Multiplies top halfwords of R6 and R4, adds
; R1 and writes the sum to R5
SMLABT R5, R6, R4, R1 ; Multiplies bottom halfword of R6 with top halfword
; of R4, adds R1 and writes to R5
SMLABT R4, R3, R2 ; Multiplies bottom halfword of R4 with top halfword of
; R3, adds R2 and writes to R4
SMLAWB R10, R2, R5, R3 ; Multiplies R2 with bottom halfword of R5, adds
; R3 to the result and writes top 32-bits to R10
SMLAWT R10, R2, R1, R5 ; Multiplies R2 with top halfword of R1, adds R5
; and writes top 32-bits to R10.
12.6.6.4 SMLAD
Signed Multiply Accumulate Long Dual
Syntax
op{
X
}{
cond
}
Rd
,
Rn
,
Rm
,
Ra
;
where:
op
is one of:
SMLAD Signed Multiply Accumulate Dual.
SMLADX Signed Multiply Accumulate Dual Reverse.
X specifies which halfword of the source register
Rn
is used as the multiply operand.
If
X
is omitted, the multiplications are bottom × bottom and top × top.
If
X
is present, the multiplications are bottom × top and top × bottom.
cond
is an optional condition code, see
“Conditional Execution”
.
Rd
is the destination register.
Rn
is the first operand register holding the values to be multiplied.
Rm
the second operand register.
Ra
is the accumulate value.
Operation
The SMLAD and SMLADX instructions regard the two operands as four halfword 16-bit values. The SMLAD and
SMLADX instructions:
If
X
is not present, multiply the top signed halfword value in
Rn
with the top signed halfword of
Rm
and the bottom
signed halfword values in
Rn
with the bottom signed halfword of
Rm
.
Or if
X
is present, multiply the top signed halfword value in
Rn
with the bottom signed halfword of
Rm
and the
bottom signed halfword values in
Rn
with the top signed halfword of
Rm
.
Add both multiplication results to the signed 32-bit value in
Ra
.
Writes the 32-bit signed result of the multiplication and addition to
Rd
.
Restrictions
Do not use SP and do not use PC
.
Condition Flags
These instructions do not change the flags.