You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
14 KiB
HTML

<html lang="en">
<head>
<title>i386-Arch - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.13">
<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_002d16bit.html#i386_002d16bit" title="i386-16bit">
<link rel="next" href="i386_002dBugs.html#i386_002dBugs" title="i386-Bugs">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991-2015 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/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">
<a name="i386-Arch"></a>
<a name="i386_002dArch"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="i386_002dBugs.html#i386_002dBugs">i386-Bugs</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="i386_002d16bit.html#i386_002d16bit">i386-16bit</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="i386_002dDependent.html#i386_002dDependent">i386-Dependent</a>
<hr>
</div>
<h4 class="subsection">9.15.15 Specifying CPU Architecture</h4>
<p><a name="index-arch-directive_002c-i386-1155"></a><a name="index-i386-arch-directive-1156"></a><a name="index-arch-directive_002c-x86_002d64-1157"></a><a name="index-x86_002d64-arch-directive-1158"></a>
<code>as</code> may be told to assemble for a particular CPU
(sub-)architecture with the <code>.arch </code><var>cpu_type</var> directive. This
directive enables a warning when gas detects an instruction that is not
supported on the CPU specified. The choices for <var>cpu_type</var> are:
<p><table summary=""><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">i8086</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">i186</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">i286</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">i386</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">i486</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">i586</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">i686</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">pentium</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">pentiumpro</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">pentiumii</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">pentiumiii</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">pentium4</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">prescott</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">nocona</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">core</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">core2</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">corei7</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">l1om</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">k1om</span></samp>&rsquo; &lsquo;<samp><span class="samp">iamcu</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">k6</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">k6_2</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">athlon</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">k8</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">amdfam10</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">bdver1</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">bdver2</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">bdver3</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">bdver4</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">znver1</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">btver1</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">btver2</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">generic32</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">generic64</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.mmx</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.sse</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.sse2</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.sse3</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.ssse3</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.sse4.1</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.sse4.2</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.sse4</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.vmx</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.smx</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.ept</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.clflush</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.movbe</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.xsave</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.xsaveopt</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.aes</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.pclmul</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.fma</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.fsgsbase</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.rdrnd</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.f16c</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx2</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.bmi2</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.lzcnt</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.invpcid</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.vmfunc</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.hle</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.rtm</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.adx</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.rdseed</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.prfchw</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.smap</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.mpx</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.sha</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.prefetchwt1</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.clflushopt</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.xsavec</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.xsaves</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.se1</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx512f</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx512cd</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx512er</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx512pf</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx512vl</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx512bw</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx512dq</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx512ifma</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.avx512vbmi</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.clwb</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.pcommit</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.3dnow</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.3dnowa</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.sse4a</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.sse5</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.syscall</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.rdtscp</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.svme</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.abm</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.lwp</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.fma4</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.xop</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.cx16</span></samp>&rsquo;
<br></td></tr><tr align="left"><td valign="top" width="20%">&lsquo;<samp><span class="samp">.padlock</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.clzero</span></samp>&rsquo; </td><td valign="top" width="20%">&lsquo;<samp><span class="samp">.mwaitx</span></samp>&rsquo;
<br></td></tr></table>
<p>Apart from the warning, there are only two other effects on
<code>as</code> operation; Firstly, if you specify a CPU other than
&lsquo;<samp><span class="samp">i486</span></samp>&rsquo;, then shift by one instructions such as &lsquo;<samp><span class="samp">sarl $1, %eax</span></samp>&rsquo;
will automatically use a two byte opcode sequence. The larger three
byte opcode sequence is used on the 486 (and when no architecture is
specified) because it executes faster on the 486. Note that you can
explicitly request the two byte opcode by writing &lsquo;<samp><span class="samp">sarl %eax</span></samp>&rsquo;.
Secondly, if you specify &lsquo;<samp><span class="samp">i8086</span></samp>&rsquo;, &lsquo;<samp><span class="samp">i186</span></samp>&rsquo;, or &lsquo;<samp><span class="samp">i286</span></samp>&rsquo;,
<em>and</em> &lsquo;<samp><span class="samp">.code16</span></samp>&rsquo; or &lsquo;<samp><span class="samp">.code16gcc</span></samp>&rsquo; then byte offset
conditional jumps will be promoted when necessary to a two instruction
sequence consisting of a conditional jump of the opposite sense around
an unconditional jump to the target.
<p>Following the CPU architecture (but not a sub-architecture, which are those
starting with a dot), you may specify &lsquo;<samp><span class="samp">jumps</span></samp>&rsquo; or &lsquo;<samp><span class="samp">nojumps</span></samp>&rsquo; to
control automatic promotion of conditional jumps. &lsquo;<samp><span class="samp">jumps</span></samp>&rsquo; is the
default, and enables jump promotion; All external jumps will be of the long
variety, and file-local jumps will be promoted as necessary.
(see <a href="i386_002dJumps.html#i386_002dJumps">i386-Jumps</a>) &lsquo;<samp><span class="samp">nojumps</span></samp>&rsquo; leaves external conditional jumps as
byte offset jumps, and warns about file-local conditional jumps that
<code>as</code> promotes.
Unconditional jumps are treated as for &lsquo;<samp><span class="samp">jumps</span></samp>&rsquo;.
<p>For example
<pre class="smallexample"> .arch i8086,nojumps
</pre>
</body></html>