A.5.118 IMUL: Signed Integer Multiply
IMUL r/m8 ; F6 /5 [8086]
IMUL r/m16 ; o16 F7 /5 [8086]
IMUL r/m32 ; o32 F7 /5 [386]
IMUL reg16,r/m16 ; o16 0F AF /r [386]
IMUL reg32,r/m32 ; o32 0F AF /r [386]
IMUL reg16,imm8 ; o16 6B /r ib [186]
IMUL reg16,imm16 ; o16 69 /r iw [186]
IMUL reg32,imm8 ; o32 6B /r ib [386]
IMUL reg32,imm32 ; o32 69 /r id [386]
IMUL reg16,r/m16,imm8 ; o16 6B /r ib [186]
IMUL reg16,r/m16,imm16 ; o16 69 /r iw [186]
IMUL reg32,r/m32,imm8 ; o32 6B /r ib [386]
IMUL reg32,r/m32,imm32 ; o32 69 /r id [386]
IMUL performs signed integer multiplication. For the single-operand
form, the other operand and destination are implicit, in the following
way:
- For IMUL r/m8, AL is multiplied by the given operand; the product is
stored in AX.
- For IMUL r/m16, AX is multiplied by the given operand; the product
is stored in DX:AX.
- For IMUL r/m32, EAX is multiplied by the given operand; the product
is stored in EDX:EAX.
The two-operand form multiplies its two operands and stores the result
in the destination (first) operand. The three-operand form multiplies
its last two operands and stores the result in the first operand.
The two-operand form with an immediate second operand is in fact a
shorthand for the three-operand form, as can be seen by examining the
opcode descriptions: in the two-operand form, the code "/r" takes both
its register and "r/m" parts from the same operand (the first one).
In the forms with an 8-bit immediate operand and another longer
source operand, the immediate operand is considered to be signed,
and is sign-extended to the length of the other source operand. The
BYTE qualifier can be used to force NASM to generate this form of the
instruction. Recent versions of NASM automatically optimise to this
form if the immediate operand's value is known during the assembling of
that instruction, and fits in the range of a signed byte. The longer
variant can then still be forced using the STRICT WORD or STRICT DWORD
qualifier.
Unsigned integer multiplication is performed by the MUL instruction: see
section A.5.184.