c-mmix.texi 23 KB

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