<html lang="en">
<head>
<title>i386-Mnemonics - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="i386_002dDependent.html#i386_002dDependent" title="i386-Dependent">
<link rel="prev" href="i386_002dSyntax.html#i386_002dSyntax" title="i386-Syntax">
<link rel="next" href="i386_002dRegs.html#i386_002dRegs" title="i386-Regs">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
@import url("../raisonance.css");
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<p>
<a name="i386-Mnemonics"></a>
<a name="i386_002dMnemonics"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="i386_002dRegs.html#i386_002dRegs">i386-Regs</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="i386_002dSyntax.html#i386_002dSyntax">i386-Syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="i386_002dDependent.html#i386_002dDependent">i386-Dependent</a>
<hr>
</div>

<h4 class="subsection">8.11.3 Instruction Naming</h4>

<p><a name="index-i386-instruction-naming-835"></a><a name="index-instruction-naming_002c-i386-836"></a><a name="index-x86_002d64-instruction-naming-837"></a><a name="index-instruction-naming_002c-x86_002d64-838"></a>
Instruction mnemonics are suffixed with one character modifiers which
specify the size of operands.  The letters `<samp><span class="samp">b</span></samp>', `<samp><span class="samp">w</span></samp>', `<samp><span class="samp">l</span></samp>'
and `<samp><span class="samp">q</span></samp>' 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, `<samp><span class="samp">mov %ax, %bx</span></samp>' is equivalent
to `<samp><span class="samp">movw %ax, %bx</span></samp>'; also, `<samp><span class="samp">mov $1, %bx</span></samp>' is equivalent to
`<samp><span class="samp">movw $1, bx</span></samp>'.  Note that this is incompatible with the AT&amp;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&amp;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&amp;T
syntax.  Base names for sign extend and zero extend are
`<samp><span class="samp">movs...</span></samp>' and `<samp><span class="samp">movz...</span></samp>' in AT&amp;T syntax (`<samp><span class="samp">movsx</span></samp>'
and `<samp><span class="samp">movzx</span></samp>' 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, `<samp><span class="samp">movsbl %al, %edx</span></samp>' is AT&amp;T syntax for
&ldquo;move sign extend <em>from</em> %al <em>to</em> %edx.&rdquo;  Possible suffixes,
thus, are `<samp><span class="samp">bl</span></samp>' (from byte to long), `<samp><span class="samp">bw</span></samp>' (from byte to word),
`<samp><span class="samp">wl</span></samp>' (from word to long), `<samp><span class="samp">bq</span></samp>' (from byte to quadruple word),
`<samp><span class="samp">wq</span></samp>' (from word to quadruple word), and `<samp><span class="samp">lq</span></samp>' (from long to
quadruple word).

   <p><a name="index-conversion-instructions_002c-i386-839"></a><a name="index-i386-conversion-instructions-840"></a><a name="index-conversion-instructions_002c-x86_002d64-841"></a><a name="index-x86_002d64-conversion-instructions-842"></a>The Intel-syntax conversion instructions

     <ul>
<li>`<samp><span class="samp">cbw</span></samp>' &mdash; sign-extend byte in `<samp><span class="samp">%al</span></samp>' to word in `<samp><span class="samp">%ax</span></samp>',

     <li>`<samp><span class="samp">cwde</span></samp>' &mdash; sign-extend word in `<samp><span class="samp">%ax</span></samp>' to long in `<samp><span class="samp">%eax</span></samp>',

     <li>`<samp><span class="samp">cwd</span></samp>' &mdash; sign-extend word in `<samp><span class="samp">%ax</span></samp>' to long in `<samp><span class="samp">%dx:%ax</span></samp>',

     <li>`<samp><span class="samp">cdq</span></samp>' &mdash; sign-extend dword in `<samp><span class="samp">%eax</span></samp>' to quad in `<samp><span class="samp">%edx:%eax</span></samp>',

     <li>`<samp><span class="samp">cdqe</span></samp>' &mdash; sign-extend dword in `<samp><span class="samp">%eax</span></samp>' to quad in `<samp><span class="samp">%rax</span></samp>'
(x86-64 only),

     <li>`<samp><span class="samp">cqo</span></samp>' &mdash; sign-extend quad in `<samp><span class="samp">%rax</span></samp>' to octuple in
`<samp><span class="samp">%rdx:%rax</span></samp>' (x86-64 only),
</ul>

<p class="noindent">are called `<samp><span class="samp">cbtw</span></samp>', `<samp><span class="samp">cwtl</span></samp>', `<samp><span class="samp">cwtd</span></samp>', `<samp><span class="samp">cltd</span></samp>', `<samp><span class="samp">cltq</span></samp>', and
`<samp><span class="samp">cqto</span></samp>' in AT&amp;T naming.  <code>as</code> accepts either naming for these
instructions.

   <p><a name="index-jump-instructions_002c-i386-843"></a><a name="index-call-instructions_002c-i386-844"></a><a name="index-jump-instructions_002c-x86_002d64-845"></a><a name="index-call-instructions_002c-x86_002d64-846"></a>Far call/jump instructions are `<samp><span class="samp">lcall</span></samp>' and `<samp><span class="samp">ljmp</span></samp>' in
AT&amp;T syntax, but are `<samp><span class="samp">call far</span></samp>' and `<samp><span class="samp">jump far</span></samp>' in Intel
convention.

   </body></html>

