| |||
| Home > The Cortex-M4 Instruction Set > Multiply and divide instructions > SMLAL and SMLALD | |||
Signed Multiply Accumulate Long, Signed Multiply Accumulate Long (halfwords) and Signed Multiply Accumulate Long Dual.
op{cond}RdLo,RdHi,Rn,Rm
op{XY}{cond}RdLo,RdHi,Rn,Rm
op{X}{cond}RdLo,RdHi,Rn,Rm
where:
opIs one of:
, SMLALSigned Multiply Accumulate Long
SMLALSigned Multiply Accumulate Long (halfwords, X and Y)
X
and Y specify which halfword of the source registers and Rn are
used as the first and second multiply operand:Rm
If is XB,
then the bottom halfword, bits [15:0], of is
used. If Rn is XT,
then the top halfword, bits [31:16], of is
used.Rn
If is YB,
then the bottom halfword, bits [15:0], of is
used. If Rm is YT,
then the top halfword, bits [31:16], of is
used.Rm
SMLALDSigned Multiply Accumulate Long Dual
SMLALDXSigned Multiply Accumulate Long Dual Reversed
If the is
omitted, the multiplications are bottom × bottom and top × top.X
If is present,
the multiplications are bottom × top and top × bottom.X
condIs an optional condition code, see Conditional execution.
RdHi, RdLoAre the destination registers. is
the lower 32 bits and RdLo is
the upper 32 bits of the 64-bit integer. For RdHiSMLAL, SMLALBB, SMLALBT, SMLALTB, SMLALTT, SMLALD and SMLALDX, they
also hold the accumulating value.
Rn, RmAre registers holding the first and second operands.
The SMLAL instruction:
Multiplies the
two’s complement signed word values from and Rn.Rm
Adds the 64-bit value in and RdLo to
the resulting 64-bit product.RdHi
Writes the 64-bit result of the multiplication and
addition in RdLo and .RdHi
The SMLALBB, SMLALBT, SMLALTB and SMLALTT instructions:
Multiplies the specified
signed halfword, Top or Bottom, values from and Rn.Rm
Adds the resulting sign-extended 32-bit product
to the 64-bit value in and RdLo .RdHi
Writes the 64-bit result of the multiplication and
addition in and RdLo .RdHi
The non-specified halfwords of the source registers are ignored.
The SMLALD and SMLALDX instructions
interpret the values from and Rn as
four halfword two’s complement signed 16-bit integers. These instructions:Rm
if is
not present, multiply the top signed halfword value of X with
the top signed halfword of Rn and
the bottom signed halfword values of Rm with
the bottom signed halfword of Rn.Rm
Or if is
present, multiply the top signed halfword value of X with
the bottom signed halfword of Rn and
the bottom signed halfword values of Rm with
the top signed halfword of Rn.Rm
Add the two multiplication results to the signed
64-bit value in and RdLo to
create the resulting 64-bit product.RdHi
Write the 64-bit product in and RdLo.RdHi
In these instructions:
do not use SP and do not use PC.
and RdHi must
be different registers.RdLo
SMLAL R4, R5, R3, R8 ; Multiplies R3 and R8, adds R5:R4 and writes to
; R5:R4
SMLALBT R2, R1, R6, R7 ; Multiplies bottom halfword of R6 with top
; halfword of R7, sign extends to 32-bit, adds
; R1:R2 and writes to R1:R2
SMLALTB R2, R1, R6, R7 ; Multiplies top halfword of R6 with bottom
; halfword of R7, sign extends to 32-bit, adds R1:R2
; and writes to R1:R2
SMLALD R6, R8, R5, R1 ; Multiplies top halfwords in R5 and R1 and bottom
; halfwords of R5 and R1, adds R8:R6 and writes to
; R8:R6
SMLALDX R6, R8, R5, R1 ; Multiplies top halfword in R5 with bottom
; halfword of R1, and bottom halfword of R5 with
; top halfword of R1, adds R8:R6 and writes to
; R8:R6.