blob: 359d5697d8c46a113cad04a65ae39b7794365328 [file] [log] [blame]
<html lang="en">
<head>
<title>MMIX-Expand - 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="MMIX_002dDependent.html#MMIX_002dDependent" title="MMIX-Dependent">
<link rel="prev" href="MMIX_002dOpts.html#MMIX_002dOpts" title="MMIX-Opts">
<link rel="next" href="MMIX_002dSyntax.html#MMIX_002dSyntax" title="MMIX-Syntax">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991-2019 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="MMIX-Expand"></a>
<a name="MMIX_002dExpand"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="MMIX_002dSyntax.html#MMIX_002dSyntax">MMIX-Syntax</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="MMIX_002dOpts.html#MMIX_002dOpts">MMIX-Opts</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="MMIX_002dDependent.html#MMIX_002dDependent">MMIX-Dependent</a>
<hr>
</div>
<h4 class="subsection">9.28.2 Instruction expansion</h4>
<p><a name="index-instruction-expansion_002c-MMIX-1680"></a>When <code>as</code> encounters an instruction with an operand that is
either not known or does not fit the operand size of the instruction,
<code>as</code> (and <code>ld</code>) will expand the instruction into
a sequence of instructions semantically equivalent to the operand fitting
the instruction. Expansion will take place for the following
instructions:
<dl>
<dt>&lsquo;<samp><span class="samp">GETA</span></samp>&rsquo;<dd>Expands to a sequence of four instructions: <code>SETL</code>, <code>INCML</code>,
<code>INCMH</code> and <code>INCH</code>. The operand must be a multiple of four.
<br><dt>Conditional branches<dd>A branch instruction is turned into a branch with the complemented
condition and prediction bit over five instructions; four instructions
setting <code>$255</code> to the operand value, which like with <code>GETA</code> must
be a multiple of four, and a final <code>GO $255,$255,0</code>.
<br><dt>&lsquo;<samp><span class="samp">PUSHJ</span></samp>&rsquo;<dd>Similar to expansion for conditional branches; four instructions set
<code>$255</code> to the operand value, followed by a <code>PUSHGO $255,$255,0</code>.
<br><dt>&lsquo;<samp><span class="samp">JMP</span></samp>&rsquo;<dd>Similar to conditional branches and <code>PUSHJ</code>. The final instruction
is <code>GO $255,$255,0</code>.
</dl>
<p>The linker <code>ld</code> is expected to shrink these expansions for
code assembled with &lsquo;<samp><span class="samp">--relax</span></samp>&rsquo; (though not currently implemented).
</body></html>