📄 i386-mnemonics.html
字号:
<html lang="en">
<head>
<title>Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.3">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
</head>
<body>
<div class="node">
<p>
Node:<a name="i386-Mnemonics">i386-Mnemonics</a>,
Next:<a rel="next" accesskey="n" href="i386-Regs.html#i386-Regs">i386-Regs</a>,
Previous:<a rel="previous" accesskey="p" href="i386-Syntax.html#i386-Syntax">i386-Syntax</a>,
Up:<a rel="up" accesskey="u" href="i386-Dependent.html#i386-Dependent">i386-Dependent</a>
<hr><br>
</div>
<h4 class="section">Instruction Naming</h4>
<p>Instruction mnemonics are suffixed with one character modifiers which
specify the size of operands. The letters <code>b</code>, <code>w</code>, <code>l</code>
and <code>q</code> specify byte, word, long and quadruple word operands. If
no suffix is specified by an instruction then <code>as</code> tries to
fill in the missing suffix based on the destination register operand
(the last one by convention). Thus, <code>mov %ax, %bx</code> is equivalent
to <code>movw %ax, %bx</code>; also, <code>mov $1, %bx</code> is equivalent to
<code>movw $1, bx</code>. 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.)
<p>Almost all instructions have the same names in AT&T and Intel format.
There are a few exceptions. The sign extend and zero extend
instructions need two sizes to specify them. They need a size to
sign/zero extend <em>from</em> and a size to zero extend <em>to</em>. This
is accomplished by using two instruction mnemonic suffixes in AT&T
syntax. Base names for sign extend and zero extend are
<code>movs...</code> and <code>movz...</code> in AT&T syntax (<code>movsx</code>
and <code>movzx</code> in Intel syntax). The instruction mnemonic suffixes
are tacked on to this base name, the <em>from</em> suffix before the
<em>to</em> suffix. Thus, <code>movsbl %al, %edx</code> is AT&T syntax for
"move sign extend <em>from</em> %al <em>to</em> %edx." Possible suffixes,
thus, are <code>bl</code> (from byte to long), <code>bw</code> (from byte to word),
<code>wl</code> (from word to long), <code>bq</code> (from byte to quadruple word),
<code>wq</code> (from word to quadruple word), and <code>lq</code> (from long to
quadruple word).
<p>The Intel-syntax conversion instructions
<ul>
<li><code>cbw</code> -- sign-extend byte in <code>%al</code> to word in <code>%ax</code>,
<li><code>cwde</code> -- sign-extend word in <code>%ax</code> to long in <code>%eax</code>,
<li><code>cwd</code> -- sign-extend word in <code>%ax</code> to long in <code>%dx:%ax</code>,
<li><code>cdq</code> -- sign-extend dword in <code>%eax</code> to quad in <code>%edx:%eax</code>,
<li><code>cdqe</code> -- sign-extend dword in <code>%eax</code> to quad in <code>%rax</code>
(x86-64 only),
<li><code>cdo</code> -- sign-extend quad in <code>%rax</code> to octuple in
<code>%rdx:%rax</code> (x86-64 only),
</ul>
<p>are called <code>cbtw</code>, <code>cwtl</code>, <code>cwtd</code>, <code>cltd</code>, <code>cltq</code>, and
<code>cqto</code> in AT&T naming. <code>as</code> accepts either naming for these
instructions.
<p>Far call/jump instructions are <code>lcall</code> and <code>ljmp</code> in
AT&T syntax, but are <code>call far</code> and <code>jump far</code> in Intel
convention.
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -