flat assembler
Message board for the users of flat assembler.

Index > Main > Inconsistent assembly documentation on the example of IMUL 2

Author
Thread Post new topic Reply to topic
anotherone



Joined: 18 Jun 2026
Posts: 2
anotherone 11 Jul 2026, 12:13
The Intel Architectures Software Developers Manual Volume 1 states in chapter 3.7.1: "All arithmetic instructions (except the DIV and IDIV instructions) allow the source operand to be an immediate value." That seems to be wrong at least in the MUL case?

In volumes 2 the table in the IMUL description does not show a 2 operand version with immediate, but the text states that this is possible.

https://www.felixcloutier.com/x86/ is just an old copy of the Intel manuals and in no way different.

In the AMD64 Architecture Programmers Manual also the text states the existence, but the mnemonic list doesn't show it.

So much for official documentations.

FASM2 accepts something like 'mul rax,2'

The book "The Art of 64-Bit Assembly Language" states in chapter 4.1 that the IMUL 2 operand version with immediate exists but the main description of the instruction is in another chapter and not mentioning this.

In the book "Assembly Language for x86 Processors 8th" this variant is described for 32-bit mode, but not for 64-bit.

At http://ref.x86asm.net/coder64-abc.html#I I can't find mentioning of a IMUL 2 operand version with immediate.

Does somewhere exist a single, reliable source of x86-64 instruction documentation that is complete, correct and not pulled apart?
Post 11 Jul 2026, 12:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 21000
Location: In your JS exploiting you and your system
revolution 11 Jul 2026, 12:37
Code:
~ cat test.asm 
use64
imul rax,2
imul rax,rax,2

~ fasm test.asm 
flat assembler  version 1.73.31  (16384 kilobytes memory)
1 passes, 8 bytes.

~ ndisasm -b 64 test.bin 
00000000  486BC002          imul rax,rax,byte +0x2
00000004  486BC002          imul rax,rax,byte +0x2
    
The two operand version is just the three operand version in disguise.
Post 11 Jul 2026, 12:37
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.