Next: i386-Regs, Previous: i386-Syntax, Up: i386-Dependent [Contents][Index]
Instruction mnemonics are suffixed with one character modifiers which
specify the size of operands. The letters ‘b’, ‘w’, ‘l’
and ‘q’ specify byte, word, long and quadruple word operands. If
no suffix is specified by an instruction then as
tries to
fill in the missing suffix based on the destination register operand
(the last one by convention). Thus, ‘mov %ax, %bx’ is equivalent
to ‘movw %ax, %bx’; also, ‘mov $1, %bx’ is equivalent to
‘movw $1, bx’. Note that this is incompatible with the AT&T Unix
assembler which assumes that a missing mnemonic suffix implies long
operand size. (This incompatibility does not affect compiler output
since compilers always explicitly specify the mnemonic suffix.)
When there is no sizing suffix and no (suitable) register operands to deduce the size of memory operands, with a few exceptions and where long operand size is possible in the first place, operand size will default to long in 32- and 64-bit modes. Similarly it will default to short in 16-bit mode. Noteworthy exceptions are
Different encoding options can be specified via pseudo prefixes:
The Intel-syntax conversion instructions
are called ‘cbtw’, ‘cwtl’, ‘cwtd’, ‘cltd’, ‘cltq’, and
‘cqto’ in AT&T naming. as
accepts either naming for these
instructions.
The Intel-syntax extension instructions
are called ‘movsbw/movsxb/movsx’, ‘movsbl/movsxb/movsx’, ‘movsbq/movsb/movsx’, ‘movswl/movsxw’, ‘movswq/movsxw’, ‘movslq/movsxl’, ‘movzbw/movzxb/movzx’, ‘movzbl/movzxb/movzx’, ‘movzbq/movzxb/movzx’, ‘movzwl/movzxw’ and ‘movzwq/movzxw’ in AT&T syntax.
Far call/jump instructions are ‘lcall’ and ‘ljmp’ in AT&T syntax, but are ‘call far’ and ‘jump far’ in Intel convention.
as
supports assembly using Intel mnemonic.
.intel_mnemonic
selects Intel mnemonic with Intel syntax, and
.att_mnemonic
switches back to the usual AT&T mnemonic with AT&T
syntax for compatibility with the output of gcc
.
Several x87 instructions, ‘fadd’, ‘fdiv’, ‘fdivp’,
‘fdivr’, ‘fdivrp’, ‘fmul’, ‘fsub’, ‘fsubp’,
‘fsubr’ and ‘fsubrp’, are implemented in AT&T System V/386
assembler with different mnemonics from those in Intel IA32 specification.
gcc
generates those instructions with AT&T mnemonic.
Next: i386-Regs, Previous: i386-Syntax, Up: i386-Dependent [Contents][Index]