i386_002dArch.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2017 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>Using as: i386-Arch</title>
  15. <meta name="description" content="Using as: i386-Arch">
  16. <meta name="keywords" content="Using as: i386-Arch">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="i386_002dDependent.html#i386_002dDependent" rel="up" title="i386-Dependent">
  25. <link href="i386_002dBugs.html#i386_002dBugs" rel="next" title="i386-Bugs">
  26. <link href="i386_002d16bit.html#i386_002d16bit" rel="prev" title="i386-16bit">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.smallquotation {font-size: smaller}
  31. div.display {margin-left: 3.2em}
  32. div.example {margin-left: 3.2em}
  33. div.indentedblock {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style:oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nocodebreak {white-space:nowrap}
  49. span.nolinebreak {white-space:nowrap}
  50. span.roman {font-family:serif; font-weight:normal}
  51. span.sansserif {font-family:sans-serif; font-weight:normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  57. <a name="i386_002dArch"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="i386_002dBugs.html#i386_002dBugs" accesskey="n" rel="next">i386-Bugs</a>, Previous: <a href="i386_002d16bit.html#i386_002d16bit" accesskey="p" rel="prev">i386-16bit</a>, Up: <a href="i386_002dDependent.html#i386_002dDependent" accesskey="u" rel="up">i386-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Specifying-CPU-Architecture"></a>
  64. <h4 class="subsection">9.15.15 Specifying CPU Architecture</h4>
  65. <a name="index-arch-directive_002c-i386"></a>
  66. <a name="index-i386-arch-directive"></a>
  67. <a name="index-arch-directive_002c-x86_002d64"></a>
  68. <a name="index-x86_002d64-arch-directive"></a>
  69. <p><code>as</code> may be told to assemble for a particular CPU
  70. (sub-)architecture with the <code>.arch <var>cpu_type</var></code> directive. This
  71. directive enables a warning when gas detects an instruction that is not
  72. supported on the CPU specified. The choices for <var>cpu_type</var> are:
  73. </p>
  74. <table>
  75. <tr><td width="20%">&lsquo;<samp>i8086</samp>&rsquo;</td><td width="20%">&lsquo;<samp>i186</samp>&rsquo;</td><td width="20%">&lsquo;<samp>i286</samp>&rsquo;</td><td width="20%">&lsquo;<samp>i386</samp>&rsquo;</td></tr>
  76. <tr><td width="20%">&lsquo;<samp>i486</samp>&rsquo;</td><td width="20%">&lsquo;<samp>i586</samp>&rsquo;</td><td width="20%">&lsquo;<samp>i686</samp>&rsquo;</td><td width="20%">&lsquo;<samp>pentium</samp>&rsquo;</td></tr>
  77. <tr><td width="20%">&lsquo;<samp>pentiumpro</samp>&rsquo;</td><td width="20%">&lsquo;<samp>pentiumii</samp>&rsquo;</td><td width="20%">&lsquo;<samp>pentiumiii</samp>&rsquo;</td><td width="20%">&lsquo;<samp>pentium4</samp>&rsquo;</td></tr>
  78. <tr><td width="20%">&lsquo;<samp>prescott</samp>&rsquo;</td><td width="20%">&lsquo;<samp>nocona</samp>&rsquo;</td><td width="20%">&lsquo;<samp>core</samp>&rsquo;</td><td width="20%">&lsquo;<samp>core2</samp>&rsquo;</td></tr>
  79. <tr><td width="20%">&lsquo;<samp>corei7</samp>&rsquo;</td><td width="20%">&lsquo;<samp>l1om</samp>&rsquo;</td><td width="20%">&lsquo;<samp>k1om</samp>&rsquo; &lsquo;<samp>iamcu</samp>&rsquo;</td></tr>
  80. <tr><td width="20%">&lsquo;<samp>k6</samp>&rsquo;</td><td width="20%">&lsquo;<samp>k6_2</samp>&rsquo;</td><td width="20%">&lsquo;<samp>athlon</samp>&rsquo;</td><td width="20%">&lsquo;<samp>k8</samp>&rsquo;</td></tr>
  81. <tr><td width="20%">&lsquo;<samp>amdfam10</samp>&rsquo;</td><td width="20%">&lsquo;<samp>bdver1</samp>&rsquo;</td><td width="20%">&lsquo;<samp>bdver2</samp>&rsquo;</td><td width="20%">&lsquo;<samp>bdver3</samp>&rsquo;</td></tr>
  82. <tr><td width="20%">&lsquo;<samp>bdver4</samp>&rsquo;</td><td width="20%">&lsquo;<samp>znver1</samp>&rsquo;</td><td width="20%">&lsquo;<samp>btver1</samp>&rsquo;</td><td width="20%">&lsquo;<samp>btver2</samp>&rsquo;</td></tr>
  83. <tr><td width="20%">&lsquo;<samp>generic32</samp>&rsquo;</td><td width="20%">&lsquo;<samp>generic64</samp>&rsquo;</td></tr>
  84. <tr><td width="20%">&lsquo;<samp>.mmx</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.sse</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.sse2</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.sse3</samp>&rsquo;</td></tr>
  85. <tr><td width="20%">&lsquo;<samp>.ssse3</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.sse4.1</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.sse4.2</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.sse4</samp>&rsquo;</td></tr>
  86. <tr><td width="20%">&lsquo;<samp>.avx</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.vmx</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.smx</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.ept</samp>&rsquo;</td></tr>
  87. <tr><td width="20%">&lsquo;<samp>.clflush</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.movbe</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.xsave</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.xsaveopt</samp>&rsquo;</td></tr>
  88. <tr><td width="20%">&lsquo;<samp>.aes</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.pclmul</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.fma</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.fsgsbase</samp>&rsquo;</td></tr>
  89. <tr><td width="20%">&lsquo;<samp>.rdrnd</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.f16c</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.avx2</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.bmi2</samp>&rsquo;</td></tr>
  90. <tr><td width="20%">&lsquo;<samp>.lzcnt</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.invpcid</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.vmfunc</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.hle</samp>&rsquo;</td></tr>
  91. <tr><td width="20%">&lsquo;<samp>.rtm</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.adx</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.rdseed</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.prfchw</samp>&rsquo;</td></tr>
  92. <tr><td width="20%">&lsquo;<samp>.smap</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.mpx</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.sha</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.prefetchwt1</samp>&rsquo;</td></tr>
  93. <tr><td width="20%">&lsquo;<samp>.clflushopt</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.xsavec</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.xsaves</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.se1</samp>&rsquo;</td></tr>
  94. <tr><td width="20%">&lsquo;<samp>.avx512f</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.avx512cd</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.avx512er</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.avx512pf</samp>&rsquo;</td></tr>
  95. <tr><td width="20%">&lsquo;<samp>.avx512vl</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.avx512bw</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.avx512dq</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.avx512ifma</samp>&rsquo;</td></tr>
  96. <tr><td width="20%">&lsquo;<samp>.avx512vbmi</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.avx512_4fmaps</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.avx512_4vnniw</samp>&rsquo;</td></tr>
  97. <tr><td width="20%">&lsquo;<samp>.avx512_vpopcntdq</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.clwb</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.rdpid</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.ptwrite</samp>&rsquo;</td></tr>
  98. <tr><td width="20%">&lsquo;<samp>.3dnow</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.3dnowa</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.sse4a</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.sse5</samp>&rsquo;</td></tr>
  99. <tr><td width="20%">&lsquo;<samp>.syscall</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.rdtscp</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.svme</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.abm</samp>&rsquo;</td></tr>
  100. <tr><td width="20%">&lsquo;<samp>.lwp</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.fma4</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.xop</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.cx16</samp>&rsquo;</td></tr>
  101. <tr><td width="20%">&lsquo;<samp>.padlock</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.clzero</samp>&rsquo;</td><td width="20%">&lsquo;<samp>.mwaitx</samp>&rsquo;</td></tr>
  102. </table>
  103. <p>Apart from the warning, there are only two other effects on
  104. <code>as</code> operation; Firstly, if you specify a CPU other than
  105. &lsquo;<samp>i486</samp>&rsquo;, then shift by one instructions such as &lsquo;<samp>sarl $1, %eax</samp>&rsquo;
  106. will automatically use a two byte opcode sequence. The larger three
  107. byte opcode sequence is used on the 486 (and when no architecture is
  108. specified) because it executes faster on the 486. Note that you can
  109. explicitly request the two byte opcode by writing &lsquo;<samp>sarl %eax</samp>&rsquo;.
  110. Secondly, if you specify &lsquo;<samp>i8086</samp>&rsquo;, &lsquo;<samp>i186</samp>&rsquo;, or &lsquo;<samp>i286</samp>&rsquo;,
  111. <em>and</em> &lsquo;<samp>.code16</samp>&rsquo; or &lsquo;<samp>.code16gcc</samp>&rsquo; then byte offset
  112. conditional jumps will be promoted when necessary to a two instruction
  113. sequence consisting of a conditional jump of the opposite sense around
  114. an unconditional jump to the target.
  115. </p>
  116. <p>Following the CPU architecture (but not a sub-architecture, which are those
  117. starting with a dot), you may specify &lsquo;<samp>jumps</samp>&rsquo; or &lsquo;<samp>nojumps</samp>&rsquo; to
  118. control automatic promotion of conditional jumps. &lsquo;<samp>jumps</samp>&rsquo; is the
  119. default, and enables jump promotion; All external jumps will be of the long
  120. variety, and file-local jumps will be promoted as necessary.
  121. (see <a href="i386_002dJumps.html#i386_002dJumps">i386-Jumps</a>) &lsquo;<samp>nojumps</samp>&rsquo; leaves external conditional jumps as
  122. byte offset jumps, and warns about file-local conditional jumps that
  123. <code>as</code> promotes.
  124. Unconditional jumps are treated as for &lsquo;<samp>jumps</samp>&rsquo;.
  125. </p>
  126. <p>For example
  127. </p>
  128. <div class="smallexample">
  129. <pre class="smallexample"> .arch i8086,nojumps
  130. </pre></div>
  131. <hr>
  132. <div class="header">
  133. <p>
  134. Next: <a href="i386_002dBugs.html#i386_002dBugs" accesskey="n" rel="next">i386-Bugs</a>, Previous: <a href="i386_002d16bit.html#i386_002d16bit" accesskey="p" rel="prev">i386-16bit</a>, Up: <a href="i386_002dDependent.html#i386_002dDependent" accesskey="u" rel="up">i386-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  135. </div>
  136. </body>
  137. </html>