Extensions
Forms
1 (1 Legacy)
Data
Intel XED v2026.08.23

AAM divides AL by a base, 10 unless its immediate byte says otherwise, and puts the quotient in AH and the remainder in AL. After a MUL of two unpacked BCD digits, whose product is at most 81, that splits the product into its two decimal digits: 7 times 9 leaves 3Fh, and AAM gives AX = 0603h. It reads only AL, so it splits any byte below 100 into two digits, and a larger one into a quotient of up to 25 and a digit. SF, ZF and PF follow the new AL; OF, AF and CF are undefined, so nothing reports a quotient too large for one digit.

Any base

The base is the second byte of the instruction, D4 0A for plain AAM. Intel’s and AMD’s manuals give octal and base 12 as examples and say that other bases are coded by hand; GNU as 2.44 and Clang 23 also take it as an operand, aam $16 in AT&T syntax, which splits AL into its two hexadecimal digits. A base of 0 raises #DE, as a DIV by zero does. AAD is the inverse, joining two digits before a division, and AAA the adjustment after an addition.

Not in 64-bit mode

Opcode D4 raises #UD in 64-bit mode, so the fixture has no case for AAM: the probe runs there and lists the form as not run. GNU as 2.44 and Clang 23 refuse aam in 64-bit code, and GCC 14 and Clang 23 have no intrinsic for it. In our builds with -m32, a function returning x / 10 in AH and x % 10 in AL compiles at -Os in GCC 14 to a DIV of AX by DL and an XCHG of AL and AH, and in Clang 23 to multiplications by constants, neither using AAM. AMD’s Zen 5 guide lists AAM as microcoded, without a latency.

Forms

Every encoding of AAM that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
AAM imm8 not in 64-bit mode AAM_IMMbD4 ibBase instruction set

Operation

What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.

b = base.read()                  # 10 in plain AAM
if b == 0:
    fault(DE)
a = al
r = a % b
ah = a // b
al = r
sf = r >> 7 & 1
zf = r == 0
pf = parity(r)
of = af = cf = UNDEFINED

Not run on a processor: the instruction does not exist in 64-bit mode, where the probe runs.

Operands

What each form reads and writes, as Intel XED records it: the operands of its syntax, in order, and the implicit ones that the syntax does not name. How to read.
OperandKindAction
AAM imm8 not in 64-bit mode
imm8explicitread
ALimplicitread, write
AHimplicitwrite
RFLAGSimplicitwrite

Flags

M modified, U undefined; blank: not affected. How to read.
OFSFZFAFPFCF
All forms
UMMUMU

CPUID and processors

Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.

CPUID requirements and processors of the XED ISA sets above. Alternatives are separated by “or”; processors follow XED’s chip model, whose AMD processors end with Zen 2, and the CPU data of this site for Zen 3 to Zen 6.
ISA setCPUIDProcessors
I86

No CPUID bit: part of the base instruction set.

Every x86-64 processor in XED’s model and Zen 3 to Zen 6

More General-purpose instructions

All 109 General-purpose instructions

Sources

  1. Intel XED v2026.08.23 (commit 0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model.
  2. The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s -march feature sets and AMD’s Processor Programming References, which the page of each processor cites.
  3. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2A, page 3-5 (AAM)
  4. AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.39, October 2026)
  5. Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP

The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The text is our own.