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.

M68K_002dBranch.html 8.3KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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>M68K-Branch (Using as)</title>
  16. <meta name="description" content="M68K-Branch (Using as)">
  17. <meta name="keywords" content="M68K-Branch (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="M68K_002dopcodes.html#M68K_002dopcodes" rel="up" title="M68K-opcodes">
  25. <link href="M68K_002dChars.html#M68K_002dChars" rel="next" title="M68K-Chars">
  26. <link href="M68K_002dopcodes.html#M68K_002dopcodes" rel="prev" title="M68K-opcodes">
  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="M68K_002dBranch"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="M68K_002dChars.html#M68K_002dChars" accesskey="n" rel="next">M68K-Chars</a>, Up: <a href="M68K_002dopcodes.html#M68K_002dopcodes" accesskey="u" rel="up">M68K-opcodes</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="Branch-Improvement"></a>
  63. <h4 class="subsubsection">9.22.6.1 Branch Improvement</h4>
  64. <a name="index-pseudo_002dopcodes_002c-M680x0"></a>
  65. <a name="index-M680x0-pseudo_002dopcodes"></a>
  66. <a name="index-branch-improvement_002c-M680x0"></a>
  67. <a name="index-M680x0-branch-improvement"></a>
  68. <p>Certain pseudo opcodes are permitted for branch instructions.
  69. They expand to the shortest branch instruction that reach the
  70. target. Generally these mnemonics are made by substituting &lsquo;<samp>j</samp>&rsquo; for
  71. &lsquo;<samp>b</samp>&rsquo; at the start of a Motorola mnemonic.
  72. </p>
  73. <p>The following table summarizes the pseudo-operations. A <code>*</code> flags
  74. cases that are more fully described after the table:
  75. </p>
  76. <div class="smallexample">
  77. <pre class="smallexample"> Displacement
  78. +------------------------------------------------------------
  79. | 68020 68000/10, not PC-relative OK
  80. Pseudo-Op |BYTE WORD LONG ABSOLUTE LONG JUMP **
  81. +------------------------------------------------------------
  82. jbsr |bsrs bsrw bsrl jsr
  83. jra |bras braw bral jmp
  84. * jXX |bXXs bXXw bXXl bNXs;jmp
  85. * dbXX | N/A dbXXw dbXX;bras;bral dbXX;bras;jmp
  86. fjXX | N/A fbXXw fbXXl N/A
  87. XX: condition
  88. NX: negative of condition XX
  89. </pre></div>
  90. <div align="center"><code>*</code>&mdash;see full description below
  91. </div><div align="center"><code>**</code>&mdash;this expansion mode is disallowed by &lsquo;<samp>--pcrel</samp>&rsquo;
  92. </div>
  93. <dl compact="compact">
  94. <dt><code>jbsr</code></dt>
  95. <dt><code>jra</code></dt>
  96. <dd><p>These are the simplest jump pseudo-operations; they always map to one
  97. particular machine instruction, depending on the displacement to the
  98. branch target. This instruction will be a byte or word branch is that
  99. is sufficient. Otherwise, a long branch will be emitted if available.
  100. If no long branches are available and the &lsquo;<samp>--pcrel</samp>&rsquo; option is not
  101. given, an absolute long jump will be emitted instead. If no long
  102. branches are available, the &lsquo;<samp>--pcrel</samp>&rsquo; option is given, and a word
  103. branch cannot reach the target, an error message is generated.
  104. </p>
  105. <p>In addition to standard branch operands, <code>as</code> allows these
  106. pseudo-operations to have all operands that are allowed for jsr and jmp,
  107. substituting these instructions if the operand given is not valid for a
  108. branch instruction.
  109. </p>
  110. </dd>
  111. <dt><code>j<var>XX</var></code></dt>
  112. <dd><p>Here, &lsquo;<samp>j<var>XX</var></samp>&rsquo; stands for an entire family of pseudo-operations,
  113. where <var>XX</var> is a conditional branch or condition-code test. The full
  114. list of pseudo-ops in this family is:
  115. </p><div class="smallexample">
  116. <pre class="smallexample"> jhi jls jcc jcs jne jeq jvc
  117. jvs jpl jmi jge jlt jgt jle
  118. </pre></div>
  119. <p>Usually, each of these pseudo-operations expands to a single branch
  120. instruction. However, if a word branch is not sufficient, no long branches
  121. are available, and the &lsquo;<samp>--pcrel</samp>&rsquo; option is not given, <code>as</code>
  122. issues a longer code fragment in terms of <var>NX</var>, the opposite condition
  123. to <var>XX</var>. For example, under these conditions:
  124. </p><div class="smallexample">
  125. <pre class="smallexample"> j<var>XX</var> foo
  126. </pre></div>
  127. <p>gives
  128. </p><div class="smallexample">
  129. <pre class="smallexample"> b<var>NX</var>s oof
  130. jmp foo
  131. oof:
  132. </pre></div>
  133. </dd>
  134. <dt><code>db<var>XX</var></code></dt>
  135. <dd><p>The full family of pseudo-operations covered here is
  136. </p><div class="smallexample">
  137. <pre class="smallexample"> dbhi dbls dbcc dbcs dbne dbeq dbvc
  138. dbvs dbpl dbmi dbge dblt dbgt dble
  139. dbf dbra dbt
  140. </pre></div>
  141. <p>Motorola &lsquo;<samp>db<var>XX</var></samp>&rsquo; instructions allow word displacements only. When
  142. a word displacement is sufficient, each of these pseudo-operations expands
  143. to the corresponding Motorola instruction. When a word displacement is not
  144. sufficient and long branches are available, when the source reads
  145. &lsquo;<samp>db<var>XX</var> foo</samp>&rsquo;, <code>as</code> emits
  146. </p><div class="smallexample">
  147. <pre class="smallexample"> db<var>XX</var> oo1
  148. bras oo2
  149. oo1:bral foo
  150. oo2:
  151. </pre></div>
  152. <p>If, however, long branches are not available and the &lsquo;<samp>--pcrel</samp>&rsquo; option is
  153. not given, <code>as</code> emits
  154. </p><div class="smallexample">
  155. <pre class="smallexample"> db<var>XX</var> oo1
  156. bras oo2
  157. oo1:jmp foo
  158. oo2:
  159. </pre></div>
  160. </dd>
  161. <dt><code>fj<var>XX</var></code></dt>
  162. <dd><p>This family includes
  163. </p><div class="smallexample">
  164. <pre class="smallexample"> fjne fjeq fjge fjlt fjgt fjle fjf
  165. fjt fjgl fjgle fjnge fjngl fjngle fjngt
  166. fjnle fjnlt fjoge fjogl fjogt fjole fjolt
  167. fjor fjseq fjsf fjsne fjst fjueq fjuge
  168. fjugt fjule fjult fjun
  169. </pre></div>
  170. <p>Each of these pseudo-operations always expands to a single Motorola
  171. coprocessor branch instruction, word or long. All Motorola coprocessor
  172. branch instructions allow both word and long displacements.
  173. </p>
  174. </dd>
  175. </dl>
  176. <hr>
  177. <div class="header">
  178. <p>
  179. Next: <a href="M68K_002dChars.html#M68K_002dChars" accesskey="n" rel="next">M68K-Chars</a>, Up: <a href="M68K_002dopcodes.html#M68K_002dopcodes" accesskey="u" rel="up">M68K-opcodes</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>
  180. </div>
  181. </body>
  182. </html>