Smul And Smulw - ST STM32F4 Series Programming Manual

Cortex-m4
Hide thumbs Also See for STM32F4 Series:
Table of Contents

Advertisement

PM0214
SMUSD
SMUSDX
3.6.10

SMUL and SMULW

Signed Multiply (halfwords) and Signed Multiply (word by halfword)
Syntax
op{XY}{cond} Rd, Rn, Rm
op{Y}{cond} Rd. Rn, Rm
op is one of:
SMUL{XY} Signed multiply (halfwords). X and Y specify which halfword of the source
registers Rn and Rm is used as the first and second multiply operand.
SMULW{Y} Signed multiply (word by halfword). Y specifies which halfword of the
source Rm register is used as the second multiply operand.
'cond' is an optional condition code (see
'Rd' is the destination register.
'Rn', 'Rm' are registers holding the first and second operands
Operation
The SMULBB, SMULTB, SMULBT and SMULTT instructions interprets the values from Rn
and Rm as four signed 16-bit integers. These instructions:
1.
Multiply the specified signed halfword, top or bottom, values from Rn and Rm.
2.
Write the 32-bit result of the multiplication in Rd.
The SMULWT and SMULWB instructions interprets the values from Rn as a 32-bit signed
integer and Rm as two halfword 16-bit signed integers. These instructions:
1.
Multiply the first operand and the top, T suffix, or the bottom, B suffix, halfword of the
second operand.
2.
Write the 32 signed most significant bits of the 48-bit result in the destination register.
Restrictions
Do not use either SP or PC.
Examples
SMULBT
R3, R6, R2 ; Multiplies bottom halfword of R4 with bottom halfword
; of R6, subtracts multiplication of top halfword of R6
; with top halfword of R3, writes to R3
R4, R5, R3 ; Multiplies bottom halfword of R5 with top halfword of
; R3, subtracts multiplication of top halfword of R5
; with bottom halfword of R3, writes to R4.
If X is B, then the bottom halfword, bits [15:0] of Rn is used.
If X is T, then the top halfword, bits [31:16] of Rn is used.
If Y is B, then the bottom halfword, bits [15:0], of Rm is used.
If Y is T, then the top halfword, bits [31:16], of Rm is used.
If Y is B, then the bottom halfword (bits [15:0]) of Rm is used.
If Y is T, then the top halfword (bits [31:16]) of Rm is used.
R0, R4, R5 ; Multiplies the bottom halfword of R4 with the top
; halfword of R5, multiplies results and writes to R0
DocID022708 Rev 6
The STM32 Cortex-M4 instruction set
Conditional execution on page
64)
121/260
259

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F4 Series and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Stm32l4+ seriesStm32f3 series

Table of Contents

Save PDF