i386_002dRegs.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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-Regs</title>
  15. <meta name="description" content="Using as: i386-Regs">
  16. <meta name="keywords" content="Using as: i386-Regs">
  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_002dPrefixes.html#i386_002dPrefixes" rel="next" title="i386-Prefixes">
  26. <link href="i386_002dMnemonics.html#i386_002dMnemonics" rel="prev" title="i386-Mnemonics">
  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_002dRegs"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="i386_002dPrefixes.html#i386_002dPrefixes" accesskey="n" rel="next">i386-Prefixes</a>, Previous: <a href="i386_002dMnemonics.html#i386_002dMnemonics" accesskey="p" rel="prev">i386-Mnemonics</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="Register-Naming"></a>
  64. <h4 class="subsection">9.15.5 Register Naming</h4>
  65. <a name="index-i386-registers"></a>
  66. <a name="index-registers_002c-i386"></a>
  67. <a name="index-x86_002d64-registers"></a>
  68. <a name="index-registers_002c-x86_002d64"></a>
  69. <p>Register operands are always prefixed with &lsquo;<samp>%</samp>&rsquo;. The 80386 registers
  70. consist of
  71. </p>
  72. <ul>
  73. <li> the 8 32-bit registers &lsquo;<samp>%eax</samp>&rsquo; (the accumulator), &lsquo;<samp>%ebx</samp>&rsquo;,
  74. &lsquo;<samp>%ecx</samp>&rsquo;, &lsquo;<samp>%edx</samp>&rsquo;, &lsquo;<samp>%edi</samp>&rsquo;, &lsquo;<samp>%esi</samp>&rsquo;, &lsquo;<samp>%ebp</samp>&rsquo; (the
  75. frame pointer), and &lsquo;<samp>%esp</samp>&rsquo; (the stack pointer).
  76. </li><li> the 8 16-bit low-ends of these: &lsquo;<samp>%ax</samp>&rsquo;, &lsquo;<samp>%bx</samp>&rsquo;, &lsquo;<samp>%cx</samp>&rsquo;,
  77. &lsquo;<samp>%dx</samp>&rsquo;, &lsquo;<samp>%di</samp>&rsquo;, &lsquo;<samp>%si</samp>&rsquo;, &lsquo;<samp>%bp</samp>&rsquo;, and &lsquo;<samp>%sp</samp>&rsquo;.
  78. </li><li> the 8 8-bit registers: &lsquo;<samp>%ah</samp>&rsquo;, &lsquo;<samp>%al</samp>&rsquo;, &lsquo;<samp>%bh</samp>&rsquo;,
  79. &lsquo;<samp>%bl</samp>&rsquo;, &lsquo;<samp>%ch</samp>&rsquo;, &lsquo;<samp>%cl</samp>&rsquo;, &lsquo;<samp>%dh</samp>&rsquo;, and &lsquo;<samp>%dl</samp>&rsquo; (These
  80. are the high-bytes and low-bytes of &lsquo;<samp>%ax</samp>&rsquo;, &lsquo;<samp>%bx</samp>&rsquo;,
  81. &lsquo;<samp>%cx</samp>&rsquo;, and &lsquo;<samp>%dx</samp>&rsquo;)
  82. </li><li> the 6 section registers &lsquo;<samp>%cs</samp>&rsquo; (code section), &lsquo;<samp>%ds</samp>&rsquo;
  83. (data section), &lsquo;<samp>%ss</samp>&rsquo; (stack section), &lsquo;<samp>%es</samp>&rsquo;, &lsquo;<samp>%fs</samp>&rsquo;,
  84. and &lsquo;<samp>%gs</samp>&rsquo;.
  85. </li><li> the 5 processor control registers &lsquo;<samp>%cr0</samp>&rsquo;, &lsquo;<samp>%cr2</samp>&rsquo;,
  86. &lsquo;<samp>%cr3</samp>&rsquo;, &lsquo;<samp>%cr4</samp>&rsquo;, and &lsquo;<samp>%cr8</samp>&rsquo;.
  87. </li><li> the 6 debug registers &lsquo;<samp>%db0</samp>&rsquo;, &lsquo;<samp>%db1</samp>&rsquo;, &lsquo;<samp>%db2</samp>&rsquo;,
  88. &lsquo;<samp>%db3</samp>&rsquo;, &lsquo;<samp>%db6</samp>&rsquo;, and &lsquo;<samp>%db7</samp>&rsquo;.
  89. </li><li> the 2 test registers &lsquo;<samp>%tr6</samp>&rsquo; and &lsquo;<samp>%tr7</samp>&rsquo;.
  90. </li><li> the 8 floating point register stack &lsquo;<samp>%st</samp>&rsquo; or equivalently
  91. &lsquo;<samp>%st(0)</samp>&rsquo;, &lsquo;<samp>%st(1)</samp>&rsquo;, &lsquo;<samp>%st(2)</samp>&rsquo;, &lsquo;<samp>%st(3)</samp>&rsquo;,
  92. &lsquo;<samp>%st(4)</samp>&rsquo;, &lsquo;<samp>%st(5)</samp>&rsquo;, &lsquo;<samp>%st(6)</samp>&rsquo;, and &lsquo;<samp>%st(7)</samp>&rsquo;.
  93. These registers are overloaded by 8 MMX registers &lsquo;<samp>%mm0</samp>&rsquo;,
  94. &lsquo;<samp>%mm1</samp>&rsquo;, &lsquo;<samp>%mm2</samp>&rsquo;, &lsquo;<samp>%mm3</samp>&rsquo;, &lsquo;<samp>%mm4</samp>&rsquo;, &lsquo;<samp>%mm5</samp>&rsquo;,
  95. &lsquo;<samp>%mm6</samp>&rsquo; and &lsquo;<samp>%mm7</samp>&rsquo;.
  96. </li><li> the 8 128-bit SSE registers registers &lsquo;<samp>%xmm0</samp>&rsquo;, &lsquo;<samp>%xmm1</samp>&rsquo;, &lsquo;<samp>%xmm2</samp>&rsquo;,
  97. &lsquo;<samp>%xmm3</samp>&rsquo;, &lsquo;<samp>%xmm4</samp>&rsquo;, &lsquo;<samp>%xmm5</samp>&rsquo;, &lsquo;<samp>%xmm6</samp>&rsquo; and &lsquo;<samp>%xmm7</samp>&rsquo;.
  98. </li></ul>
  99. <p>The AMD x86-64 architecture extends the register set by:
  100. </p>
  101. <ul>
  102. <li> enhancing the 8 32-bit registers to 64-bit: &lsquo;<samp>%rax</samp>&rsquo; (the
  103. accumulator), &lsquo;<samp>%rbx</samp>&rsquo;, &lsquo;<samp>%rcx</samp>&rsquo;, &lsquo;<samp>%rdx</samp>&rsquo;, &lsquo;<samp>%rdi</samp>&rsquo;,
  104. &lsquo;<samp>%rsi</samp>&rsquo;, &lsquo;<samp>%rbp</samp>&rsquo; (the frame pointer), &lsquo;<samp>%rsp</samp>&rsquo; (the stack
  105. pointer)
  106. </li><li> the 8 extended registers &lsquo;<samp>%r8</samp>&rsquo;&ndash;&lsquo;<samp>%r15</samp>&rsquo;.
  107. </li><li> the 8 32-bit low ends of the extended registers: &lsquo;<samp>%r8d</samp>&rsquo;&ndash;&lsquo;<samp>%r15d</samp>&rsquo;.
  108. </li><li> the 8 16-bit low ends of the extended registers: &lsquo;<samp>%r8w</samp>&rsquo;&ndash;&lsquo;<samp>%r15w</samp>&rsquo;.
  109. </li><li> the 8 8-bit low ends of the extended registers: &lsquo;<samp>%r8b</samp>&rsquo;&ndash;&lsquo;<samp>%r15b</samp>&rsquo;.
  110. </li><li> the 4 8-bit registers: &lsquo;<samp>%sil</samp>&rsquo;, &lsquo;<samp>%dil</samp>&rsquo;, &lsquo;<samp>%bpl</samp>&rsquo;, &lsquo;<samp>%spl</samp>&rsquo;.
  111. </li><li> the 8 debug registers: &lsquo;<samp>%db8</samp>&rsquo;&ndash;&lsquo;<samp>%db15</samp>&rsquo;.
  112. </li><li> the 8 128-bit SSE registers: &lsquo;<samp>%xmm8</samp>&rsquo;&ndash;&lsquo;<samp>%xmm15</samp>&rsquo;.
  113. </li></ul>
  114. <p>With the AVX extensions more registers were made available:
  115. </p>
  116. <ul>
  117. <li> the 16 256-bit SSE &lsquo;<samp>%ymm0</samp>&rsquo;&ndash;&lsquo;<samp>%ymm15</samp>&rsquo; (only the first 8
  118. available in 32-bit mode). The bottom 128 bits are overlaid with the
  119. &lsquo;<samp>xmm0</samp>&rsquo;&ndash;&lsquo;<samp>xmm15</samp>&rsquo; registers.
  120. </li></ul>
  121. <p>The AVX2 extensions made in 64-bit mode more registers available:
  122. </p>
  123. <ul>
  124. <li> the 16 128-bit registers &lsquo;<samp>%xmm16</samp>&rsquo;&ndash;&lsquo;<samp>%xmm31</samp>&rsquo; and the 16 256-bit
  125. registers &lsquo;<samp>%ymm16</samp>&rsquo;&ndash;&lsquo;<samp>%ymm31</samp>&rsquo;.
  126. </li></ul>
  127. <p>The AVX512 extensions added the following registers:
  128. </p>
  129. <ul>
  130. <li> the 32 512-bit registers &lsquo;<samp>%zmm0</samp>&rsquo;&ndash;&lsquo;<samp>%zmm31</samp>&rsquo; (only the first 8
  131. available in 32-bit mode). The bottom 128 bits are overlaid with the
  132. &lsquo;<samp>%xmm0</samp>&rsquo;&ndash;&lsquo;<samp>%xmm31</samp>&rsquo; registers and the first 256 bits are
  133. overlaid with the &lsquo;<samp>%ymm0</samp>&rsquo;&ndash;&lsquo;<samp>%ymm31</samp>&rsquo; registers.
  134. </li><li> the 8 mask registers &lsquo;<samp>%k0</samp>&rsquo;&ndash;&lsquo;<samp>%k7</samp>&rsquo;.
  135. </li></ul>
  136. <hr>
  137. <div class="header">
  138. <p>
  139. Next: <a href="i386_002dPrefixes.html#i386_002dPrefixes" accesskey="n" rel="next">i386-Prefixes</a>, Previous: <a href="i386_002dMnemonics.html#i386_002dMnemonics" accesskey="p" rel="prev">i386-Mnemonics</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>
  140. </div>
  141. </body>
  142. </html>