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

Xtensa-Immediate-Relaxation.html 7.4KB

пре 3 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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-2020 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 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>Xtensa Immediate Relaxation (Using as)</title>
  16. <meta name="description" content="Xtensa Immediate Relaxation (Using as)">
  17. <meta name="keywords" content="Xtensa Immediate Relaxation (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  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="Xtensa-Relaxation.html#Xtensa-Relaxation" rel="up" title="Xtensa Relaxation">
  25. <link href="Xtensa-Directives.html#Xtensa-Directives" rel="next" title="Xtensa Directives">
  26. <link href="Xtensa-Jump-Relaxation.html#Xtensa-Jump-Relaxation" rel="prev" title="Xtensa Jump Relaxation">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="Xtensa-Immediate-Relaxation"></a>
  57. <div class="header">
  58. <p>
  59. Previous: <a href="Xtensa-Jump-Relaxation.html#Xtensa-Jump-Relaxation" accesskey="p" rel="prev">Xtensa Jump Relaxation</a>, Up: <a href="Xtensa-Relaxation.html#Xtensa-Relaxation" accesskey="u" rel="up">Xtensa Relaxation</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>
  60. </div>
  61. <hr>
  62. <a name="Other-Immediate-Field-Relaxation"></a>
  63. <h4 class="subsubsection">9.55.4.4 Other Immediate Field Relaxation</h4>
  64. <a name="index-immediate-fields_002c-relaxation"></a>
  65. <a name="index-relaxation-of-immediate-fields"></a>
  66. <p>The assembler normally performs the following other relaxations. They
  67. can be disabled by using underscore prefixes (see <a href="Xtensa-Opcodes.html#Xtensa-Opcodes">Opcode Names</a>), the &lsquo;<samp>--no-transform</samp>&rsquo; command-line option
  68. (see <a href="Xtensa-Options.html#Xtensa-Options">Command-line Options</a>), or the
  69. <code>no-transform</code> directive (see <a href="Transform-Directive.html#Transform-Directive">transform</a>).
  70. </p>
  71. <a name="index-MOVI-instructions_002c-relaxation"></a>
  72. <a name="index-relaxation-of-MOVI-instructions"></a>
  73. <p>The <code>MOVI</code> machine instruction can only materialize values in the
  74. range from -2048 to 2047. Values outside this range are best
  75. materialized with <code>L32R</code> instructions. Thus:
  76. </p>
  77. <div class="smallexample">
  78. <pre class="smallexample"> movi a0, 100000
  79. </pre></div>
  80. <p>is assembled into the following machine code:
  81. </p>
  82. <div class="smallexample">
  83. <pre class="smallexample"> .literal .L1, 100000
  84. l32r a0, .L1
  85. </pre></div>
  86. <a name="index-L8UI-instructions_002c-relaxation"></a>
  87. <a name="index-L16SI-instructions_002c-relaxation"></a>
  88. <a name="index-L16UI-instructions_002c-relaxation"></a>
  89. <a name="index-L32I-instructions_002c-relaxation"></a>
  90. <a name="index-relaxation-of-L8UI-instructions"></a>
  91. <a name="index-relaxation-of-L16SI-instructions"></a>
  92. <a name="index-relaxation-of-L16UI-instructions"></a>
  93. <a name="index-relaxation-of-L32I-instructions"></a>
  94. <p>The <code>L8UI</code> machine instruction can only be used with immediate
  95. offsets in the range from 0 to 255. The <code>L16SI</code> and <code>L16UI</code>
  96. machine instructions can only be used with offsets from 0 to 510. The
  97. <code>L32I</code> machine instruction can only be used with offsets from 0 to
  98. 1020. A load offset outside these ranges can be materialized with
  99. an <code>L32R</code> instruction if the destination register of the load
  100. is different than the source address register. For example:
  101. </p>
  102. <div class="smallexample">
  103. <pre class="smallexample"> l32i a1, a0, 2040
  104. </pre></div>
  105. <p>is translated to:
  106. </p>
  107. <div class="smallexample">
  108. <pre class="smallexample"> .literal .L1, 2040
  109. l32r a1, .L1
  110. </pre><pre class="smallexample"> add a1, a0, a1
  111. l32i a1, a1, 0
  112. </pre></div>
  113. <p>If the load destination and source address register are the same, an
  114. out-of-range offset causes an error.
  115. </p>
  116. <a name="index-ADDI-instructions_002c-relaxation"></a>
  117. <a name="index-relaxation-of-ADDI-instructions"></a>
  118. <p>The Xtensa <code>ADDI</code> instruction only allows immediate operands in the
  119. range from -128 to 127. There are a number of alternate instruction
  120. sequences for the <code>ADDI</code> operation. First, if the
  121. immediate is 0, the <code>ADDI</code> will be turned into a <code>MOV.N</code>
  122. instruction (or the equivalent <code>OR</code> instruction if the code density
  123. option is not available). If the <code>ADDI</code> immediate is outside of
  124. the range -128 to 127, but inside the range -32896 to 32639, an
  125. <code>ADDMI</code> instruction or <code>ADDMI</code>/<code>ADDI</code> sequence will be
  126. used. Finally, if the immediate is outside of this range and a free
  127. register is available, an <code>L32R</code>/<code>ADD</code> sequence will be used
  128. with a literal allocated from the literal pool.
  129. </p>
  130. <p>For example:
  131. </p>
  132. <div class="smallexample">
  133. <pre class="smallexample"> addi a5, a6, 0
  134. addi a5, a6, 512
  135. </pre><pre class="smallexample"> addi a5, a6, 513
  136. addi a5, a6, 50000
  137. </pre></div>
  138. <p>is assembled into the following:
  139. </p>
  140. <div class="smallexample">
  141. <pre class="smallexample"> .literal .L1, 50000
  142. mov.n a5, a6
  143. </pre><pre class="smallexample"> addmi a5, a6, 0x200
  144. addmi a5, a6, 0x200
  145. addi a5, a5, 1
  146. </pre><pre class="smallexample"> l32r a5, .L1
  147. add a5, a6, a5
  148. </pre></div>
  149. <hr>
  150. <div class="header">
  151. <p>
  152. Previous: <a href="Xtensa-Jump-Relaxation.html#Xtensa-Jump-Relaxation" accesskey="p" rel="prev">Xtensa Jump Relaxation</a>, Up: <a href="Xtensa-Relaxation.html#Xtensa-Relaxation" accesskey="u" rel="up">Xtensa Relaxation</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>
  153. </div>
  154. </body>
  155. </html>