imul

8086 and later

Signed Multiply

imul r/m8 | imul r/m16 | imul r/m32 | imul r/m64 | imul reg16, r/m16 | imul reg32, r/m32 | imul reg64, r/m64 | imul reg16, r/m16, imm8 | imul reg32, r/m32, imm8 | imul reg64, r/m64, imm8 | imul reg16, r/m16, imm16 | imul reg32, r/m32, imm32 | imul reg64, r/m64, imm32 | imul [reg16], reg16, r/m16 | imul [reg32], reg32, r/m32 | imul [reg64], reg64, r/m64

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. In these cases, the BYTE qualifier is necessary to force NASM to generate this form of the instruction.

Unsigned integer multiplication is performed by the MUL instruction: see MUL.

Loading...

Forms

Every form of imul the assembler accepts, from NASM's own instruction table. The second column is the processor that introduced the form; a badge marks a form that needs an extension, that is lockable, or that long mode dropped.

FormSinceNotes
imul r/m88086long
imul r/m168086long
imul r/m32386long
imul r/m64x86-64long
imul reg16, r/m16386
imul reg32, r/m32386
imul reg64, r/m64x86-64long
imul reg16, r/m16, imm8186long
imul reg32, r/m32, imm8386long
imul reg64, r/m64, imm8x86-64long
imul reg16, r/m16, imm16186long
imul reg32, r/m32, imm32386long
imul reg64, r/m64, imm32x86-64long
imul [reg16], reg16, r/m16x86-64apxlong
imul [reg32], reg32, r/m32x86-64apxlong
imul [reg64], reg64, r/m64x86-64apxlong