Home | History | Annotate | Line # | Download | only in doc
c-mmix.texi revision 1.1.1.1
      1  1.1  skrll @c Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
      2  1.1  skrll @c This is part of the GAS manual.
      3  1.1  skrll @c For copying conditions, see the file as.texinfo.
      4  1.1  skrll @c MMIX description by Hans-Peter Nilsson, hp (a] bitrange.com
      5  1.1  skrll @ifset GENERIC
      6  1.1  skrll @page
      7  1.1  skrll @node MMIX-Dependent
      8  1.1  skrll @chapter MMIX Dependent Features
      9  1.1  skrll @end ifset
     10  1.1  skrll @ifclear GENERIC
     11  1.1  skrll @node Machine Dependencies
     12  1.1  skrll @chapter MMIX Dependent Features
     13  1.1  skrll @end ifclear
     14  1.1  skrll 
     15  1.1  skrll @cindex MMIX support
     16  1.1  skrll @menu
     17  1.1  skrll * MMIX-Opts::              Command-line Options
     18  1.1  skrll * MMIX-Expand::            Instruction expansion
     19  1.1  skrll * MMIX-Syntax::            Syntax
     20  1.1  skrll * MMIX-mmixal::		   Differences to @code{mmixal} syntax and semantics
     21  1.1  skrll @end menu
     22  1.1  skrll 
     23  1.1  skrll @node MMIX-Opts
     24  1.1  skrll @section Command-line Options
     25  1.1  skrll 
     26  1.1  skrll @cindex options, MMIX
     27  1.1  skrll @cindex MMIX options
     28  1.1  skrll The MMIX version of @code{@value{AS}} has some machine-dependent options.
     29  1.1  skrll 
     30  1.1  skrll @cindex @samp{--fixed-special-register-names} command line option, MMIX
     31  1.1  skrll When @samp{--fixed-special-register-names} is specified, only the register
     32  1.1  skrll names specified in @ref{MMIX-Regs} are recognized in the instructions
     33  1.1  skrll @code{PUT} and @code{GET}.
     34  1.1  skrll 
     35  1.1  skrll @cindex @samp{--globalize-symbols} command line option, MMIX
     36  1.1  skrll You can use the @samp{--globalize-symbols} to make all symbols global.
     37  1.1  skrll This option is useful when splitting up a @code{mmixal} program into
     38  1.1  skrll several files.
     39  1.1  skrll 
     40  1.1  skrll @cindex @samp{--gnu-syntax} command line option, MMIX
     41  1.1  skrll The @samp{--gnu-syntax} turns off most syntax compatibility with
     42  1.1  skrll @code{mmixal}.  Its usability is currently doubtful.
     43  1.1  skrll 
     44  1.1  skrll @cindex @samp{--relax} command line option, MMIX
     45  1.1  skrll The @samp{--relax} option is not fully supported, but will eventually make
     46  1.1  skrll the object file prepared for linker relaxation.
     47  1.1  skrll 
     48  1.1  skrll @cindex @samp{--no-predefined-syms} command line option, MMIX
     49  1.1  skrll If you want to avoid inadvertently calling a predefined symbol and would
     50  1.1  skrll rather get an error, for example when using @code{@value{AS}} with a
     51  1.1  skrll compiler or other machine-generated code, specify
     52  1.1  skrll @samp{--no-predefined-syms}.  This turns off built-in predefined
     53  1.1  skrll definitions of all such symbols, including rounding-mode symbols, segment
     54  1.1  skrll symbols, @samp{BIT} symbols, and @code{TRAP} symbols used in @code{mmix}
     55  1.1  skrll ``system calls''.  It also turns off predefined special-register names,
     56  1.1  skrll except when used in @code{PUT} and @code{GET} instructions.
     57  1.1  skrll 
     58  1.1  skrll @cindex @samp{--no-expand} command line option, MMIX
     59  1.1  skrll By default, some instructions are expanded to fit the size of the operand
     60  1.1  skrll or an external symbol (@pxref{MMIX-Expand}).  By passing
     61  1.1  skrll @samp{--no-expand}, no such expansion will be done, instead causing errors
     62  1.1  skrll at link time if the operand does not fit.
     63  1.1  skrll 
     64  1.1  skrll @cindex @samp{--no-merge-gregs} command line option, MMIX
     65  1.1  skrll The @code{mmixal} documentation (@pxref{mmixsite}) specifies that global
     66  1.1  skrll registers allocated with the @samp{GREG} directive (@pxref{MMIX-greg}) and
     67  1.1  skrll initialized to the same non-zero value, will refer to the same global
     68  1.1  skrll register.  This isn't strictly enforceable in @code{@value{AS}} since the
     69  1.1  skrll final addresses aren't known until link-time, but it will do an effort
     70  1.1  skrll unless the @samp{--no-merge-gregs} option is specified.  (Register merging
     71  1.1  skrll isn't yet implemented in @code{@value{LD}}.)
     72  1.1  skrll 
     73  1.1  skrll @cindex @samp{-x} command line option, MMIX
     74  1.1  skrll @code{@value{AS}} will warn every time it expands an instruction to fit an
     75  1.1  skrll operand unless the option @samp{-x} is specified.  It is believed that
     76  1.1  skrll this behaviour is more useful than just mimicking @code{mmixal}'s
     77  1.1  skrll behaviour, in which instructions are only expanded if the @samp{-x} option
     78  1.1  skrll is specified, and assembly fails otherwise, when an instruction needs to
     79  1.1  skrll be expanded.  It needs to be kept in mind that @code{mmixal} is both an
     80  1.1  skrll assembler and linker, while @code{@value{AS}} will expand instructions
     81  1.1  skrll that at link stage can be contracted.  (Though linker relaxation isn't yet
     82  1.1  skrll implemented in @code{@value{LD}}.)  The option @samp{-x} also imples
     83  1.1  skrll @samp{--linker-allocated-gregs}.
     84  1.1  skrll 
     85  1.1  skrll @cindex @samp{--no-pushj-stubs} command line option, MMIX
     86  1.1  skrll @cindex @samp{--no-stubs} command line option, MMIX
     87  1.1  skrll If instruction expansion is enabled, @code{@value{AS}} can expand a
     88  1.1  skrll @samp{PUSHJ} instruction into a series of instructions.  The shortest
     89  1.1  skrll expansion is to not expand it, but just mark the call as redirectable to a
     90  1.1  skrll stub, which @code{@value{LD}} creates at link-time, but only if the
     91  1.1  skrll original @samp{PUSHJ} instruction is found not to reach the target.  The
     92  1.1  skrll stub consists of the necessary instructions to form a jump to the target.
     93  1.1  skrll This happens if @code{@value{AS}} can assert that the @samp{PUSHJ}
     94  1.1  skrll instruction can reach such a stub.  The option @samp{--no-pushj-stubs}
     95  1.1  skrll disables this shorter expansion, and the longer series of instructions is
     96  1.1  skrll then created at assembly-time.  The option @samp{--no-stubs} is a synonym,
     97  1.1  skrll intended for compatibility with future releases, where generation of stubs
     98  1.1  skrll for other instructions may be implemented.
     99  1.1  skrll 
    100  1.1  skrll @cindex @samp{--linker-allocated-gregs} command line option, MMIX
    101  1.1  skrll Usually a two-operand-expression (@pxref{GREG-base}) without a matching
    102  1.1  skrll @samp{GREG} directive is treated as an error by @code{@value{AS}}.  When
    103  1.1  skrll the option @samp{--linker-allocated-gregs} is in effect, they are instead
    104  1.1  skrll passed through to the linker, which will allocate as many global registers
    105  1.1  skrll as is needed.
    106  1.1  skrll 
    107  1.1  skrll @node MMIX-Expand
    108  1.1  skrll @section Instruction expansion
    109  1.1  skrll 
    110  1.1  skrll @cindex instruction expansion, MMIX
    111  1.1  skrll When @code{@value{AS}} encounters an instruction with an operand that is
    112  1.1  skrll either not known or does not fit the operand size of the instruction,
    113  1.1  skrll @code{@value{AS}} (and @code{@value{LD}}) will expand the instruction into
    114  1.1  skrll a sequence of instructions semantically equivalent to the operand fitting
    115  1.1  skrll the instruction.  Expansion will take place for the following
    116  1.1  skrll instructions:
    117  1.1  skrll 
    118  1.1  skrll @table @asis
    119  1.1  skrll @item @samp{GETA}
    120  1.1  skrll Expands to a sequence of four instructions: @code{SETL}, @code{INCML},
    121  1.1  skrll @code{INCMH} and @code{INCH}.  The operand must be a multiple of four.
    122  1.1  skrll @item Conditional branches
    123  1.1  skrll A branch instruction is turned into a branch with the complemented
    124  1.1  skrll condition and prediction bit over five instructions; four instructions
    125  1.1  skrll setting @code{$255} to the operand value, which like with @code{GETA} must
    126  1.1  skrll be a multiple of four, and a final @code{GO $255,$255,0}.
    127  1.1  skrll @item @samp{PUSHJ}
    128  1.1  skrll Similar to expansion for conditional branches; four instructions set
    129  1.1  skrll @code{$255} to the operand value, followed by a @code{PUSHGO $255,$255,0}.
    130  1.1  skrll @item @samp{JMP}
    131  1.1  skrll Similar to conditional branches and @code{PUSHJ}.  The final instruction
    132  1.1  skrll is @code{GO $255,$255,0}.
    133  1.1  skrll @end table
    134  1.1  skrll 
    135  1.1  skrll The linker @code{@value{LD}} is expected to shrink these expansions for
    136  1.1  skrll code assembled with @samp{--relax} (though not currently implemented).
    137  1.1  skrll 
    138  1.1  skrll @node MMIX-Syntax
    139  1.1  skrll @section Syntax
    140  1.1  skrll 
    141  1.1  skrll The assembly syntax is supposed to be upward compatible with that
    142  1.1  skrll described in Sections 1.3 and 1.4 of @samp{The Art of Computer
    143  1.1  skrll Programming, Volume 1}.  Draft versions of those chapters as well as other
    144  1.1  skrll MMIX information is located at
    145  1.1  skrll @anchor{mmixsite}@url{http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html}.
    146  1.1  skrll Most code examples from the mmixal package located there should work
    147  1.1  skrll unmodified when assembled and linked as single files, with a few
    148  1.1  skrll noteworthy exceptions (@pxref{MMIX-mmixal}).
    149  1.1  skrll 
    150  1.1  skrll Before an instruction is emitted, the current location is aligned to the
    151  1.1  skrll next four-byte boundary.  If a label is defined at the beginning of the
    152  1.1  skrll line, its value will be the aligned value.
    153  1.1  skrll 
    154  1.1  skrll In addition to the traditional hex-prefix @samp{0x}, a hexadecimal number
    155  1.1  skrll can also be specified by the prefix character @samp{#}.
    156  1.1  skrll 
    157  1.1  skrll After all operands to an MMIX instruction or directive have been
    158  1.1  skrll specified, the rest of the line is ignored, treated as a comment.
    159  1.1  skrll 
    160  1.1  skrll @menu
    161  1.1  skrll * MMIX-Chars::		        Special Characters
    162  1.1  skrll * MMIX-Symbols::		Symbols
    163  1.1  skrll * MMIX-Regs::			Register Names
    164  1.1  skrll * MMIX-Pseudos::		Assembler Directives
    165  1.1  skrll @end menu
    166  1.1  skrll 
    167  1.1  skrll @node MMIX-Chars
    168  1.1  skrll @subsection Special Characters
    169  1.1  skrll @cindex line comment characters, MMIX
    170  1.1  skrll @cindex MMIX line comment characters
    171  1.1  skrll 
    172  1.1  skrll The characters @samp{*} and @samp{#} are line comment characters; each
    173  1.1  skrll start a comment at the beginning of a line, but only at the beginning of a
    174  1.1  skrll line.  A @samp{#} prefixes a hexadecimal number if found elsewhere on a
    175  1.1  skrll line.
    176  1.1  skrll 
    177  1.1  skrll Two other characters, @samp{%} and @samp{!}, each start a comment anywhere
    178  1.1  skrll on the line.  Thus you can't use the @samp{modulus} and @samp{not}
    179  1.1  skrll operators in expressions normally associated with these two characters.
    180  1.1  skrll 
    181  1.1  skrll A @samp{;} is a line separator, treated as a new-line, so separate
    182  1.1  skrll instructions can be specified on a single line.
    183  1.1  skrll 
    184  1.1  skrll @node MMIX-Symbols
    185  1.1  skrll @subsection Symbols
    186  1.1  skrll The character @samp{:} is permitted in identifiers.  There are two
    187  1.1  skrll exceptions to it being treated as any other symbol character: if a symbol
    188  1.1  skrll begins with @samp{:}, it means that the symbol is in the global namespace
    189  1.1  skrll and that the current prefix should not be prepended to that symbol
    190  1.1  skrll (@pxref{MMIX-prefix}).  The @samp{:} is then not considered part of the
    191  1.1  skrll symbol.  For a symbol in the label position (first on a line), a @samp{:}
    192  1.1  skrll at the end of a symbol is silently stripped off.  A label is permitted,
    193  1.1  skrll but not required, to be followed by a @samp{:}, as with many other
    194  1.1  skrll assembly formats.
    195  1.1  skrll 
    196  1.1  skrll The character @samp{@@} in an expression, is a synonym for @samp{.}, the
    197  1.1  skrll current location.
    198  1.1  skrll 
    199  1.1  skrll In addition to the common forward and backward local symbol formats
    200  1.1  skrll (@pxref{Symbol Names}), they can be specified with upper-case @samp{B} and
    201  1.1  skrll @samp{F}, as in @samp{8B} and @samp{9F}.  A local label defined for the
    202  1.1  skrll current position is written with a @samp{H} appended to the number:
    203  1.1  skrll @smallexample
    204  1.1  skrll 3H LDB $0,$1,2
    205  1.1  skrll @end smallexample
    206  1.1  skrll This and traditional local-label formats cannot be mixed: a label must be
    207  1.1  skrll defined and referred to using the same format.
    208  1.1  skrll 
    209  1.1  skrll There's a minor caveat: just as for the ordinary local symbols, the local
    210  1.1  skrll symbols are translated into ordinary symbols using control characters are
    211  1.1  skrll to hide the ordinal number of the symbol.  Unfortunately, these symbols
    212  1.1  skrll are not translated back in error messages.  Thus you may see confusing
    213  1.1  skrll error messages when local symbols are used.  Control characters
    214  1.1  skrll @samp{\003} (control-C) and @samp{\004} (control-D) are used for the
    215  1.1  skrll MMIX-specific local-symbol syntax.
    216  1.1  skrll 
    217  1.1  skrll The symbol @samp{Main} is handled specially; it is always global.
    218  1.1  skrll 
    219  1.1  skrll By defining the symbols @samp{__.MMIX.start..text} and
    220  1.1  skrll @samp{__.MMIX.start..data}, the address of respectively the @samp{.text}
    221  1.1  skrll and @samp{.data} segments of the final program can be defined, though when
    222  1.1  skrll linking more than one object file, the code or data in the object file
    223  1.1  skrll containing the symbol is not guaranteed to be start at that position; just
    224  1.1  skrll the final executable.  @xref{MMIX-loc}.
    225  1.1  skrll 
    226  1.1  skrll @node MMIX-Regs
    227  1.1  skrll @subsection Register names
    228  1.1  skrll @cindex register names, MMIX
    229  1.1  skrll @cindex MMIX register names
    230  1.1  skrll 
    231  1.1  skrll Local and global registers are specified as @samp{$0} to @samp{$255}.
    232  1.1  skrll The recognized special register names are @samp{rJ}, @samp{rA}, @samp{rB},
    233  1.1  skrll @samp{rC}, @samp{rD}, @samp{rE}, @samp{rF}, @samp{rG}, @samp{rH},
    234  1.1  skrll @samp{rI}, @samp{rK}, @samp{rL}, @samp{rM}, @samp{rN}, @samp{rO},
    235  1.1  skrll @samp{rP}, @samp{rQ}, @samp{rR}, @samp{rS}, @samp{rT}, @samp{rU},
    236  1.1  skrll @samp{rV}, @samp{rW}, @samp{rX}, @samp{rY}, @samp{rZ}, @samp{rBB},
    237  1.1  skrll @samp{rTT}, @samp{rWW}, @samp{rXX}, @samp{rYY} and @samp{rZZ}.  A leading
    238  1.1  skrll @samp{:} is optional for special register names.
    239  1.1  skrll 
    240  1.1  skrll Local and global symbols can be equated to register names and used in
    241  1.1  skrll place of ordinary registers.
    242  1.1  skrll 
    243  1.1  skrll Similarly for special registers, local and global symbols can be used.
    244  1.1  skrll Also, symbols equated from numbers and constant expressions are allowed in
    245  1.1  skrll place of a special register, except when either of the options
    246  1.1  skrll @code{--no-predefined-syms} and @code{--fixed-special-register-names} are
    247  1.1  skrll specified.  Then only the special register names above are allowed for the
    248  1.1  skrll instructions having a special register operand; @code{GET} and @code{PUT}.
    249  1.1  skrll 
    250  1.1  skrll @node MMIX-Pseudos
    251  1.1  skrll @subsection Assembler Directives
    252  1.1  skrll @cindex assembler directives, MMIX
    253  1.1  skrll @cindex pseudo-ops, MMIX
    254  1.1  skrll @cindex MMIX assembler directives
    255  1.1  skrll @cindex MMIX pseudo-ops
    256  1.1  skrll 
    257  1.1  skrll @table @code
    258  1.1  skrll @item LOC
    259  1.1  skrll @cindex assembler directive LOC, MMIX
    260  1.1  skrll @cindex pseudo-op LOC, MMIX
    261  1.1  skrll @cindex MMIX assembler directive LOC
    262  1.1  skrll @cindex MMIX pseudo-op LOC
    263  1.1  skrll 
    264  1.1  skrll @anchor{MMIX-loc}
    265  1.1  skrll The @code{LOC} directive sets the current location to the value of the
    266  1.1  skrll operand field, which may include changing sections.  If the operand is a
    267  1.1  skrll constant, the section is set to either @code{.data} if the value is
    268  1.1  skrll @code{0x2000000000000000} or larger, else it is set to @code{.text}.
    269  1.1  skrll Within a section, the current location may only be changed to
    270  1.1  skrll monotonically higher addresses.  A LOC expression must be a previously
    271  1.1  skrll defined symbol or a ``pure'' constant.
    272  1.1  skrll 
    273  1.1  skrll An example, which sets the label @var{prev} to the current location, and
    274  1.1  skrll updates the current location to eight bytes forward:
    275  1.1  skrll @smallexample
    276  1.1  skrll prev LOC @@+8
    277  1.1  skrll @end smallexample
    278  1.1  skrll 
    279  1.1  skrll When a LOC has a constant as its operand, a symbol
    280  1.1  skrll @code{__.MMIX.start..text} or @code{__.MMIX.start..data} is defined
    281  1.1  skrll depending on the address as mentioned above.  Each such symbol is
    282  1.1  skrll interpreted as special by the linker, locating the section at that
    283  1.1  skrll address.  Note that if multiple files are linked, the first object file
    284  1.1  skrll with that section will be mapped to that address (not necessarily the file
    285  1.1  skrll with the LOC definition).
    286  1.1  skrll 
    287  1.1  skrll @item LOCAL
    288  1.1  skrll @cindex assembler directive LOCAL, MMIX
    289  1.1  skrll @cindex pseudo-op LOCAL, MMIX
    290  1.1  skrll @cindex MMIX assembler directive LOCAL
    291  1.1  skrll @cindex MMIX pseudo-op LOCAL
    292  1.1  skrll 
    293  1.1  skrll @anchor{MMIX-local}
    294  1.1  skrll Example:
    295  1.1  skrll @smallexample
    296  1.1  skrll  LOCAL external_symbol
    297  1.1  skrll  LOCAL 42
    298  1.1  skrll  .local asymbol
    299  1.1  skrll @end smallexample
    300  1.1  skrll 
    301  1.1  skrll This directive-operation generates a link-time assertion that the operand
    302  1.1  skrll does not correspond to a global register.  The operand is an expression
    303  1.1  skrll that at link-time resolves to a register symbol or a number.  A number is
    304  1.1  skrll treated as the register having that number.  There is one restriction on
    305  1.1  skrll the use of this directive: the pseudo-directive must be placed in a
    306  1.1  skrll section with contents, code or data.
    307  1.1  skrll 
    308  1.1  skrll @item IS
    309  1.1  skrll @cindex assembler directive IS, MMIX
    310  1.1  skrll @cindex pseudo-op IS, MMIX
    311  1.1  skrll @cindex MMIX assembler directive IS
    312  1.1  skrll @cindex MMIX pseudo-op IS
    313  1.1  skrll 
    314  1.1  skrll @anchor{MMIX-is}
    315  1.1  skrll The @code{IS} directive:
    316  1.1  skrll @smallexample
    317  1.1  skrll asymbol IS an_expression
    318  1.1  skrll @end smallexample
    319  1.1  skrll sets the symbol @samp{asymbol} to @samp{an_expression}.  A symbol may not
    320  1.1  skrll be set more than once using this directive.  Local labels may be set using
    321  1.1  skrll this directive, for example:
    322  1.1  skrll @smallexample
    323  1.1  skrll 5H IS @@+4
    324  1.1  skrll @end smallexample
    325  1.1  skrll 
    326  1.1  skrll @item GREG
    327  1.1  skrll @cindex assembler directive GREG, MMIX
    328  1.1  skrll @cindex pseudo-op GREG, MMIX
    329  1.1  skrll @cindex MMIX assembler directive GREG
    330  1.1  skrll @cindex MMIX pseudo-op GREG
    331  1.1  skrll 
    332  1.1  skrll @anchor{MMIX-greg}
    333  1.1  skrll This directive reserves a global register, gives it an initial value and
    334  1.1  skrll optionally gives it a symbolic name.  Some examples:
    335  1.1  skrll 
    336  1.1  skrll @smallexample
    337  1.1  skrll areg GREG
    338  1.1  skrll breg GREG data_value
    339  1.1  skrll      GREG data_buffer
    340  1.1  skrll      .greg creg, another_data_value
    341  1.1  skrll @end smallexample
    342  1.1  skrll 
    343  1.1  skrll The symbolic register name can be used in place of a (non-special)
    344  1.1  skrll register.  If a value isn't provided, it defaults to zero.  Unless the
    345  1.1  skrll option @samp{--no-merge-gregs} is specified, non-zero registers allocated
    346  1.1  skrll with this directive may be eliminated by @code{@value{AS}}; another
    347  1.1  skrll register with the same value used in its place.
    348  1.1  skrll Any of the instructions
    349  1.1  skrll @samp{CSWAP},
    350  1.1  skrll @samp{GO},
    351  1.1  skrll @samp{LDA},
    352  1.1  skrll @samp{LDBU},
    353  1.1  skrll @samp{LDB},
    354  1.1  skrll @samp{LDHT},
    355  1.1  skrll @samp{LDOU},
    356  1.1  skrll @samp{LDO},
    357  1.1  skrll @samp{LDSF},
    358  1.1  skrll @samp{LDTU},
    359  1.1  skrll @samp{LDT},
    360  1.1  skrll @samp{LDUNC},
    361  1.1  skrll @samp{LDVTS},
    362  1.1  skrll @samp{LDWU},
    363  1.1  skrll @samp{LDW},
    364  1.1  skrll @samp{PREGO},
    365  1.1  skrll @samp{PRELD},
    366  1.1  skrll @samp{PREST},
    367  1.1  skrll @samp{PUSHGO},
    368  1.1  skrll @samp{STBU},
    369  1.1  skrll @samp{STB},
    370  1.1  skrll @samp{STCO},
    371  1.1  skrll @samp{STHT},
    372  1.1  skrll @samp{STOU},
    373  1.1  skrll @samp{STSF},
    374  1.1  skrll @samp{STTU},
    375  1.1  skrll @samp{STT},
    376  1.1  skrll @samp{STUNC},
    377  1.1  skrll @samp{SYNCD},
    378  1.1  skrll @samp{SYNCID},
    379  1.1  skrll can have a value nearby @anchor{GREG-base}an initial value in place of its
    380  1.1  skrll second and third operands.  Here, ``nearby'' is defined as within the
    381  1.1  skrll range 0@dots{}255 from the initial value of such an allocated register.
    382  1.1  skrll 
    383  1.1  skrll @smallexample
    384  1.1  skrll buffer1 BYTE 0,0,0,0,0
    385  1.1  skrll buffer2 BYTE 0,0,0,0,0
    386  1.1  skrll  @dots{}
    387  1.1  skrll  GREG buffer1
    388  1.1  skrll  LDOU $42,buffer2
    389  1.1  skrll @end smallexample
    390  1.1  skrll In the example above, the @samp{Y} field of the @code{LDOUI} instruction
    391  1.1  skrll (LDOU with a constant Z) will be replaced with the global register
    392  1.1  skrll allocated for @samp{buffer1}, and the @samp{Z} field will have the value
    393  1.1  skrll 5, the offset from @samp{buffer1} to @samp{buffer2}.  The result is
    394  1.1  skrll equivalent to this code:
    395  1.1  skrll @smallexample
    396  1.1  skrll buffer1 BYTE 0,0,0,0,0
    397  1.1  skrll buffer2 BYTE 0,0,0,0,0
    398  1.1  skrll  @dots{}
    399  1.1  skrll tmpreg GREG buffer1
    400  1.1  skrll  LDOU $42,tmpreg,(buffer2-buffer1)
    401  1.1  skrll @end smallexample
    402  1.1  skrll 
    403  1.1  skrll Global registers allocated with this directive are allocated in order
    404  1.1  skrll higher-to-lower within a file.  Other than that, the exact order of
    405  1.1  skrll register allocation and elimination is undefined.  For example, the order
    406  1.1  skrll is undefined when more than one file with such directives are linked
    407  1.1  skrll together.  With the options @samp{-x} and @samp{--linker-allocated-gregs},
    408  1.1  skrll @samp{GREG} directives for two-operand cases like the one mentioned above
    409  1.1  skrll can be omitted.  Sufficient global registers will then be allocated by the
    410  1.1  skrll linker.
    411  1.1  skrll 
    412  1.1  skrll @item BYTE
    413  1.1  skrll @cindex assembler directive BYTE, MMIX
    414  1.1  skrll @cindex pseudo-op BYTE, MMIX
    415  1.1  skrll @cindex MMIX assembler directive BYTE
    416  1.1  skrll @cindex MMIX pseudo-op BYTE
    417  1.1  skrll 
    418  1.1  skrll @anchor{MMIX-byte}
    419  1.1  skrll The @samp{BYTE} directive takes a series of operands separated by a comma.
    420  1.1  skrll If an operand is a string (@pxref{Strings}), each character of that string
    421  1.1  skrll is emitted as a byte.  Other operands must be constant expressions without
    422  1.1  skrll forward references, in the range 0@dots{}255.  If you need operands having
    423  1.1  skrll expressions with forward references, use @samp{.byte} (@pxref{Byte}).  An
    424  1.1  skrll operand can be omitted, defaulting to a zero value.
    425  1.1  skrll 
    426  1.1  skrll @item WYDE
    427  1.1  skrll @itemx TETRA
    428  1.1  skrll @itemx OCTA
    429  1.1  skrll @cindex assembler directive WYDE, MMIX
    430  1.1  skrll @cindex pseudo-op WYDE, MMIX
    431  1.1  skrll @cindex MMIX assembler directive WYDE
    432  1.1  skrll @cindex MMIX pseudo-op WYDE
    433  1.1  skrll @cindex assembler directive TETRA, MMIX
    434  1.1  skrll @cindex pseudo-op TETRA, MMIX
    435  1.1  skrll @cindex MMIX assembler directive TETRA
    436  1.1  skrll @cindex MMIX pseudo-op TETRA
    437  1.1  skrll @cindex assembler directive OCTA, MMIX
    438  1.1  skrll @cindex pseudo-op OCTA, MMIX
    439  1.1  skrll @cindex MMIX assembler directive OCTA
    440  1.1  skrll @cindex MMIX pseudo-op OCTA
    441  1.1  skrll 
    442  1.1  skrll @anchor{MMIX-constants}
    443  1.1  skrll The directives @samp{WYDE}, @samp{TETRA} and @samp{OCTA} emit constants of
    444  1.1  skrll two, four and eight bytes size respectively.  Before anything else happens
    445  1.1  skrll for the directive, the current location is aligned to the respective
    446  1.1  skrll constant-size boundary.  If a label is defined at the beginning of the
    447  1.1  skrll line, its value will be that after the alignment.  A single operand can be
    448  1.1  skrll omitted, defaulting to a zero value emitted for the directive.  Operands
    449  1.1  skrll can be expressed as strings (@pxref{Strings}), in which case each
    450  1.1  skrll character in the string is emitted as a separate constant of the size
    451  1.1  skrll indicated by the directive.
    452  1.1  skrll 
    453  1.1  skrll @item PREFIX
    454  1.1  skrll @cindex assembler directive PREFIX, MMIX
    455  1.1  skrll @cindex pseudo-op PREFIX, MMIX
    456  1.1  skrll @cindex MMIX assembler directive PREFIX
    457  1.1  skrll @cindex MMIX pseudo-op PREFIX
    458  1.1  skrll 
    459  1.1  skrll @anchor{MMIX-prefix}
    460  1.1  skrll The @samp{PREFIX} directive sets a symbol name prefix to be prepended to
    461  1.1  skrll all symbols (except local symbols, @pxref{MMIX-Symbols}), that are not
    462  1.1  skrll prefixed with @samp{:}, until the next @samp{PREFIX} directive.  Such
    463  1.1  skrll prefixes accumulate.  For example,
    464  1.1  skrll @smallexample
    465  1.1  skrll  PREFIX a
    466  1.1  skrll  PREFIX b
    467  1.1  skrll c IS 0
    468  1.1  skrll @end smallexample
    469  1.1  skrll defines a symbol @samp{abc} with the value 0.
    470  1.1  skrll 
    471  1.1  skrll @item BSPEC
    472  1.1  skrll @itemx ESPEC
    473  1.1  skrll @cindex assembler directive BSPEC, MMIX
    474  1.1  skrll @cindex pseudo-op BSPEC, MMIX
    475  1.1  skrll @cindex MMIX assembler directive BSPEC
    476  1.1  skrll @cindex MMIX pseudo-op BSPEC
    477  1.1  skrll @cindex assembler directive ESPEC, MMIX
    478  1.1  skrll @cindex pseudo-op ESPEC, MMIX
    479  1.1  skrll @cindex MMIX assembler directive ESPEC
    480  1.1  skrll @cindex MMIX pseudo-op ESPEC
    481  1.1  skrll 
    482  1.1  skrll @anchor{MMIX-spec}
    483  1.1  skrll A pair of @samp{BSPEC} and @samp{ESPEC} directives delimit a section of
    484  1.1  skrll special contents (without specified semantics).  Example:
    485  1.1  skrll @smallexample
    486  1.1  skrll  BSPEC 42
    487  1.1  skrll  TETRA 1,2,3
    488  1.1  skrll  ESPEC
    489  1.1  skrll @end smallexample
    490  1.1  skrll The single operand to @samp{BSPEC} must be number in the range
    491  1.1  skrll 0@dots{}255.  The @samp{BSPEC} number 80 is used by the GNU binutils
    492  1.1  skrll implementation.
    493  1.1  skrll @end table
    494  1.1  skrll 
    495  1.1  skrll @node MMIX-mmixal
    496  1.1  skrll @section Differences to @code{mmixal}
    497  1.1  skrll @cindex mmixal differences
    498  1.1  skrll @cindex differences, mmixal
    499  1.1  skrll 
    500  1.1  skrll The binutils @code{@value{AS}} and @code{@value{LD}} combination has a few
    501  1.1  skrll differences in function compared to @code{mmixal} (@pxref{mmixsite}).
    502  1.1  skrll 
    503  1.1  skrll The replacement of a symbol with a GREG-allocated register
    504  1.1  skrll (@pxref{GREG-base}) is not handled the exactly same way in
    505  1.1  skrll @code{@value{AS}} as in @code{mmixal}.  This is apparent in the
    506  1.1  skrll @code{mmixal} example file @code{inout.mms}, where different registers
    507  1.1  skrll with different offsets, eventually yielding the same address, are used in
    508  1.1  skrll the first instruction.  This type of difference should however not affect
    509  1.1  skrll the function of any program unless it has specific assumptions about the
    510  1.1  skrll allocated register number.
    511  1.1  skrll 
    512  1.1  skrll Line numbers (in the @samp{mmo} object format) are currently not
    513  1.1  skrll supported.
    514  1.1  skrll 
    515  1.1  skrll Expression operator precedence is not that of mmixal: operator precedence
    516  1.1  skrll is that of the C programming language.  It's recommended to use
    517  1.1  skrll parentheses to explicitly specify wanted operator precedence whenever more
    518  1.1  skrll than one type of operators are used.
    519  1.1  skrll 
    520  1.1  skrll The serialize unary operator @code{&}, the fractional division operator
    521  1.1  skrll @samp{//}, the logical not operator @code{!} and the modulus operator
    522  1.1  skrll @samp{%} are not available.
    523  1.1  skrll 
    524  1.1  skrll Symbols are not global by default, unless the option
    525  1.1  skrll @samp{--globalize-symbols} is passed.  Use the @samp{.global} directive to
    526  1.1  skrll globalize symbols (@pxref{Global}).
    527  1.1  skrll 
    528  1.1  skrll Operand syntax is a bit stricter with @code{@value{AS}} than
    529  1.1  skrll @code{mmixal}.  For example, you can't say @code{addu 1,2,3}, instead you
    530  1.1  skrll must write @code{addu $1,$2,3}.
    531  1.1  skrll 
    532  1.1  skrll You can't LOC to a lower address than those already visited
    533  1.1  skrll (i.e., ``backwards'').
    534  1.1  skrll 
    535  1.1  skrll A LOC directive must come before any emitted code.
    536  1.1  skrll 
    537  1.1  skrll Predefined symbols are visible as file-local symbols after use.  (In the
    538  1.1  skrll ELF file, that is---the linked mmo file has no notion of a file-local
    539  1.1  skrll symbol.)
    540  1.1  skrll 
    541  1.1  skrll Some mapping of constant expressions to sections in LOC expressions is
    542  1.1  skrll attempted, but that functionality is easily confused and should be avoided
    543  1.1  skrll unless compatibility with @code{mmixal} is required.  A LOC expression to
    544  1.1  skrll @samp{0x2000000000000000} or higher, maps to the @samp{.data} section and
    545  1.1  skrll lower addresses map to the @samp{.text} section (@pxref{MMIX-loc}).
    546  1.1  skrll 
    547  1.1  skrll The code and data areas are each contiguous.  Sparse programs with
    548  1.1  skrll far-away LOC directives will take up the same amount of space as a
    549  1.1  skrll contiguous program with zeros filled in the gaps between the LOC
    550  1.1  skrll directives.  If you need sparse programs, you might try and get the wanted
    551  1.1  skrll effect with a linker script and splitting up the code parts into sections
    552  1.1  skrll (@pxref{Section}).  Assembly code for this, to be compatible with
    553  1.1  skrll @code{mmixal}, would look something like:
    554  1.1  skrll @smallexample
    555  1.1  skrll  .if 0
    556  1.1  skrll  LOC away_expression
    557  1.1  skrll  .else
    558  1.1  skrll  .section away,"ax"
    559  1.1  skrll  .fi
    560  1.1  skrll @end smallexample
    561  1.1  skrll @code{@value{AS}} will not execute the LOC directive and @code{mmixal}
    562  1.1  skrll ignores the lines with @code{.}.  This construct can be used generally to
    563  1.1  skrll help compatibility.
    564  1.1  skrll 
    565  1.1  skrll Symbols can't be defined twice--not even to the same value.
    566  1.1  skrll 
    567  1.1  skrll Instruction mnemonics are recognized case-insensitive, though the
    568  1.1  skrll @samp{IS} and @samp{GREG} pseudo-operations must be specified in
    569  1.1  skrll upper-case characters.
    570  1.1  skrll 
    571  1.1  skrll There's no unicode support.
    572  1.1  skrll 
    573  1.1  skrll The following is a list of programs in @samp{mmix.tar.gz}, available at
    574  1.1  skrll @url{http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html}, last
    575  1.1  skrll checked with the version dated 2001-08-25 (md5sum
    576  1.1  skrll c393470cfc86fac040487d22d2bf0172) that assemble with @code{mmixal} but do
    577  1.1  skrll not assemble with @code{@value{AS}}:
    578  1.1  skrll 
    579  1.1  skrll @table @code
    580  1.1  skrll @item silly.mms
    581  1.1  skrll LOC to a previous address.
    582  1.1  skrll @item sim.mms
    583  1.1  skrll Redefines symbol @samp{Done}.
    584  1.1  skrll @item test.mms
    585  1.1  skrll Uses the serial operator @samp{&}.
    586  1.1  skrll @end table
    587