- Jul 23, 2006
- 3,934
- 0
- 76
wouldn't it be something like
imull sourcea, sourceb, dest ?
I mean, your options are
register, imm, dest
or
imm, register, dest.
Yea... I mean I can figure each instance out pretty quickly through trial and error, but I've had similar questions rather frequently so I was seeing if there were any good resources out there I have overlooked.
FWIW, the imm is the first operand from what I've found.
9.13.15 Notes
-------------
There is some trickery concerning the `mul' and `imul' instructions
that deserves mention. The 16-, 32-, 64- and 128-bit expanding
multiplies (base opcode `0xf6'; extension 4 for `mul' and 5 for `imul')
can be output only in the one operand form. Thus, `imul %ebx, %eax'
does _not_ select the expanding multiply; the expanding multiply would
clobber the `%edx' register, and this would confuse `gcc' output. Use
`imul %ebx' to get the 64-bit product in `%edx:%eax'.
We have added a two operand form of `imul' when the first operand is
an immediate mode expression and the second operand is a register.
This is just a shorthand, so that, multiplying `%eax' by 69, for
example, can be done with `imul $69, %eax' rather than `imul $69, %eax,
%eax'.
The info manual for "as" has a pretty large section on i386-specific syntax and features. Here is an interesting section.
Format: imul src
imul dest,src
imul dest,src,constant
Description: This instruction performs signed multiplication. The number of operands for imul can be between 1 and 3, depending on the format used.
In the one-operand format, the other operand is assumed to be in the AL, AX, or EAX register depending on whether the s r c operand is 8, 16, or 32
bits long, respectively. The s r c operand can be either in a register or in
memory. The result, which is twice as long as the s r c operand, is placed
in AX, DX:AX, or EDX:EAX for 8-, 16-, or 32-bit s r c operands, respec-
tively. In the other two forms, the result is of the same length as the input
operands.
The two-operand format specifies both operands required for multiplica-
tion. In this case, s r c and d e s t must both be either 16-bit or 32-bit
operands. While s r c can be either in a register or in memory, d e s t must
be a register.
In the three-operand format, a constant can be specified as an immediate
operand. The result ( s r c x c o n s t a n t ) is stored in d e s t . As in the
two-operand format, the d e s t operand must be a register. The s r c can
be either in a register or in memory. The immediate constant can be an 8-,
16-, or 32-bit value. For additional restrictions, refer to the Pentium data
book. Clock cycles: 10(11 if the one-operand format is used with either
8- or 16-bit operands).
From the book on AS for linux I got for writing some drivers
http://www.amazon.com/gp/product/038...HRAN7Q7NY31V01