Discussion:
3 operands -- What order for AT&T syntax?
(too old to reply)
b***@yahoo.com
2005-07-28 06:14:03 UTC
Permalink
I have a three operand IMUL. How do I order these in AT&T syntax?

Is it:

IMUL operand 3, operand 2, operand 1

?
T.M. Sommers
2005-07-28 07:25:25 UTC
Permalink
Post by b***@yahoo.com
I have a three operand IMUL. How do I order these in AT&T syntax?
IMUL operand 3, operand 2, operand 1
?
Yes.

imul $2, %ebx, %eax

assembles as

6b c3 02 imul $0x2,%ebx,%eax

and multiplies %ebx by 2 and store the result in %eax.
--
Thomas M. Sommers -- ***@nj.net -- AB2SB
Evenbit
2005-07-28 13:31:30 UTC
Permalink
Post by b***@yahoo.com
I have a three operand IMUL. How do I order these in AT&T syntax?
IMUL operand 3, operand 2, operand 1
?
Now remember, this is ASSEMBLY -- we like to start our counting at
zero. Like so:

IMUL operand 2, operand 1, operand 0

But this reveals that you REALLY only have 2 operands {we've just
counted them}. Since this fact won't be easily understood by others,
we have to borrow some 'fancy footwork' from academia to do a little
deception to cover our tracks [notice that this also allows counting
from left to right, which also might be easier on the others]:

N equ 3
IMUL operand N-0, operand N-1, operand N-2

Nathan.
r***@earthlink.net
2005-07-28 14:07:10 UTC
Permalink
Post by b***@yahoo.com
I have a three operand IMUL. How do I order these in AT&T syntax?
IMUL operand 3, operand 2, operand 1
?
Well, the numbers don't mean much, but it is

imul{w,l} immConst, src, dest

Cheers,
Randy Hyde

Loading...