1 | This is as.info, produced by makeinfo version 4.3 from as.texinfo.
|
---|
2 |
|
---|
3 | START-INFO-DIR-ENTRY
|
---|
4 | * As: (as). The GNU assembler.
|
---|
5 | * Gas: (as). The GNU assembler.
|
---|
6 | END-INFO-DIR-ENTRY
|
---|
7 |
|
---|
8 | This file documents the GNU Assembler "as".
|
---|
9 |
|
---|
10 | Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002
|
---|
11 | Free Software Foundation, Inc.
|
---|
12 |
|
---|
13 | Permission is granted to copy, distribute and/or modify this document
|
---|
14 | under the terms of the GNU Free Documentation License, Version 1.1 or
|
---|
15 | any later version published by the Free Software Foundation; with no
|
---|
16 | Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
---|
17 | Texts. A copy of the license is included in the section entitled "GNU
|
---|
18 | Free Documentation License".
|
---|
19 |
|
---|
20 |
|
---|
21 | File: as.info, Node: MIPS ISA, Next: MIPS autoextend, Prev: MIPS Stabs, Up: MIPS-Dependent
|
---|
22 |
|
---|
23 | Directives to override the ISA level
|
---|
24 | ------------------------------------
|
---|
25 |
|
---|
26 | GNU `as' supports an additional directive to change the MIPS
|
---|
27 | Instruction Set Architecture level on the fly: `.set mipsN'. N should
|
---|
28 | be a number from 0 to 5, or 32, 32r2, or 64. The values other than 0
|
---|
29 | make the assembler accept instructions for the corresponding ISA level,
|
---|
30 | from that point on in the assembly. `.set mipsN' affects not only
|
---|
31 | which instructions are permitted, but also how certain macros are
|
---|
32 | expanded. `.set mips0' restores the ISA level to its original level:
|
---|
33 | either the level you selected with command line options, or the default
|
---|
34 | for your configuration. You can use this feature to permit specific
|
---|
35 | R4000 instructions while assembling in 32 bit mode. Use this directive
|
---|
36 | with care!
|
---|
37 |
|
---|
38 | The directive `.set mips16' puts the assembler into MIPS 16 mode, in
|
---|
39 | which it will assemble instructions for the MIPS 16 processor. Use
|
---|
40 | `.set nomips16' to return to normal 32 bit mode.
|
---|
41 |
|
---|
42 | Traditional MIPS assemblers do not support this directive.
|
---|
43 |
|
---|
44 |
|
---|
45 | File: as.info, Node: MIPS autoextend, Next: MIPS insn, Prev: MIPS ISA, Up: MIPS-Dependent
|
---|
46 |
|
---|
47 | Directives for extending MIPS 16 bit instructions
|
---|
48 | -------------------------------------------------
|
---|
49 |
|
---|
50 | By default, MIPS 16 instructions are automatically extended to 32
|
---|
51 | bits when necessary. The directive `.set noautoextend' will turn this
|
---|
52 | off. When `.set noautoextend' is in effect, any 32 bit instruction
|
---|
53 | must be explicitly extended with the `.e' modifier (e.g., `li.e
|
---|
54 | $4,1000'). The directive `.set autoextend' may be used to once again
|
---|
55 | automatically extend instructions when necessary.
|
---|
56 |
|
---|
57 | This directive is only meaningful when in MIPS 16 mode. Traditional
|
---|
58 | MIPS assemblers do not support this directive.
|
---|
59 |
|
---|
60 |
|
---|
61 | File: as.info, Node: MIPS insn, Next: MIPS option stack, Prev: MIPS autoextend, Up: MIPS-Dependent
|
---|
62 |
|
---|
63 | Directive to mark data as an instruction
|
---|
64 | ----------------------------------------
|
---|
65 |
|
---|
66 | The `.insn' directive tells `as' that the following data is actually
|
---|
67 | instructions. This makes a difference in MIPS 16 mode: when loading
|
---|
68 | the address of a label which precedes instructions, `as' automatically
|
---|
69 | adds 1 to the value, so that jumping to the loaded address will do the
|
---|
70 | right thing.
|
---|
71 |
|
---|
72 |
|
---|
73 | File: as.info, Node: MIPS option stack, Next: MIPS ASE instruction generation overrides, Prev: MIPS insn, Up: MIPS-Dependent
|
---|
74 |
|
---|
75 | Directives to save and restore options
|
---|
76 | --------------------------------------
|
---|
77 |
|
---|
78 | The directives `.set push' and `.set pop' may be used to save and
|
---|
79 | restore the current settings for all the options which are controlled
|
---|
80 | by `.set'. The `.set push' directive saves the current settings on a
|
---|
81 | stack. The `.set pop' directive pops the stack and restores the
|
---|
82 | settings.
|
---|
83 |
|
---|
84 | These directives can be useful inside an macro which must change an
|
---|
85 | option such as the ISA level or instruction reordering but does not want
|
---|
86 | to change the state of the code which invoked the macro.
|
---|
87 |
|
---|
88 | Traditional MIPS assemblers do not support these directives.
|
---|
89 |
|
---|
90 |
|
---|
91 | File: as.info, Node: MIPS ASE instruction generation overrides, Prev: MIPS option stack, Up: MIPS-Dependent
|
---|
92 |
|
---|
93 | Directives to control generation of MIPS ASE instructions
|
---|
94 | ---------------------------------------------------------
|
---|
95 |
|
---|
96 | The directive `.set mips3d' makes the assembler accept instructions
|
---|
97 | from the MIPS-3D Application Specific Extension from that point on in
|
---|
98 | the assembly. The `.set nomips3d' directive prevents MIPS-3D
|
---|
99 | instructions from being accepted.
|
---|
100 |
|
---|
101 | The directive `.set mdmx' makes the assembler accept instructions
|
---|
102 | from the MDMX Application Specific Extension from that point on in the
|
---|
103 | assembly. The `.set nomdmx' directive prevents MDMX instructions from
|
---|
104 | being accepted.
|
---|
105 |
|
---|
106 | Traditional MIPS assemblers do not support these directives.
|
---|
107 |
|
---|
108 |
|
---|
109 | File: as.info, Node: MMIX-Dependent, Next: MSP430-Dependent, Prev: MIPS-Dependent, Up: Machine Dependencies
|
---|
110 |
|
---|
111 | MMIX Dependent Features
|
---|
112 | =======================
|
---|
113 |
|
---|
114 | * Menu:
|
---|
115 |
|
---|
116 | * MMIX-Opts:: Command-line Options
|
---|
117 | * MMIX-Expand:: Instruction expansion
|
---|
118 | * MMIX-Syntax:: Syntax
|
---|
119 | * MMIX-mmixal:: Differences to `mmixal' syntax and semantics
|
---|
120 |
|
---|
121 |
|
---|
122 | File: as.info, Node: MMIX-Opts, Next: MMIX-Expand, Up: MMIX-Dependent
|
---|
123 |
|
---|
124 | Command-line Options
|
---|
125 | --------------------
|
---|
126 |
|
---|
127 | The MMIX version of `as' has some machine-dependent options.
|
---|
128 |
|
---|
129 | When `--fixed-special-register-names' is specified, only the register
|
---|
130 | names specified in *Note MMIX-Regs:: are recognized in the instructions
|
---|
131 | `PUT' and `GET'.
|
---|
132 |
|
---|
133 | You can use the `--globalize-symbols' to make all symbols global.
|
---|
134 | This option is useful when splitting up a `mmixal' program into several
|
---|
135 | files.
|
---|
136 |
|
---|
137 | The `--gnu-syntax' turns off most syntax compatibility with
|
---|
138 | `mmixal'. Its usability is currently doubtful.
|
---|
139 |
|
---|
140 | The `--relax' option is not fully supported, but will eventually make
|
---|
141 | the object file prepared for linker relaxation.
|
---|
142 |
|
---|
143 | If you want to avoid inadvertently calling a predefined symbol and
|
---|
144 | would rather get an error, for example when using `as' with a compiler
|
---|
145 | or other machine-generated code, specify `--no-predefined-syms'. This
|
---|
146 | turns off built-in predefined definitions of all such symbols,
|
---|
147 | including rounding-mode symbols, segment symbols, `BIT' symbols, and
|
---|
148 | `TRAP' symbols used in `mmix' "system calls". It also turns off
|
---|
149 | predefined special-register names, except when used in `PUT' and `GET'
|
---|
150 | instructions.
|
---|
151 |
|
---|
152 | By default, some instructions are expanded to fit the size of the
|
---|
153 | operand or an external symbol (*note MMIX-Expand::). By passing
|
---|
154 | `--no-expand', no such expansion will be done, instead causing errors
|
---|
155 | at link time if the operand does not fit.
|
---|
156 |
|
---|
157 | The `mmixal' documentation (*note mmixsite::) specifies that global
|
---|
158 | registers allocated with the `GREG' directive (*note MMIX-greg::) and
|
---|
159 | initialized to the same non-zero value, will refer to the same global
|
---|
160 | register. This isn't strictly enforceable in `as' since the final
|
---|
161 | addresses aren't known until link-time, but it will do an effort unless
|
---|
162 | the `--no-merge-gregs' option is specified. (Register merging isn't
|
---|
163 | yet implemented in `ld'.)
|
---|
164 |
|
---|
165 | `as' will warn every time it expands an instruction to fit an
|
---|
166 | operand unless the option `-x' is specified. It is believed that this
|
---|
167 | behaviour is more useful than just mimicking `mmixal''s behaviour, in
|
---|
168 | which instructions are only expanded if the `-x' option is specified,
|
---|
169 | and assembly fails otherwise, when an instruction needs to be expanded.
|
---|
170 | It needs to be kept in mind that `mmixal' is both an assembler and
|
---|
171 | linker, while `as' will expand instructions that at link stage can be
|
---|
172 | contracted. (Though linker relaxation isn't yet implemented in `ld'.)
|
---|
173 | The option `-x' also imples `--linker-allocated-gregs'.
|
---|
174 |
|
---|
175 | Usually a two-operand-expression (*note GREG-base::) without a
|
---|
176 | matching `GREG' directive is treated as an error by `as'. When the
|
---|
177 | option `--linker-allocated-gregs' is in effect, they are instead passed
|
---|
178 | through to the linker, which will allocate as many global registers as
|
---|
179 | is needed.
|
---|
180 |
|
---|
181 |
|
---|
182 | File: as.info, Node: MMIX-Expand, Next: MMIX-Syntax, Prev: MMIX-Opts, Up: MMIX-Dependent
|
---|
183 |
|
---|
184 | Instruction expansion
|
---|
185 | ---------------------
|
---|
186 |
|
---|
187 | When `as' encounters an instruction with an operand that is either
|
---|
188 | not known or does not fit the operand size of the instruction, `as'
|
---|
189 | (and `ld') will expand the instruction into a sequence of instructions
|
---|
190 | semantically equivalent to the operand fitting the instruction.
|
---|
191 | Expansion will take place for the following instructions:
|
---|
192 |
|
---|
193 | `GETA'
|
---|
194 | Expands to a sequence of four instructions: `SETL', `INCML',
|
---|
195 | `INCMH' and `INCH'. The operand must be a multiple of four.
|
---|
196 |
|
---|
197 | Conditional branches
|
---|
198 | A branch instruction is turned into a branch with the complemented
|
---|
199 | condition and prediction bit over five instructions; four
|
---|
200 | instructions setting `$255' to the operand value, which like with
|
---|
201 | `GETA' must be a multiple of four, and a final `GO $255,$255,0'.
|
---|
202 |
|
---|
203 | `PUSHJ'
|
---|
204 | Similar to expansion for conditional branches; four instructions
|
---|
205 | set `$255' to the operand value, followed by a `PUSHGO
|
---|
206 | $255,$255,0'.
|
---|
207 |
|
---|
208 | `JMP'
|
---|
209 | Similar to conditional branches and `PUSHJ'. The final instruction
|
---|
210 | is `GO $255,$255,0'.
|
---|
211 |
|
---|
212 | The linker `ld' is expected to shrink these expansions for code
|
---|
213 | assembled with `--relax' (though not currently implemented).
|
---|
214 |
|
---|
215 |
|
---|
216 | File: as.info, Node: MMIX-Syntax, Next: MMIX-mmixal, Prev: MMIX-Expand, Up: MMIX-Dependent
|
---|
217 |
|
---|
218 | Syntax
|
---|
219 | ------
|
---|
220 |
|
---|
221 | The assembly syntax is supposed to be upward compatible with that
|
---|
222 | described in Sections 1.3 and 1.4 of `The Art of Computer Programming,
|
---|
223 | Volume 1'. Draft versions of those chapters as well as other MMIX
|
---|
224 | information is located at
|
---|
225 | <http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html>. Most code
|
---|
226 | examples from the mmixal package located there should work unmodified
|
---|
227 | when assembled and linked as single files, with a few noteworthy
|
---|
228 | exceptions (*note MMIX-mmixal::).
|
---|
229 |
|
---|
230 | Before an instruction is emitted, the current location is aligned to
|
---|
231 | the next four-byte boundary. If a label is defined at the beginning of
|
---|
232 | the line, its value will be the aligned value.
|
---|
233 |
|
---|
234 | In addition to the traditional hex-prefix `0x', a hexadecimal number
|
---|
235 | can also be specified by the prefix character `#'.
|
---|
236 |
|
---|
237 | After all operands to an MMIX instruction or directive have been
|
---|
238 | specified, the rest of the line is ignored, treated as a comment.
|
---|
239 |
|
---|
240 | * Menu:
|
---|
241 |
|
---|
242 | * MMIX-Chars:: Special Characters
|
---|
243 | * MMIX-Symbols:: Symbols
|
---|
244 | * MMIX-Regs:: Register Names
|
---|
245 | * MMIX-Pseudos:: Assembler Directives
|
---|
246 |
|
---|
247 |
|
---|
248 | File: as.info, Node: MMIX-Chars, Next: MMIX-Symbols, Up: MMIX-Syntax
|
---|
249 |
|
---|
250 | Special Characters
|
---|
251 | ..................
|
---|
252 |
|
---|
253 | The characters `*' and `#' are line comment characters; each start a
|
---|
254 | comment at the beginning of a line, but only at the beginning of a
|
---|
255 | line. A `#' prefixes a hexadecimal number if found elsewhere on a line.
|
---|
256 |
|
---|
257 | Two other characters, `%' and `!', each start a comment anywhere on
|
---|
258 | the line. Thus you can't use the `modulus' and `not' operators in
|
---|
259 | expressions normally associated with these two characters.
|
---|
260 |
|
---|
261 | A `;' is a line separator, treated as a new-line, so separate
|
---|
262 | instructions can be specified on a single line.
|
---|
263 |
|
---|
264 |
|
---|
265 | File: as.info, Node: MMIX-Symbols, Next: MMIX-Regs, Prev: MMIX-Chars, Up: MMIX-Syntax
|
---|
266 |
|
---|
267 | Symbols
|
---|
268 | .......
|
---|
269 |
|
---|
270 | The character `:' is permitted in identifiers. There are two
|
---|
271 | exceptions to it being treated as any other symbol character: if a
|
---|
272 | symbol begins with `:', it means that the symbol is in the global
|
---|
273 | namespace and that the current prefix should not be prepended to that
|
---|
274 | symbol (*note MMIX-prefix::). The `:' is then not considered part of
|
---|
275 | the symbol. For a symbol in the label position (first on a line), a `:'
|
---|
276 | at the end of a symbol is silently stripped off. A label is permitted,
|
---|
277 | but not required, to be followed by a `:', as with many other assembly
|
---|
278 | formats.
|
---|
279 |
|
---|
280 | The character `@' in an expression, is a synonym for `.', the
|
---|
281 | current location.
|
---|
282 |
|
---|
283 | In addition to the common forward and backward local symbol formats
|
---|
284 | (*note Symbol Names::), they can be specified with upper-case `B' and
|
---|
285 | `F', as in `8B' and `9F'. A local label defined for the current
|
---|
286 | position is written with a `H' appended to the number:
|
---|
287 | 3H LDB $0,$1,2
|
---|
288 | This and traditional local-label formats cannot be mixed: a label
|
---|
289 | must be defined and referred to using the same format.
|
---|
290 |
|
---|
291 | There's a minor caveat: just as for the ordinary local symbols, the
|
---|
292 | local symbols are translated into ordinary symbols using control
|
---|
293 | characters are to hide the ordinal number of the symbol.
|
---|
294 | Unfortunately, these symbols are not translated back in error messages.
|
---|
295 | Thus you may see confusing error messages when local symbols are used.
|
---|
296 | Control characters `\003' (control-C) and `\004' (control-D) are used
|
---|
297 | for the MMIX-specific local-symbol syntax.
|
---|
298 |
|
---|
299 | The symbol `Main' is handled specially; it is always global.
|
---|
300 |
|
---|
301 | By defining the symbols `__.MMIX.start..text' and
|
---|
302 | `__.MMIX.start..data', the address of respectively the `.text' and
|
---|
303 | `.data' segments of the final program can be defined, though when
|
---|
304 | linking more than one object file, the code or data in the object file
|
---|
305 | containing the symbol is not guaranteed to be start at that position;
|
---|
306 | just the final executable. *Note MMIX-loc::.
|
---|
307 |
|
---|
308 |
|
---|
309 | File: as.info, Node: MMIX-Regs, Next: MMIX-Pseudos, Prev: MMIX-Symbols, Up: MMIX-Syntax
|
---|
310 |
|
---|
311 | Register names
|
---|
312 | ..............
|
---|
313 |
|
---|
314 | Local and global registers are specified as `$0' to `$255'. The
|
---|
315 | recognized special register names are `rJ', `rA', `rB', `rC', `rD',
|
---|
316 | `rE', `rF', `rG', `rH', `rI', `rK', `rL', `rM', `rN', `rO', `rP', `rQ',
|
---|
317 | `rR', `rS', `rT', `rU', `rV', `rW', `rX', `rY', `rZ', `rBB', `rTT',
|
---|
318 | `rWW', `rXX', `rYY' and `rZZ'. A leading `:' is optional for special
|
---|
319 | register names.
|
---|
320 |
|
---|
321 | Local and global symbols can be equated to register names and used in
|
---|
322 | place of ordinary registers.
|
---|
323 |
|
---|
324 | Similarly for special registers, local and global symbols can be
|
---|
325 | used. Also, symbols equated from numbers and constant expressions are
|
---|
326 | allowed in place of a special register, except when either of the
|
---|
327 | options `--no-predefined-syms' and `--fixed-special-register-names' are
|
---|
328 | specified. Then only the special register names above are allowed for
|
---|
329 | the instructions having a special register operand; `GET' and `PUT'.
|
---|
330 |
|
---|
331 |
|
---|
332 | File: as.info, Node: MMIX-Pseudos, Prev: MMIX-Regs, Up: MMIX-Syntax
|
---|
333 |
|
---|
334 | Assembler Directives
|
---|
335 | ....................
|
---|
336 |
|
---|
337 | `LOC'
|
---|
338 | The `LOC' directive sets the current location to the value of the
|
---|
339 | operand field, which may include changing sections. If the
|
---|
340 | operand is a constant, the section is set to either `.data' if the
|
---|
341 | value is `0x2000000000000000' or larger, else it is set to `.text'.
|
---|
342 | Within a section, the current location may only be changed to
|
---|
343 | monotonically higher addresses. A LOC expression must be a
|
---|
344 | previously defined symbol or a "pure" constant.
|
---|
345 |
|
---|
346 | An example, which sets the label PREV to the current location, and
|
---|
347 | updates the current location to eight bytes forward:
|
---|
348 | prev LOC @+8
|
---|
349 |
|
---|
350 | When a LOC has a constant as its operand, a symbol
|
---|
351 | `__.MMIX.start..text' or `__.MMIX.start..data' is defined
|
---|
352 | depending on the address as mentioned above. Each such symbol is
|
---|
353 | interpreted as special by the linker, locating the section at that
|
---|
354 | address. Note that if multiple files are linked, the first object
|
---|
355 | file with that section will be mapped to that address (not
|
---|
356 | necessarily the file with the LOC definition).
|
---|
357 |
|
---|
358 | `LOCAL'
|
---|
359 | Example:
|
---|
360 | LOCAL external_symbol
|
---|
361 | LOCAL 42
|
---|
362 | .local asymbol
|
---|
363 |
|
---|
364 | This directive-operation generates a link-time assertion that the
|
---|
365 | operand does not correspond to a global register. The operand is
|
---|
366 | an expression that at link-time resolves to a register symbol or a
|
---|
367 | number. A number is treated as the register having that number.
|
---|
368 | There is one restriction on the use of this directive: the
|
---|
369 | pseudo-directive must be placed in a section with contents, code
|
---|
370 | or data.
|
---|
371 |
|
---|
372 | `IS'
|
---|
373 | The `IS' directive:
|
---|
374 | asymbol IS an_expression
|
---|
375 | sets the symbol `asymbol' to `an_expression'. A symbol may not be
|
---|
376 | set more than once using this directive. Local labels may be set
|
---|
377 | using this directive, for example:
|
---|
378 | 5H IS @+4
|
---|
379 |
|
---|
380 | `GREG'
|
---|
381 | This directive reserves a global register, gives it an initial
|
---|
382 | value and optionally gives it a symbolic name. Some examples:
|
---|
383 |
|
---|
384 | areg GREG
|
---|
385 | breg GREG data_value
|
---|
386 | GREG data_buffer
|
---|
387 | .greg creg, another_data_value
|
---|
388 |
|
---|
389 | The symbolic register name can be used in place of a (non-special)
|
---|
390 | register. If a value isn't provided, it defaults to zero. Unless
|
---|
391 | the option `--no-merge-gregs' is specified, non-zero registers
|
---|
392 | allocated with this directive may be eliminated by `as'; another
|
---|
393 | register with the same value used in its place. Any of the
|
---|
394 | instructions `CSWAP', `GO', `LDA', `LDBU', `LDB', `LDHT', `LDOU',
|
---|
395 | `LDO', `LDSF', `LDTU', `LDT', `LDUNC', `LDVTS', `LDWU', `LDW',
|
---|
396 | `PREGO', `PRELD', `PREST', `PUSHGO', `STBU', `STB', `STCO', `STHT',
|
---|
397 | `STOU', `STSF', `STTU', `STT', `STUNC', `SYNCD', `SYNCID', can
|
---|
398 | have a value nearby an initial value in place of its second and
|
---|
399 | third operands. Here, "nearby" is defined as within the range
|
---|
400 | 0...255 from the initial value of such an allocated register.
|
---|
401 |
|
---|
402 | buffer1 BYTE 0,0,0,0,0
|
---|
403 | buffer2 BYTE 0,0,0,0,0
|
---|
404 | ...
|
---|
405 | GREG buffer1
|
---|
406 | LDOU $42,buffer2
|
---|
407 | In the example above, the `Y' field of the `LDOUI' instruction
|
---|
408 | (LDOU with a constant Z) will be replaced with the global register
|
---|
409 | allocated for `buffer1', and the `Z' field will have the value 5,
|
---|
410 | the offset from `buffer1' to `buffer2'. The result is equivalent
|
---|
411 | to this code:
|
---|
412 | buffer1 BYTE 0,0,0,0,0
|
---|
413 | buffer2 BYTE 0,0,0,0,0
|
---|
414 | ...
|
---|
415 | tmpreg GREG buffer1
|
---|
416 | LDOU $42,tmpreg,(buffer2-buffer1)
|
---|
417 |
|
---|
418 | Global registers allocated with this directive are allocated in
|
---|
419 | order higher-to-lower within a file. Other than that, the exact
|
---|
420 | order of register allocation and elimination is undefined. For
|
---|
421 | example, the order is undefined when more than one file with such
|
---|
422 | directives are linked together. With the options `-x' and
|
---|
423 | `--linker-allocated-gregs', `GREG' directives for two-operand
|
---|
424 | cases like the one mentioned above can be omitted. Sufficient
|
---|
425 | global registers will then be allocated by the linker.
|
---|
426 |
|
---|
427 | `BYTE'
|
---|
428 | The `BYTE' directive takes a series of operands separated by a
|
---|
429 | comma. If an operand is a string (*note Strings::), each
|
---|
430 | character of that string is emitted as a byte. Other operands
|
---|
431 | must be constant expressions without forward references, in the
|
---|
432 | range 0...255. If you need operands having expressions with
|
---|
433 | forward references, use `.byte' (*note Byte::). An operand can be
|
---|
434 | omitted, defaulting to a zero value.
|
---|
435 |
|
---|
436 | `WYDE'
|
---|
437 | `TETRA'
|
---|
438 | `OCTA'
|
---|
439 | The directives `WYDE', `TETRA' and `OCTA' emit constants of two,
|
---|
440 | four and eight bytes size respectively. Before anything else
|
---|
441 | happens for the directive, the current location is aligned to the
|
---|
442 | respective constant-size bondary. If a label is defined at the
|
---|
443 | beginning of the line, its value will be that after the alignment.
|
---|
444 | A single operand can be omitted, defaulting to a zero value
|
---|
445 | emitted for the directive. Operands can be expressed as strings
|
---|
446 | (*note Strings::), in which case each character in the string is
|
---|
447 | emitted as a separate constant of the size indicated by the
|
---|
448 | directive.
|
---|
449 |
|
---|
450 | `PREFIX'
|
---|
451 | The `PREFIX' directive sets a symbol name prefix to be prepended to
|
---|
452 | all symbols (except local symbols, *note MMIX-Symbols::), that are
|
---|
453 | not prefixed with `:', until the next `PREFIX' directive. Such
|
---|
454 | prefixes accumulate. For example,
|
---|
455 | PREFIX a
|
---|
456 | PREFIX b
|
---|
457 | c IS 0
|
---|
458 | defines a symbol `abc' with the value 0.
|
---|
459 |
|
---|
460 | `BSPEC'
|
---|
461 | `ESPEC'
|
---|
462 | A pair of `BSPEC' and `ESPEC' directives delimit a section of
|
---|
463 | special contents (without specified semantics). Example:
|
---|
464 | BSPEC 42
|
---|
465 | TETRA 1,2,3
|
---|
466 | ESPEC
|
---|
467 | The single operand to `BSPEC' must be number in the range 0...255.
|
---|
468 | The `BSPEC' number 80 is used by the GNU binutils implementation.
|
---|
469 |
|
---|
470 |
|
---|
471 | File: as.info, Node: MMIX-mmixal, Prev: MMIX-Syntax, Up: MMIX-Dependent
|
---|
472 |
|
---|
473 | Differences to `mmixal'
|
---|
474 | -----------------------
|
---|
475 |
|
---|
476 | The binutils `as' and `ld' combination has a few differences in
|
---|
477 | function compared to `mmixal' (*note mmixsite::).
|
---|
478 |
|
---|
479 | The replacement of a symbol with a GREG-allocated register (*note
|
---|
480 | GREG-base::) is not handled the exactly same way in `as' as in
|
---|
481 | `mmixal'. This is apparent in the `mmixal' example file `inout.mms',
|
---|
482 | where different registers with different offsets, eventually yielding
|
---|
483 | the same address, are used in the first instruction. This type of
|
---|
484 | difference should however not affect the function of any program unless
|
---|
485 | it has specific assumptions about the allocated register number.
|
---|
486 |
|
---|
487 | Line numbers (in the `mmo' object format) are currently not
|
---|
488 | supported.
|
---|
489 |
|
---|
490 | Expression operator precedence is not that of mmixal: operator
|
---|
491 | precedence is that of the C programming language. It's recommended to
|
---|
492 | use parentheses to explicitly specify wanted operator precedence
|
---|
493 | whenever more than one type of operators are used.
|
---|
494 |
|
---|
495 | The serialize unary operator `&', the fractional division operator
|
---|
496 | `//', the logical not operator `!' and the modulus operator `%' are not
|
---|
497 | available.
|
---|
498 |
|
---|
499 | Symbols are not global by default, unless the option
|
---|
500 | `--globalize-symbols' is passed. Use the `.global' directive to
|
---|
501 | globalize symbols (*note Global::).
|
---|
502 |
|
---|
503 | Operand syntax is a bit stricter with `as' than `mmixal'. For
|
---|
504 | example, you can't say `addu 1,2,3', instead you must write `addu
|
---|
505 | $1,$2,3'.
|
---|
506 |
|
---|
507 | You can't LOC to a lower address than those already visited (i.e.
|
---|
508 | "backwards").
|
---|
509 |
|
---|
510 | A LOC directive must come before any emitted code.
|
---|
511 |
|
---|
512 | Predefined symbols are visible as file-local symbols after use. (In
|
---|
513 | the ELF file, that is--the linked mmo file has no notion of a file-local
|
---|
514 | symbol.)
|
---|
515 |
|
---|
516 | Some mapping of constant expressions to sections in LOC expressions
|
---|
517 | is attempted, but that functionality is easily confused and should be
|
---|
518 | avoided unless compatibility with `mmixal' is required. A LOC
|
---|
519 | expression to `0x2000000000000000' or higher, maps to the `.data'
|
---|
520 | section and lower addresses map to the `.text' section (*note
|
---|
521 | MMIX-loc::).
|
---|
522 |
|
---|
523 | The code and data areas are each contiguous. Sparse programs with
|
---|
524 | far-away LOC directives will take up the same amount of space as a
|
---|
525 | contiguous program with zeros filled in the gaps between the LOC
|
---|
526 | directives. If you need sparse programs, you might try and get the
|
---|
527 | wanted effect with a linker script and splitting up the code parts into
|
---|
528 | sections (*note Section::). Assembly code for this, to be compatible
|
---|
529 | with `mmixal', would look something like:
|
---|
530 | .if 0
|
---|
531 | LOC away_expression
|
---|
532 | .else
|
---|
533 | .section away,"ax"
|
---|
534 | .fi
|
---|
535 | `as' will not execute the LOC directive and `mmixal' ignores the
|
---|
536 | lines with `.'. This construct can be used generally to help
|
---|
537 | compatibility.
|
---|
538 |
|
---|
539 | Symbols can't be defined twice-not even to the same value.
|
---|
540 |
|
---|
541 | Instruction mnemonics are recognized case-insensitive, though the
|
---|
542 | `IS' and `GREG' pseudo-operations must be specified in upper-case
|
---|
543 | characters.
|
---|
544 |
|
---|
545 | There's no unicode support.
|
---|
546 |
|
---|
547 | The following is a list of programs in `mmix.tar.gz', available at
|
---|
548 | <http://www-cs-faculty.stanford.edu/~knuth/mmix-news.html>, last
|
---|
549 | checked with the version dated 2001-08-25 (md5sum
|
---|
550 | c393470cfc86fac040487d22d2bf0172) that assemble with `mmixal' but do
|
---|
551 | not assemble with `as':
|
---|
552 |
|
---|
553 | `silly.mms'
|
---|
554 | LOC to a previous address.
|
---|
555 |
|
---|
556 | `sim.mms'
|
---|
557 | Redefines symbol `Done'.
|
---|
558 |
|
---|
559 | `test.mms'
|
---|
560 | Uses the serial operator `&'.
|
---|
561 |
|
---|
562 |
|
---|
563 | File: as.info, Node: MSP430-Dependent, Next: SH-Dependent, Prev: MMIX-Dependent, Up: Machine Dependencies
|
---|
564 |
|
---|
565 | MSP 430 Dependent Features
|
---|
566 | ==========================
|
---|
567 |
|
---|
568 | * Menu:
|
---|
569 |
|
---|
570 | * MSP430 Options:: Options
|
---|
571 | * MSP430 Syntax:: Syntax
|
---|
572 | * MSP430 Floating Point:: Floating Point
|
---|
573 | * MSP430 Directives:: MSP 430 Machine Directives
|
---|
574 | * MSP430 Opcodes:: Opcodes
|
---|
575 |
|
---|
576 |
|
---|
577 | File: as.info, Node: MSP430 Options, Next: MSP430 Syntax, Up: MSP430-Dependent
|
---|
578 |
|
---|
579 | Options
|
---|
580 | -------
|
---|
581 |
|
---|
582 | `as' has only -m flag which selects the mpu arch. Currently has no
|
---|
583 | effect.
|
---|
584 |
|
---|
585 |
|
---|
586 | File: as.info, Node: MSP430 Syntax, Next: MSP430 Floating Point, Prev: MSP430 Options, Up: MSP430-Dependent
|
---|
587 |
|
---|
588 | Syntax
|
---|
589 | ------
|
---|
590 |
|
---|
591 | * Menu:
|
---|
592 |
|
---|
593 | * MSP430-Macros:: Macros
|
---|
594 | * MSP430-Chars:: Special Characters
|
---|
595 | * MSP430-Regs:: Register Names
|
---|
596 | * MSP430-Ext:: Assembler Extensions
|
---|
597 |
|
---|
598 |
|
---|
599 | File: as.info, Node: MSP430-Macros, Next: MSP430-Chars, Up: MSP430 Syntax
|
---|
600 |
|
---|
601 | Macros
|
---|
602 | ......
|
---|
603 |
|
---|
604 | The macro syntax used on the MSP 430 is like that described in the
|
---|
605 | MSP 430 Family Assembler Specification. Normal `as' macros should
|
---|
606 | still work.
|
---|
607 |
|
---|
608 | Additional built-in macros are:
|
---|
609 |
|
---|
610 | `llo(exp)'
|
---|
611 | Extracts least significant word from 32-bit expression 'exp'.
|
---|
612 |
|
---|
613 | `lhi(exp)'
|
---|
614 | Extracts most significant word from 32-bit expression 'exp'.
|
---|
615 |
|
---|
616 | `hlo(exp)'
|
---|
617 | Extracts 3rd word from 64-bit expression 'exp'.
|
---|
618 |
|
---|
619 | `hhi(exp)'
|
---|
620 | Extracts 4rd word from 64-bit expression 'exp'.
|
---|
621 |
|
---|
622 | They normally being used as an immediate source operand.
|
---|
623 | mov #llo(1), r10 ; == mov #1, r10
|
---|
624 | mov #lhi(1), r10 ; == mov #0, r10
|
---|
625 |
|
---|
626 |
|
---|
627 | File: as.info, Node: MSP430-Chars, Next: MSP430-Regs, Prev: MSP430-Macros, Up: MSP430 Syntax
|
---|
628 |
|
---|
629 | Special Characters
|
---|
630 | ..................
|
---|
631 |
|
---|
632 | `;' is the line comment character.
|
---|
633 |
|
---|
634 | The character `$' in jump instructions indicates current location and
|
---|
635 | implemented only for TI syntax compatibility.
|
---|
636 |
|
---|
637 |
|
---|
638 | File: as.info, Node: MSP430-Regs, Next: MSP430-Ext, Prev: MSP430-Chars, Up: MSP430 Syntax
|
---|
639 |
|
---|
640 | Register Names
|
---|
641 | ..............
|
---|
642 |
|
---|
643 | General-purpose registers are represented by predefined symbols of
|
---|
644 | the form `rN' (for global registers), where N represents a number
|
---|
645 | between `0' and `15'. The leading letters may be in either upper or
|
---|
646 | lower case; for example, `r13' and `R7' are both valid register names.
|
---|
647 |
|
---|
648 | Register names `PC', `SP' and `SR' cannot be used as register names
|
---|
649 | and will be treated as variables. Use `r0', `r1', and `r2' instead.
|
---|
650 |
|
---|
651 |
|
---|
652 | File: as.info, Node: MSP430-Ext, Prev: MSP430-Regs, Up: MSP430 Syntax
|
---|
653 |
|
---|
654 | Assembler Extensions
|
---|
655 | ....................
|
---|
656 |
|
---|
657 | `@rN'
|
---|
658 | As destination operand being treated as `0(rn)'
|
---|
659 |
|
---|
660 | `0(rN)'
|
---|
661 | As source operand being treated as `@rn'
|
---|
662 |
|
---|
663 | `jCOND +N'
|
---|
664 | Skips next N bytes followed by jump instruction and equivalent to
|
---|
665 | `jCOND $+N+2'
|
---|
666 |
|
---|
667 |
|
---|
668 | File: as.info, Node: MSP430 Floating Point, Next: MSP430 Directives, Prev: MSP430 Syntax, Up: MSP430-Dependent
|
---|
669 |
|
---|
670 | Floating Point
|
---|
671 | --------------
|
---|
672 |
|
---|
673 | The MSP 430 family uses IEEE 32-bit floating-point numbers.
|
---|
674 |
|
---|
675 |
|
---|
676 | File: as.info, Node: MSP430 Directives, Next: MSP430 Opcodes, Prev: MSP430 Floating Point, Up: MSP430-Dependent
|
---|
677 |
|
---|
678 | MSP 430 Machine Directives
|
---|
679 | --------------------------
|
---|
680 |
|
---|
681 | `.file'
|
---|
682 | This directive is ignored; it is accepted for compatibility with
|
---|
683 | other MSP 430 assemblers.
|
---|
684 |
|
---|
685 | _Warning:_ in other versions of the GNU assembler, `.file' is
|
---|
686 | used for the directive called `.app-file' in the MSP 430
|
---|
687 | support.
|
---|
688 |
|
---|
689 | `.line'
|
---|
690 | This directive is ignored; it is accepted for compatibility with
|
---|
691 | other MSP 430 assemblers.
|
---|
692 |
|
---|
693 | `.arch'
|
---|
694 | Currently this directive is ignored; it is accepted for
|
---|
695 | compatibility with other MSP 430 assemblers.
|
---|
696 |
|
---|
697 |
|
---|
698 | File: as.info, Node: MSP430 Opcodes, Prev: MSP430 Directives, Up: MSP430-Dependent
|
---|
699 |
|
---|
700 | Opcodes
|
---|
701 | -------
|
---|
702 |
|
---|
703 | `as' implements all the standard MSP 430 opcodes. No additional
|
---|
704 | pseudo-instructions are needed on this family.
|
---|
705 |
|
---|
706 | For information on the 430 machine instruction set, see `MSP430
|
---|
707 | User's Manual, document slau049b', Texas Instrument, Inc.
|
---|
708 |
|
---|
709 |
|
---|
710 | File: as.info, Node: PDP-11-Dependent, Next: PJ-Dependent, Prev: SH64-Dependent, Up: Machine Dependencies
|
---|
711 |
|
---|
712 | PDP-11 Dependent Features
|
---|
713 | =========================
|
---|
714 |
|
---|
715 | * Menu:
|
---|
716 |
|
---|
717 | * PDP-11-Options:: Options
|
---|
718 | * PDP-11-Pseudos:: Assembler Directives
|
---|
719 | * PDP-11-Syntax:: DEC Syntax versus BSD Syntax
|
---|
720 | * PDP-11-Mnemonics:: Instruction Naming
|
---|
721 | * PDP-11-Synthetic:: Synthetic Instructions
|
---|
722 |
|
---|
723 |
|
---|
724 | File: as.info, Node: PDP-11-Options, Next: PDP-11-Pseudos, Up: PDP-11-Dependent
|
---|
725 |
|
---|
726 | Options
|
---|
727 | -------
|
---|
728 |
|
---|
729 | The PDP-11 version of `as' has a rich set of machine dependent
|
---|
730 | options.
|
---|
731 |
|
---|
732 | Code Generation Options
|
---|
733 | .......................
|
---|
734 |
|
---|
735 | `-mpic | -mno-pic'
|
---|
736 | Generate position-independent (or position-dependent) code.
|
---|
737 |
|
---|
738 | The default is to generate position-independent code.
|
---|
739 |
|
---|
740 | Instruction Set Extension Options
|
---|
741 | .................................
|
---|
742 |
|
---|
743 | These options enables or disables the use of extensions over the base
|
---|
744 | line instruction set as introduced by the first PDP-11 CPU: the KA11.
|
---|
745 | Most options come in two variants: a `-m'EXTENSION that enables
|
---|
746 | EXTENSION, and a `-mno-'EXTENSION that disables EXTENSION.
|
---|
747 |
|
---|
748 | The default is to enable all extensions.
|
---|
749 |
|
---|
750 | `-mall | -mall-extensions'
|
---|
751 | Enable all instruction set extensions.
|
---|
752 |
|
---|
753 | `-mno-extensions'
|
---|
754 | Disable all instruction set extensions.
|
---|
755 |
|
---|
756 | `-mcis | -mno-cis'
|
---|
757 | Enable (or disable) the use of the commercial instruction set,
|
---|
758 | which consists of these instructions: `ADDNI', `ADDN', `ADDPI',
|
---|
759 | `ADDP', `ASHNI', `ASHN', `ASHPI', `ASHP', `CMPCI', `CMPC',
|
---|
760 | `CMPNI', `CMPN', `CMPPI', `CMPP', `CVTLNI', `CVTLN', `CVTLPI',
|
---|
761 | `CVTLP', `CVTNLI', `CVTNL', `CVTNPI', `CVTNP', `CVTPLI', `CVTPL',
|
---|
762 | `CVTPNI', `CVTPN', `DIVPI', `DIVP', `L2DR', `L3DR', `LOCCI',
|
---|
763 | `LOCC', `MATCI', `MATC', `MOVCI', `MOVC', `MOVRCI', `MOVRC',
|
---|
764 | `MOVTCI', `MOVTC', `MULPI', `MULP', `SCANCI', `SCANC', `SKPCI',
|
---|
765 | `SKPC', `SPANCI', `SPANC', `SUBNI', `SUBN', `SUBPI', and `SUBP'.
|
---|
766 |
|
---|
767 | `-mcsm | -mno-csm'
|
---|
768 | Enable (or disable) the use of the `CSM' instruction.
|
---|
769 |
|
---|
770 | `-meis | -mno-eis'
|
---|
771 | Enable (or disable) the use of the extended instruction set, which
|
---|
772 | consists of these instructions: `ASHC', `ASH', `DIV', `MARK',
|
---|
773 | `MUL', `RTT', `SOB' `SXT', and `XOR'.
|
---|
774 |
|
---|
775 | `-mfis | -mkev11'
|
---|
776 | `-mno-fis | -mno-kev11'
|
---|
777 | Enable (or disable) the use of the KEV11 floating-point
|
---|
778 | instructions: `FADD', `FDIV', `FMUL', and `FSUB'.
|
---|
779 |
|
---|
780 | `-mfpp | -mfpu | -mfp-11'
|
---|
781 | `-mno-fpp | -mno-fpu | -mno-fp-11'
|
---|
782 | Enable (or disable) the use of FP-11 floating-point instructions:
|
---|
783 | `ABSF', `ADDF', `CFCC', `CLRF', `CMPF', `DIVF', `LDCFF', `LDCIF',
|
---|
784 | `LDEXP', `LDF', `LDFPS', `MODF', `MULF', `NEGF', `SETD', `SETF',
|
---|
785 | `SETI', `SETL', `STCFF', `STCFI', `STEXP', `STF', `STFPS', `STST',
|
---|
786 | `SUBF', and `TSTF'.
|
---|
787 |
|
---|
788 | `-mlimited-eis | -mno-limited-eis'
|
---|
789 | Enable (or disable) the use of the limited extended instruction
|
---|
790 | set: `MARK', `RTT', `SOB', `SXT', and `XOR'.
|
---|
791 |
|
---|
792 | The -mno-limited-eis options also implies -mno-eis.
|
---|
793 |
|
---|
794 | `-mmfpt | -mno-mfpt'
|
---|
795 | Enable (or disable) the use of the `MFPT' instruction.
|
---|
796 |
|
---|
797 | `-mmultiproc | -mno-multiproc'
|
---|
798 | Enable (or disable) the use of multiprocessor instructions:
|
---|
799 | `TSTSET' and `WRTLCK'.
|
---|
800 |
|
---|
801 | `-mmxps | -mno-mxps'
|
---|
802 | Enable (or disable) the use of the `MFPS' and `MTPS' instructions.
|
---|
803 |
|
---|
804 | `-mspl | -mno-spl'
|
---|
805 | Enable (or disable) the use of the `SPL' instruction.
|
---|
806 |
|
---|
807 | Enable (or disable) the use of the microcode instructions: `LDUB',
|
---|
808 | `MED', and `XFC'.
|
---|
809 |
|
---|
810 | CPU Model Options
|
---|
811 | .................
|
---|
812 |
|
---|
813 | These options enable the instruction set extensions supported by a
|
---|
814 | particular CPU, and disables all other extensions.
|
---|
815 |
|
---|
816 | `-mka11'
|
---|
817 | KA11 CPU. Base line instruction set only.
|
---|
818 |
|
---|
819 | `-mkb11'
|
---|
820 | KB11 CPU. Enable extended instruction set and `SPL'.
|
---|
821 |
|
---|
822 | `-mkd11a'
|
---|
823 | KD11-A CPU. Enable limited extended instruction set.
|
---|
824 |
|
---|
825 | `-mkd11b'
|
---|
826 | KD11-B CPU. Base line instruction set only.
|
---|
827 |
|
---|
828 | `-mkd11d'
|
---|
829 | KD11-D CPU. Base line instruction set only.
|
---|
830 |
|
---|
831 | `-mkd11e'
|
---|
832 | KD11-E CPU. Enable extended instruction set, `MFPS', and `MTPS'.
|
---|
833 |
|
---|
834 | `-mkd11f | -mkd11h | -mkd11q'
|
---|
835 | KD11-F, KD11-H, or KD11-Q CPU. Enable limited extended
|
---|
836 | instruction set, `MFPS', and `MTPS'.
|
---|
837 |
|
---|
838 | `-mkd11k'
|
---|
839 | KD11-K CPU. Enable extended instruction set, `LDUB', `MED',
|
---|
840 | `MFPS', `MFPT', `MTPS', and `XFC'.
|
---|
841 |
|
---|
842 | `-mkd11z'
|
---|
843 | KD11-Z CPU. Enable extended instruction set, `CSM', `MFPS',
|
---|
844 | `MFPT', `MTPS', and `SPL'.
|
---|
845 |
|
---|
846 | `-mf11'
|
---|
847 | F11 CPU. Enable extended instruction set, `MFPS', `MFPT', and
|
---|
848 | `MTPS'.
|
---|
849 |
|
---|
850 | `-mj11'
|
---|
851 | J11 CPU. Enable extended instruction set, `CSM', `MFPS', `MFPT',
|
---|
852 | `MTPS', `SPL', `TSTSET', and `WRTLCK'.
|
---|
853 |
|
---|
854 | `-mt11'
|
---|
855 | T11 CPU. Enable limited extended instruction set, `MFPS', and
|
---|
856 | `MTPS'.
|
---|
857 |
|
---|
858 | Machine Model Options
|
---|
859 | .....................
|
---|
860 |
|
---|
861 | These options enable the instruction set extensions supported by a
|
---|
862 | particular machine model, and disables all other extensions.
|
---|
863 |
|
---|
864 | `-m11/03'
|
---|
865 | Same as `-mkd11f'.
|
---|
866 |
|
---|
867 | `-m11/04'
|
---|
868 | Same as `-mkd11d'.
|
---|
869 |
|
---|
870 | `-m11/05 | -m11/10'
|
---|
871 | Same as `-mkd11b'.
|
---|
872 |
|
---|
873 | `-m11/15 | -m11/20'
|
---|
874 | Same as `-mka11'.
|
---|
875 |
|
---|
876 | `-m11/21'
|
---|
877 | Same as `-mt11'.
|
---|
878 |
|
---|
879 | `-m11/23 | -m11/24'
|
---|
880 | Same as `-mf11'.
|
---|
881 |
|
---|
882 | `-m11/34'
|
---|
883 | Same as `-mkd11e'.
|
---|
884 |
|
---|
885 | `-m11/34a'
|
---|
886 | Ame as `-mkd11e' `-mfpp'.
|
---|
887 |
|
---|
888 | `-m11/35 | -m11/40'
|
---|
889 | Same as `-mkd11a'.
|
---|
890 |
|
---|
891 | `-m11/44'
|
---|
892 | Same as `-mkd11z'.
|
---|
893 |
|
---|
894 | `-m11/45 | -m11/50 | -m11/55 | -m11/70'
|
---|
895 | Same as `-mkb11'.
|
---|
896 |
|
---|
897 | `-m11/53 | -m11/73 | -m11/83 | -m11/84 | -m11/93 | -m11/94'
|
---|
898 | Same as `-mj11'.
|
---|
899 |
|
---|
900 | `-m11/60'
|
---|
901 | Same as `-mkd11k'.
|
---|
902 |
|
---|
903 |
|
---|
904 | File: as.info, Node: PDP-11-Pseudos, Next: PDP-11-Syntax, Prev: PDP-11-Options, Up: PDP-11-Dependent
|
---|
905 |
|
---|
906 | Assembler Directives
|
---|
907 | --------------------
|
---|
908 |
|
---|
909 | The PDP-11 version of `as' has a few machine dependent assembler
|
---|
910 | directives.
|
---|
911 |
|
---|
912 | `.bss'
|
---|
913 | Switch to the `bss' section.
|
---|
914 |
|
---|
915 | `.even'
|
---|
916 | Align the location counter to an even number.
|
---|
917 |
|
---|
918 |
|
---|
919 | File: as.info, Node: PDP-11-Syntax, Next: PDP-11-Mnemonics, Prev: PDP-11-Pseudos, Up: PDP-11-Dependent
|
---|
920 |
|
---|
921 | PDP-11 Assembly Language Syntax
|
---|
922 | -------------------------------
|
---|
923 |
|
---|
924 | `as' supports both DEC syntax and BSD syntax. The only difference
|
---|
925 | is that in DEC syntax, a `#' character is used to denote an immediate
|
---|
926 | constants, while in BSD syntax the character for this purpose is `$'.
|
---|
927 |
|
---|
928 | eneral-purpose registers are named `r0' through `r7'. Mnemonic
|
---|
929 | alternatives for `r6' and `r7' are `sp' and `pc', respectively.
|
---|
930 |
|
---|
931 | Floating-point registers are named `ac0' through `ac3', or
|
---|
932 | alternatively `fr0' through `fr3'.
|
---|
933 |
|
---|
934 | Comments are started with a `#' or a `/' character, and extend to
|
---|
935 | the end of the line. (FIXME: clash with immediates?)
|
---|
936 |
|
---|
937 |
|
---|
938 | File: as.info, Node: PDP-11-Mnemonics, Next: PDP-11-Synthetic, Prev: PDP-11-Syntax, Up: PDP-11-Dependent
|
---|
939 |
|
---|
940 | Instruction Naming
|
---|
941 | ------------------
|
---|
942 |
|
---|
943 | Some instructions have alternative names.
|
---|
944 |
|
---|
945 | `BCC'
|
---|
946 | `BHIS'
|
---|
947 |
|
---|
948 | `BCS'
|
---|
949 | `BLO'
|
---|
950 |
|
---|
951 | `L2DR'
|
---|
952 | `L2D'
|
---|
953 |
|
---|
954 | `L3DR'
|
---|
955 | `L3D'
|
---|
956 |
|
---|
957 | `SYS'
|
---|
958 | `TRAP'
|
---|
959 |
|
---|
960 |
|
---|
961 | File: as.info, Node: PDP-11-Synthetic, Prev: PDP-11-Mnemonics, Up: PDP-11-Dependent
|
---|
962 |
|
---|
963 | Synthetic Instructions
|
---|
964 | ----------------------
|
---|
965 |
|
---|
966 | The `JBR' and `J'CC synthetic instructions are not supported yet.
|
---|
967 |
|
---|
968 |
|
---|
969 | File: as.info, Node: PJ-Dependent, Next: PPC-Dependent, Prev: PDP-11-Dependent, Up: Machine Dependencies
|
---|
970 |
|
---|
971 | picoJava Dependent Features
|
---|
972 | ===========================
|
---|
973 |
|
---|
974 | * Menu:
|
---|
975 |
|
---|
976 | * PJ Options:: Options
|
---|
977 |
|
---|
978 |
|
---|
979 | File: as.info, Node: PJ Options, Up: PJ-Dependent
|
---|
980 |
|
---|
981 | Options
|
---|
982 | -------
|
---|
983 |
|
---|
984 | `as' has two additional command-line options for the picoJava
|
---|
985 | architecture.
|
---|
986 | `-ml'
|
---|
987 | This option selects little endian data output.
|
---|
988 |
|
---|
989 | `-mb'
|
---|
990 | This option selects big endian data output.
|
---|
991 |
|
---|
992 |
|
---|
993 | File: as.info, Node: PPC-Dependent, Next: Sparc-Dependent, Prev: PJ-Dependent, Up: Machine Dependencies
|
---|
994 |
|
---|
995 | PowerPC Dependent Features
|
---|
996 | ==========================
|
---|
997 |
|
---|
998 | * Menu:
|
---|
999 |
|
---|
1000 | * PowerPC-Opts:: Options
|
---|
1001 |
|
---|
1002 |
|
---|
1003 | File: as.info, Node: PowerPC-Opts, Up: PPC-Dependent
|
---|
1004 |
|
---|
1005 | Options
|
---|
1006 | -------
|
---|
1007 |
|
---|
1008 | The PowerPC chip family includes several successive levels, using
|
---|
1009 | the same core instruction set, but including a few additional
|
---|
1010 | instructions at each level. There are exceptions to this however. For
|
---|
1011 | details on what instructions each variant supports, please see the
|
---|
1012 | chip's architecture reference manual.
|
---|
1013 |
|
---|
1014 | The following table lists all available PowerPC options.
|
---|
1015 |
|
---|
1016 | `-mpwrx | -mpwr2'
|
---|
1017 | Generate code for POWER/2 (RIOS2).
|
---|
1018 |
|
---|
1019 | `-mpwr'
|
---|
1020 | Generate code for POWER (RIOS1)
|
---|
1021 |
|
---|
1022 | `-m601'
|
---|
1023 | Generate code for PowerPC 601.
|
---|
1024 |
|
---|
1025 | `-mppc, -mppc32, -m603, -m604'
|
---|
1026 | Generate code for PowerPC 603/604.
|
---|
1027 |
|
---|
1028 | `-m403, -m405'
|
---|
1029 | Generate code for PowerPC 403/405.
|
---|
1030 |
|
---|
1031 | `-m7400, -m7410, -m7450, -m7455'
|
---|
1032 | Generate code for PowerPC 7400/7410/7450/7455.
|
---|
1033 |
|
---|
1034 | `-mppc64, -m620'
|
---|
1035 | Generate code for PowerPC 620/625/630.
|
---|
1036 |
|
---|
1037 | `-mppc64bridge'
|
---|
1038 | Generate code for PowerPC 64, including bridge insns.
|
---|
1039 |
|
---|
1040 | `-mbooke64'
|
---|
1041 | Generate code for 64-bit BookE.
|
---|
1042 |
|
---|
1043 | `-mbooke, mbooke32'
|
---|
1044 | Generate code for 32-bit BookE.
|
---|
1045 |
|
---|
1046 | `-maltivec'
|
---|
1047 | Generate code for processors with AltiVec instructions.
|
---|
1048 |
|
---|
1049 | `-mpower4'
|
---|
1050 | Generate code for Power4 architecture.
|
---|
1051 |
|
---|
1052 | `-mcom'
|
---|
1053 | Generate code Power/PowerPC common instructions.
|
---|
1054 |
|
---|
1055 | `-many'
|
---|
1056 | Generate code for any architecture (PWR/PWRX/PPC).
|
---|
1057 |
|
---|
1058 | `-mregnames'
|
---|
1059 | Allow symbolic names for registers.
|
---|
1060 |
|
---|
1061 | `-mno-regnames'
|
---|
1062 | Do not allow symbolic names for registers.
|
---|
1063 |
|
---|
1064 | `-mrelocatable'
|
---|
1065 | Support for GCC's -mrelocatble option.
|
---|
1066 |
|
---|
1067 | `-mrelocatable-lib'
|
---|
1068 | Support for GCC's -mrelocatble-lib option.
|
---|
1069 |
|
---|
1070 | `-memb'
|
---|
1071 | Set PPC_EMB bit in ELF flags.
|
---|
1072 |
|
---|
1073 | `-mlittle, -mlittle-endian'
|
---|
1074 | Generate code for a little endian machine.
|
---|
1075 |
|
---|
1076 | `-mbig, -mbig-endian'
|
---|
1077 | Generate code for a big endian machine.
|
---|
1078 |
|
---|
1079 | `-msolaris'
|
---|
1080 | Generate code for Solaris.
|
---|
1081 |
|
---|
1082 | `-mno-solaris'
|
---|
1083 | Do not generate code for Solaris.
|
---|
1084 |
|
---|
1085 |
|
---|
1086 | File: as.info, Node: SH-Dependent, Next: SH64-Dependent, Prev: MSP430-Dependent, Up: Machine Dependencies
|
---|
1087 |
|
---|
1088 | Renesas / SuperH SH Dependent Features
|
---|
1089 | ======================================
|
---|
1090 |
|
---|
1091 | * Menu:
|
---|
1092 |
|
---|
1093 | * SH Options:: Options
|
---|
1094 | * SH Syntax:: Syntax
|
---|
1095 | * SH Floating Point:: Floating Point
|
---|
1096 | * SH Directives:: SH Machine Directives
|
---|
1097 | * SH Opcodes:: Opcodes
|
---|
1098 |
|
---|
1099 |
|
---|
1100 | File: as.info, Node: SH Options, Next: SH Syntax, Up: SH-Dependent
|
---|
1101 |
|
---|
1102 | Options
|
---|
1103 | -------
|
---|
1104 |
|
---|
1105 | `as' has following command-line options for the Renesas (formerly
|
---|
1106 | Hitachi) / SuperH SH family.
|
---|
1107 |
|
---|
1108 | `-little'
|
---|
1109 | Generate little endian code.
|
---|
1110 |
|
---|
1111 | `-big'
|
---|
1112 | Generate big endian code.
|
---|
1113 |
|
---|
1114 | `-relax'
|
---|
1115 | Alter jump instructions for long displacements.
|
---|
1116 |
|
---|
1117 | `-small'
|
---|
1118 | Align sections to 4 byte boundaries, not 16.
|
---|
1119 |
|
---|
1120 | `-dsp'
|
---|
1121 | Enable sh-dsp insns, and disable sh3e / sh4 insns.
|
---|
1122 |
|
---|
1123 |
|
---|
1124 | File: as.info, Node: SH Syntax, Next: SH Floating Point, Prev: SH Options, Up: SH-Dependent
|
---|
1125 |
|
---|
1126 | Syntax
|
---|
1127 | ------
|
---|
1128 |
|
---|
1129 | * Menu:
|
---|
1130 |
|
---|
1131 | * SH-Chars:: Special Characters
|
---|
1132 | * SH-Regs:: Register Names
|
---|
1133 | * SH-Addressing:: Addressing Modes
|
---|
1134 |
|
---|
1135 |
|
---|
1136 | File: as.info, Node: SH-Chars, Next: SH-Regs, Up: SH Syntax
|
---|
1137 |
|
---|
1138 | Special Characters
|
---|
1139 | ..................
|
---|
1140 |
|
---|
1141 | `!' is the line comment character.
|
---|
1142 |
|
---|
1143 | You can use `;' instead of a newline to separate statements.
|
---|
1144 |
|
---|
1145 | Since `$' has no special meaning, you may use it in symbol names.
|
---|
1146 |
|
---|
1147 |
|
---|
1148 | File: as.info, Node: SH-Regs, Next: SH-Addressing, Prev: SH-Chars, Up: SH Syntax
|
---|
1149 |
|
---|
1150 | Register Names
|
---|
1151 | ..............
|
---|
1152 |
|
---|
1153 | You can use the predefined symbols `r0', `r1', `r2', `r3', `r4',
|
---|
1154 | `r5', `r6', `r7', `r8', `r9', `r10', `r11', `r12', `r13', `r14', and
|
---|
1155 | `r15' to refer to the SH registers.
|
---|
1156 |
|
---|
1157 | The SH also has these control registers:
|
---|
1158 |
|
---|
1159 | `pr'
|
---|
1160 | procedure register (holds return address)
|
---|
1161 |
|
---|
1162 | `pc'
|
---|
1163 | program counter
|
---|
1164 |
|
---|
1165 | `mach'
|
---|
1166 | `macl'
|
---|
1167 | high and low multiply accumulator registers
|
---|
1168 |
|
---|
1169 | `sr'
|
---|
1170 | status register
|
---|
1171 |
|
---|
1172 | `gbr'
|
---|
1173 | global base register
|
---|
1174 |
|
---|
1175 | `vbr'
|
---|
1176 | vector base register (for interrupt vectors)
|
---|
1177 |
|
---|
1178 |
|
---|
1179 | File: as.info, Node: SH-Addressing, Prev: SH-Regs, Up: SH Syntax
|
---|
1180 |
|
---|
1181 | Addressing Modes
|
---|
1182 | ................
|
---|
1183 |
|
---|
1184 | `as' understands the following addressing modes for the SH. `RN' in
|
---|
1185 | the following refers to any of the numbered registers, but _not_ the
|
---|
1186 | control registers.
|
---|
1187 |
|
---|
1188 | `RN'
|
---|
1189 | Register direct
|
---|
1190 |
|
---|
1191 | `@RN'
|
---|
1192 | Register indirect
|
---|
1193 |
|
---|
1194 | `@-RN'
|
---|
1195 | Register indirect with pre-decrement
|
---|
1196 |
|
---|
1197 | `@RN+'
|
---|
1198 | Register indirect with post-increment
|
---|
1199 |
|
---|
1200 | `@(DISP, RN)'
|
---|
1201 | Register indirect with displacement
|
---|
1202 |
|
---|
1203 | `@(R0, RN)'
|
---|
1204 | Register indexed
|
---|
1205 |
|
---|
1206 | `@(DISP, GBR)'
|
---|
1207 | `GBR' offset
|
---|
1208 |
|
---|
1209 | `@(R0, GBR)'
|
---|
1210 | GBR indexed
|
---|
1211 |
|
---|
1212 | `ADDR'
|
---|
1213 | `@(DISP, PC)'
|
---|
1214 | PC relative address (for branch or for addressing memory). The
|
---|
1215 | `as' implementation allows you to use the simpler form ADDR
|
---|
1216 | anywhere a PC relative address is called for; the alternate form
|
---|
1217 | is supported for compatibility with other assemblers.
|
---|
1218 |
|
---|
1219 | `#IMM'
|
---|
1220 | Immediate data
|
---|
1221 |
|
---|
1222 |
|
---|
1223 | File: as.info, Node: SH Floating Point, Next: SH Directives, Prev: SH Syntax, Up: SH-Dependent
|
---|
1224 |
|
---|
1225 | Floating Point
|
---|
1226 | --------------
|
---|
1227 |
|
---|
1228 | The SH family has no hardware floating point, but the `.float'
|
---|
1229 | directive generates IEEE floating-point numbers for compatibility with
|
---|
1230 | other development tools.
|
---|
1231 |
|
---|
1232 |
|
---|
1233 | File: as.info, Node: SH Directives, Next: SH Opcodes, Prev: SH Floating Point, Up: SH-Dependent
|
---|
1234 |
|
---|
1235 | SH Machine Directives
|
---|
1236 | ---------------------
|
---|
1237 |
|
---|
1238 | `uaword'
|
---|
1239 | `ualong'
|
---|
1240 | `as' will issue a warning when a misaligned `.word' or `.long'
|
---|
1241 | directive is used. You may use `.uaword' or `.ualong' to indicate
|
---|
1242 | that the value is intentionally misaligned.
|
---|
1243 |
|
---|
1244 |
|
---|
1245 | File: as.info, Node: SH Opcodes, Prev: SH Directives, Up: SH-Dependent
|
---|
1246 |
|
---|
1247 | Opcodes
|
---|
1248 | -------
|
---|
1249 |
|
---|
1250 | For detailed information on the SH machine instruction set, see
|
---|
1251 | `SH-Microcomputer User's Manual' (Renesas) or `SH-4 32-bit CPU Core
|
---|
1252 | Architecture' (SuperH) and `SuperH (SH) 64-Bit RISC Series' (SuperH).
|
---|
1253 |
|
---|
1254 | `as' implements all the standard SH opcodes. No additional
|
---|
1255 | pseudo-instructions are needed on this family. Note, however, that
|
---|
1256 | because `as' supports a simpler form of PC-relative addressing, you may
|
---|
1257 | simply write (for example)
|
---|
1258 |
|
---|
1259 | mov.l bar,r0
|
---|
1260 |
|
---|
1261 | where other assemblers might require an explicit displacement to `bar'
|
---|
1262 | from the program counter:
|
---|
1263 |
|
---|
1264 | mov.l @(DISP, PC)
|
---|
1265 |
|
---|
1266 | Here is a summary of SH opcodes:
|
---|
1267 |
|
---|
1268 | Legend:
|
---|
1269 | Rn a numbered register
|
---|
1270 | Rm another numbered register
|
---|
1271 | #imm immediate data
|
---|
1272 | disp displacement
|
---|
1273 | disp8 8-bit displacement
|
---|
1274 | disp12 12-bit displacement
|
---|
1275 |
|
---|
1276 | add #imm,Rn lds.l @Rn+,PR
|
---|
1277 | add Rm,Rn mac.w @Rm+,@Rn+
|
---|
1278 | addc Rm,Rn mov #imm,Rn
|
---|
1279 | addv Rm,Rn mov Rm,Rn
|
---|
1280 | and #imm,R0 mov.b Rm,@(R0,Rn)
|
---|
1281 | and Rm,Rn mov.b Rm,@-Rn
|
---|
1282 | and.b #imm,@(R0,GBR) mov.b Rm,@Rn
|
---|
1283 | bf disp8 mov.b @(disp,Rm),R0
|
---|
1284 | bra disp12 mov.b @(disp,GBR),R0
|
---|
1285 | bsr disp12 mov.b @(R0,Rm),Rn
|
---|
1286 | bt disp8 mov.b @Rm+,Rn
|
---|
1287 | clrmac mov.b @Rm,Rn
|
---|
1288 | clrt mov.b R0,@(disp,Rm)
|
---|
1289 | cmp/eq #imm,R0 mov.b R0,@(disp,GBR)
|
---|
1290 | cmp/eq Rm,Rn mov.l Rm,@(disp,Rn)
|
---|
1291 | cmp/ge Rm,Rn mov.l Rm,@(R0,Rn)
|
---|
1292 | cmp/gt Rm,Rn mov.l Rm,@-Rn
|
---|
1293 | cmp/hi Rm,Rn mov.l Rm,@Rn
|
---|
1294 | cmp/hs Rm,Rn mov.l @(disp,Rn),Rm
|
---|
1295 | cmp/pl Rn mov.l @(disp,GBR),R0
|
---|
1296 | cmp/pz Rn mov.l @(disp,PC),Rn
|
---|
1297 | cmp/str Rm,Rn mov.l @(R0,Rm),Rn
|
---|
1298 | div0s Rm,Rn mov.l @Rm+,Rn
|
---|
1299 | div0u mov.l @Rm,Rn
|
---|
1300 | div1 Rm,Rn mov.l R0,@(disp,GBR)
|
---|
1301 | exts.b Rm,Rn mov.w Rm,@(R0,Rn)
|
---|
1302 | exts.w Rm,Rn mov.w Rm,@-Rn
|
---|
1303 | extu.b Rm,Rn mov.w Rm,@Rn
|
---|
1304 | extu.w Rm,Rn mov.w @(disp,Rm),R0
|
---|
1305 | jmp @Rn mov.w @(disp,GBR),R0
|
---|
1306 | jsr @Rn mov.w @(disp,PC),Rn
|
---|
1307 | ldc Rn,GBR mov.w @(R0,Rm),Rn
|
---|
1308 | ldc Rn,SR mov.w @Rm+,Rn
|
---|
1309 | ldc Rn,VBR mov.w @Rm,Rn
|
---|
1310 | ldc.l @Rn+,GBR mov.w R0,@(disp,Rm)
|
---|
1311 | ldc.l @Rn+,SR mov.w R0,@(disp,GBR)
|
---|
1312 | ldc.l @Rn+,VBR mova @(disp,PC),R0
|
---|
1313 | lds Rn,MACH movt Rn
|
---|
1314 | lds Rn,MACL muls Rm,Rn
|
---|
1315 | lds Rn,PR mulu Rm,Rn
|
---|
1316 | lds.l @Rn+,MACH neg Rm,Rn
|
---|
1317 | lds.l @Rn+,MACL negc Rm,Rn
|
---|
1318 |
|
---|
1319 | nop stc VBR,Rn
|
---|
1320 | not Rm,Rn stc.l GBR,@-Rn
|
---|
1321 | or #imm,R0 stc.l SR,@-Rn
|
---|
1322 | or Rm,Rn stc.l VBR,@-Rn
|
---|
1323 | or.b #imm,@(R0,GBR) sts MACH,Rn
|
---|
1324 | rotcl Rn sts MACL,Rn
|
---|
1325 | rotcr Rn sts PR,Rn
|
---|
1326 | rotl Rn sts.l MACH,@-Rn
|
---|
1327 | rotr Rn sts.l MACL,@-Rn
|
---|
1328 | rte sts.l PR,@-Rn
|
---|
1329 | rts sub Rm,Rn
|
---|
1330 | sett subc Rm,Rn
|
---|
1331 | shal Rn subv Rm,Rn
|
---|
1332 | shar Rn swap.b Rm,Rn
|
---|
1333 | shll Rn swap.w Rm,Rn
|
---|
1334 | shll16 Rn tas.b @Rn
|
---|
1335 | shll2 Rn trapa #imm
|
---|
1336 | shll8 Rn tst #imm,R0
|
---|
1337 | shlr Rn tst Rm,Rn
|
---|
1338 | shlr16 Rn tst.b #imm,@(R0,GBR)
|
---|
1339 | shlr2 Rn xor #imm,R0
|
---|
1340 | shlr8 Rn xor Rm,Rn
|
---|
1341 | sleep xor.b #imm,@(R0,GBR)
|
---|
1342 | stc GBR,Rn xtrct Rm,Rn
|
---|
1343 | stc SR,Rn
|
---|
1344 |
|
---|
1345 |
|
---|
1346 | File: as.info, Node: SH64-Dependent, Next: PDP-11-Dependent, Prev: SH-Dependent, Up: Machine Dependencies
|
---|
1347 |
|
---|
1348 | SuperH SH64 Dependent Features
|
---|
1349 | ==============================
|
---|
1350 |
|
---|
1351 | * Menu:
|
---|
1352 |
|
---|
1353 | * SH64 Options:: Options
|
---|
1354 | * SH64 Syntax:: Syntax
|
---|
1355 | * SH64 Directives:: SH64 Machine Directives
|
---|
1356 | * SH64 Opcodes:: Opcodes
|
---|
1357 |
|
---|
1358 |
|
---|
1359 | File: as.info, Node: SH64 Options, Next: SH64 Syntax, Up: SH64-Dependent
|
---|
1360 |
|
---|
1361 | Options
|
---|
1362 | -------
|
---|
1363 |
|
---|
1364 | `-isa=shmedia | -isa=shcompact'
|
---|
1365 | Specify the default instruction set. `SHmedia' specifies the
|
---|
1366 | 32-bit opcodes, and `SHcompact' specifies the 16-bit opcodes
|
---|
1367 | compatible with previous SH families. The default depends on the
|
---|
1368 | ABI selected; the default for the 64-bit ABI is SHmedia, and the
|
---|
1369 | default for the 32-bit ABI is SHcompact. If neither the ABI nor
|
---|
1370 | the ISA is specified, the default is 32-bit SHcompact.
|
---|
1371 |
|
---|
1372 | Note that the `.mode' pseudo-op is not permitted if the ISA is not
|
---|
1373 | specified on the command line.
|
---|
1374 |
|
---|
1375 | `-abi=32 | -abi=64'
|
---|
1376 | Specify the default ABI. If the ISA is specified and the ABI is
|
---|
1377 | not, the default ABI depends on the ISA, with SHmedia defaulting
|
---|
1378 | to 64-bit and SHcompact defaulting to 32-bit.
|
---|
1379 |
|
---|
1380 | Note that the `.abi' pseudo-op is not permitted if the ABI is not
|
---|
1381 | specified on the command line. When the ABI is specified on the
|
---|
1382 | command line, any `.abi' pseudo-ops in the source must match it.
|
---|
1383 |
|
---|
1384 | `-shcompact-const-crange'
|
---|
1385 | Emit code-range descriptors for constants in SHcompact code
|
---|
1386 | sections.
|
---|
1387 |
|
---|
1388 | `-no-mix'
|
---|
1389 | Disallow SHmedia code in the same section as constants and
|
---|
1390 | SHcompact code.
|
---|
1391 |
|
---|
1392 | `-no-expand'
|
---|
1393 | Do not expand MOVI, PT, PTA or PTB instructions.
|
---|
1394 |
|
---|
1395 | `-expand-pt32'
|
---|
1396 | With -abi=64, expand PT, PTA and PTB instructions to 32 bits only.
|
---|
1397 |
|
---|
1398 |
|
---|
1399 | File: as.info, Node: SH64 Syntax, Next: SH64 Directives, Prev: SH64 Options, Up: SH64-Dependent
|
---|
1400 |
|
---|
1401 | Syntax
|
---|
1402 | ------
|
---|
1403 |
|
---|
1404 | * Menu:
|
---|
1405 |
|
---|
1406 | * SH64-Chars:: Special Characters
|
---|
1407 | * SH64-Regs:: Register Names
|
---|
1408 | * SH64-Addressing:: Addressing Modes
|
---|
1409 |
|
---|
1410 |
|
---|
1411 | File: as.info, Node: SH64-Chars, Next: SH64-Regs, Up: SH64 Syntax
|
---|
1412 |
|
---|
1413 | Special Characters
|
---|
1414 | ..................
|
---|
1415 |
|
---|
1416 | `!' is the line comment character.
|
---|
1417 |
|
---|
1418 | You can use `;' instead of a newline to separate statements.
|
---|
1419 |
|
---|
1420 | Since `$' has no special meaning, you may use it in symbol names.
|
---|
1421 |
|
---|
1422 |
|
---|
1423 | File: as.info, Node: SH64-Regs, Next: SH64-Addressing, Prev: SH64-Chars, Up: SH64 Syntax
|
---|
1424 |
|
---|
1425 | Register Names
|
---|
1426 | ..............
|
---|
1427 |
|
---|
1428 | You can use the predefined symbols `r0' through `r63' to refer to
|
---|
1429 | the SH64 general registers, `cr0' through `cr63' for control registers,
|
---|
1430 | `tr0' through `tr7' for target address registers, `fr0' through `fr63'
|
---|
1431 | for single-precision floating point registers, `dr0' through `dr62'
|
---|
1432 | (even numbered registers only) for double-precision floating point
|
---|
1433 | registers, `fv0' through `fv60' (multiples of four only) for
|
---|
1434 | single-precision floating point vectors, `fp0' through `fp62' (even
|
---|
1435 | numbered registers only) for single-precision floating point pairs,
|
---|
1436 | `mtrx0' through `mtrx48' (multiples of 16 only) for 4x4 matrices of
|
---|
1437 | single-precision floating point registers, `pc' for the program
|
---|
1438 | counter, and `fpscr' for the floating point status and control register.
|
---|
1439 |
|
---|
1440 | You can also refer to the control registers by the mnemonics `sr',
|
---|
1441 | `ssr', `pssr', `intevt', `expevt', `pexpevt', `tra', `spc', `pspc',
|
---|
1442 | `resvec', `vbr', `tea', `dcr', `kcr0', `kcr1', `ctc', and `usr'.
|
---|
1443 |
|
---|
1444 |
|
---|
1445 | File: as.info, Node: SH64-Addressing, Prev: SH64-Regs, Up: SH64 Syntax
|
---|
1446 |
|
---|
1447 | Addressing Modes
|
---|
1448 | ................
|
---|
1449 |
|
---|
1450 | SH64 operands consist of either a register or immediate value. The
|
---|
1451 | immediate value can be a constant or label reference (or portion of a
|
---|
1452 | label reference), as in this example:
|
---|
1453 |
|
---|
1454 | movi 4,r2
|
---|
1455 | pt function, tr4
|
---|
1456 | movi (function >> 16) & 65535,r0
|
---|
1457 | shori function & 65535, r0
|
---|
1458 | ld.l r0,4,r0
|
---|
1459 |
|
---|
1460 | Instruction label references can reference labels in either SHmedia
|
---|
1461 | or SHcompact. To differentiate between the two, labels in SHmedia
|
---|
1462 | sections will always have the least significant bit set (i.e. they will
|
---|
1463 | be odd), which SHcompact labels will have the least significant bit
|
---|
1464 | reset (i.e. they will be even). If you need to reference the actual
|
---|
1465 | address of a label, you can use the `datalabel' modifier, as in this
|
---|
1466 | example:
|
---|
1467 |
|
---|
1468 | .long function
|
---|
1469 | .long datalabel function
|
---|
1470 |
|
---|
1471 | In that example, the first longword may or may not have the least
|
---|
1472 | significant bit set depending on whether the label is an SHmedia label
|
---|
1473 | or an SHcompact label. The second longword will be the actual address
|
---|
1474 | of the label, regardless of what type of label it is.
|
---|
1475 |
|
---|
1476 |
|
---|
1477 | File: as.info, Node: SH64 Directives, Next: SH64 Opcodes, Prev: SH64 Syntax, Up: SH64-Dependent
|
---|
1478 |
|
---|
1479 | SH64 Machine Directives
|
---|
1480 | -----------------------
|
---|
1481 |
|
---|
1482 | In addition to the SH directives, the SH64 provides the following
|
---|
1483 | directives:
|
---|
1484 |
|
---|
1485 | `.mode [shmedia|shcompact]'
|
---|
1486 | `.isa [shmedia|shcompact]'
|
---|
1487 | Specify the ISA for the following instructions (the two directives
|
---|
1488 | are equivalent). Note that programs such as `objdump' rely on
|
---|
1489 | symbolic labels to determine when such mode switches occur (by
|
---|
1490 | checking the least significant bit of the label's address), so
|
---|
1491 | such mode/isa changes should always be followed by a label (in
|
---|
1492 | practice, this is true anyway). Note that you cannot use these
|
---|
1493 | directives if you didn't specify an ISA on the command line.
|
---|
1494 |
|
---|
1495 | `.abi [32|64]'
|
---|
1496 | Specify the ABI for the following instructions. Note that you
|
---|
1497 | cannot use this directive unless you specified an ABI on the
|
---|
1498 | command line, and the ABIs specified must match.
|
---|
1499 |
|
---|
1500 | `.uaquad'
|
---|
1501 | Like .uaword and .ualong, this allows you to specify an
|
---|
1502 | intenionally unaligned quadword (64 bit word).
|
---|
1503 |
|
---|