source: trunk/binutils/gas/doc/as.info-5@ 3232

Last change on this file since 3232 was 610, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r609,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 43.1 KB
Line 
1This is as.info, produced by makeinfo version 4.3 from as.texinfo.
2
3START-INFO-DIR-ENTRY
4* As: (as). The GNU assembler.
5* Gas: (as). The GNU assembler.
6END-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
11Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14under the terms of the GNU Free Documentation License, Version 1.1 or
15any later version published by the Free Software Foundation; with no
16Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
17Texts. A copy of the license is included in the section entitled "GNU
18Free Documentation License".
19
20
21File: as.info, Node: CRIS-Regs, Next: CRIS-Pseudos, Prev: CRIS-Pic, Up: CRIS-Syntax
22
23Register names
24..............
25
26 A `$' character may always prefix a general or special register name
27in an instruction operand but is mandatory when the option
28`--no-underscore' is specified or when the `.syntax register_prefix'
29directive is in effect (*note crisnous::). Register names are
30case-insensitive.
31
32
33File: as.info, Node: CRIS-Pseudos, Prev: CRIS-Regs, Up: CRIS-Syntax
34
35Assembler Directives
36....................
37
38 There are a few CRIS-specific pseudo-directives in addition to the
39generic ones. *Note Pseudo Ops::. Constants emitted by
40pseudo-directives are in little-endian order for CRIS. There is no
41support for floating-point-specific directives for CRIS.
42
43`.dword EXPRESSIONS'
44 The `.dword' directive is a synonym for `.int', expecting zero or
45 more EXPRESSIONS, separated by commas. For each expression, a
46 32-bit little-endian constant is emitted.
47
48`.syntax ARGUMENT'
49 The `.syntax' directive takes as ARGUMENT one of the following
50 case-sensitive choices.
51
52 `no_register_prefix'
53 The `.syntax no_register_prefix' directive makes a `$'
54 character prefix on all registers optional. It overrides a
55 previous setting, including the corresponding effect of the
56 option `--no-underscore'. If this directive is used when
57 ordinary symbols do not have a `_' character prefix, care
58 must be taken to avoid ambiguities whether an operand is a
59 register or a symbol; using symbols with names the same as
60 general or special registers then invoke undefined behavior.
61
62 `register_prefix'
63 This directive makes a `$' character prefix on all registers
64 mandatory. It overrides a previous setting, including the
65 corresponding effect of the option `--underscore'.
66
67 `leading_underscore'
68 This is an assertion directive, emitting an error if the
69 `--no-underscore' option is in effect.
70
71 `no_leading_underscore'
72 This is the opposite of the `.syntax leading_underscore'
73 directive and emits an error if the option `--underscore' is
74 in effect.
75
76
77File: as.info, Node: D10V-Dependent, Next: D30V-Dependent, Prev: CRIS-Dependent, Up: Machine Dependencies
78
79D10V Dependent Features
80=======================
81
82* Menu:
83
84* D10V-Opts:: D10V Options
85* D10V-Syntax:: Syntax
86* D10V-Float:: Floating Point
87* D10V-Opcodes:: Opcodes
88
89
90File: as.info, Node: D10V-Opts, Next: D10V-Syntax, Up: D10V-Dependent
91
92D10V Options
93------------
94
95 The Mitsubishi D10V version of `as' has a few machine dependent
96options.
97
98`-O'
99 The D10V can often execute two sub-instructions in parallel. When
100 this option is used, `as' will attempt to optimize its output by
101 detecting when instructions can be executed in parallel.
102
103`--nowarnswap'
104 To optimize execution performance, `as' will sometimes swap the
105 order of instructions. Normally this generates a warning. When
106 this option is used, no warning will be generated when
107 instructions are swapped.
108
109`--gstabs-packing'
110
111`--no-gstabs-packing'
112 `as' packs adjacent short instructions into a single packed
113 instruction. `--no-gstabs-packing' turns instruction packing off if
114 `--gstabs' is specified as well; `--gstabs-packing' (the default)
115 turns instruction packing on even when `--gstabs' is specified.
116
117
118File: as.info, Node: D10V-Syntax, Next: D10V-Float, Prev: D10V-Opts, Up: D10V-Dependent
119
120Syntax
121------
122
123 The D10V syntax is based on the syntax in Mitsubishi's D10V
124architecture manual. The differences are detailed below.
125
126* Menu:
127
128* D10V-Size:: Size Modifiers
129* D10V-Subs:: Sub-Instructions
130* D10V-Chars:: Special Characters
131* D10V-Regs:: Register Names
132* D10V-Addressing:: Addressing Modes
133* D10V-Word:: @WORD Modifier
134
135
136File: as.info, Node: D10V-Size, Next: D10V-Subs, Up: D10V-Syntax
137
138Size Modifiers
139..............
140
141 The D10V version of `as' uses the instruction names in the D10V
142Architecture Manual. However, the names in the manual are sometimes
143ambiguous. There are instruction names that can assemble to a short or
144long form opcode. How does the assembler pick the correct form? `as'
145will always pick the smallest form if it can. When dealing with a
146symbol that is not defined yet when a line is being assembled, it will
147always use the long form. If you need to force the assembler to use
148either the short or long form of the instruction, you can append either
149`.s' (short) or `.l' (long) to it. For example, if you are writing an
150assembly program and you want to do a branch to a symbol that is
151defined later in your program, you can write `bra.s foo'. Objdump
152and GDB will always append `.s' or `.l' to instructions which have both
153short and long forms.
154
155
156File: as.info, Node: D10V-Subs, Next: D10V-Chars, Prev: D10V-Size, Up: D10V-Syntax
157
158Sub-Instructions
159................
160
161 The D10V assembler takes as input a series of instructions, either
162one-per-line, or in the special two-per-line format described in the
163next section. Some of these instructions will be short-form or
164sub-instructions. These sub-instructions can be packed into a single
165instruction. The assembler will do this automatically. It will also
166detect when it should not pack instructions. For example, when a label
167is defined, the next instruction will never be packaged with the
168previous one. Whenever a branch and link instruction is called, it
169will not be packaged with the next instruction so the return address
170will be valid. Nops are automatically inserted when necessary.
171
172 If you do not want the assembler automatically making these
173decisions, you can control the packaging and execution type (parallel
174or sequential) with the special execution symbols described in the next
175section.
176
177
178File: as.info, Node: D10V-Chars, Next: D10V-Regs, Prev: D10V-Subs, Up: D10V-Syntax
179
180Special Characters
181..................
182
183 `;' and `#' are the line comment characters. Sub-instructions may
184be executed in order, in reverse-order, or in parallel. Instructions
185listed in the standard one-per-line format will be executed
186sequentially. To specify the executing order, use the following
187symbols:
188`->'
189 Sequential with instruction on the left first.
190
191`<-'
192 Sequential with instruction on the right first.
193
194`||'
195 Parallel The D10V syntax allows either one instruction per line,
196one instruction per line with the execution symbol, or two instructions
197per line. For example
198`abs a1 -> abs r0'
199 Execute these sequentially. The instruction on the right is in
200 the right container and is executed second.
201
202`abs r0 <- abs a1'
203 Execute these reverse-sequentially. The instruction on the right
204 is in the right container, and is executed first.
205
206`ld2w r2,@r8+ || mac a0,r0,r7'
207 Execute these in parallel.
208
209`ld2w r2,@r8+ ||'
210`mac a0,r0,r7'
211 Two-line format. Execute these in parallel.
212
213`ld2w r2,@r8+'
214`mac a0,r0,r7'
215 Two-line format. Execute these sequentially. Assembler will put
216 them in the proper containers.
217
218`ld2w r2,@r8+ ->'
219`mac a0,r0,r7'
220 Two-line format. Execute these sequentially. Same as above but
221 second instruction will always go into right container. Since `$'
222has no special meaning, you may use it in symbol names.
223
224
225File: as.info, Node: D10V-Regs, Next: D10V-Addressing, Prev: D10V-Chars, Up: D10V-Syntax
226
227Register Names
228..............
229
230 You can use the predefined symbols `r0' through `r15' to refer to
231the D10V registers. You can also use `sp' as an alias for `r15'. The
232accumulators are `a0' and `a1'. There are special register-pair names
233that may optionally be used in opcodes that require even-numbered
234registers. Register names are not case sensitive.
235
236 Register Pairs
237`r0-r1'
238
239`r2-r3'
240
241`r4-r5'
242
243`r6-r7'
244
245`r8-r9'
246
247`r10-r11'
248
249`r12-r13'
250
251`r14-r15'
252 The D10V also has predefined symbols for these control registers and
253status bits:
254`psw'
255 Processor Status Word
256
257`bpsw'
258 Backup Processor Status Word
259
260`pc'
261 Program Counter
262
263`bpc'
264 Backup Program Counter
265
266`rpt_c'
267 Repeat Count
268
269`rpt_s'
270 Repeat Start address
271
272`rpt_e'
273 Repeat End address
274
275`mod_s'
276 Modulo Start address
277
278`mod_e'
279 Modulo End address
280
281`iba'
282 Instruction Break Address
283
284`f0'
285 Flag 0
286
287`f1'
288 Flag 1
289
290`c'
291 Carry flag
292
293
294File: as.info, Node: D10V-Addressing, Next: D10V-Word, Prev: D10V-Regs, Up: D10V-Syntax
295
296Addressing Modes
297................
298
299 `as' understands the following addressing modes for the D10V. `RN'
300in the following refers to any of the numbered registers, but _not_ the
301control registers.
302`RN'
303 Register direct
304
305`@RN'
306 Register indirect
307
308`@RN+'
309 Register indirect with post-increment
310
311`@RN-'
312 Register indirect with post-decrement
313
314`@-SP'
315 Register indirect with pre-decrement
316
317`@(DISP, RN)'
318 Register indirect with displacement
319
320`ADDR'
321 PC relative address (for branch or rep).
322
323`#IMM'
324 Immediate data (the `#' is optional and ignored)
325
326
327File: as.info, Node: D10V-Word, Prev: D10V-Addressing, Up: D10V-Syntax
328
329@WORD Modifier
330..............
331
332 Any symbol followed by `@word' will be replaced by the symbol's value
333shifted right by 2. This is used in situations such as loading a
334register with the address of a function (or any other code fragment).
335For example, if you want to load a register with the location of the
336function `main' then jump to that function, you could do it as follows:
337 ldi r2, main@word
338 jmp r2
339
340
341File: as.info, Node: D10V-Float, Next: D10V-Opcodes, Prev: D10V-Syntax, Up: D10V-Dependent
342
343Floating Point
344--------------
345
346 The D10V has no hardware floating point, but the `.float' and
347`.double' directives generates IEEE floating-point numbers for
348compatibility with other development tools.
349
350
351File: as.info, Node: D10V-Opcodes, Prev: D10V-Float, Up: D10V-Dependent
352
353Opcodes
354-------
355
356 For detailed information on the D10V machine instruction set, see
357`D10V Architecture: A VLIW Microprocessor for Multimedia Applications'
358(Mitsubishi Electric Corp.). `as' implements all the standard D10V
359opcodes. The only changes are those described in the section on size
360modifiers
361
362
363File: as.info, Node: D30V-Dependent, Next: H8/300-Dependent, Prev: D10V-Dependent, Up: Machine Dependencies
364
365D30V Dependent Features
366=======================
367
368* Menu:
369
370* D30V-Opts:: D30V Options
371* D30V-Syntax:: Syntax
372* D30V-Float:: Floating Point
373* D30V-Opcodes:: Opcodes
374
375
376File: as.info, Node: D30V-Opts, Next: D30V-Syntax, Up: D30V-Dependent
377
378D30V Options
379------------
380
381 The Mitsubishi D30V version of `as' has a few machine dependent
382options.
383
384`-O'
385 The D30V can often execute two sub-instructions in parallel. When
386 this option is used, `as' will attempt to optimize its output by
387 detecting when instructions can be executed in parallel.
388
389`-n'
390 When this option is used, `as' will issue a warning every time it
391 adds a nop instruction.
392
393`-N'
394 When this option is used, `as' will issue a warning if it needs to
395 insert a nop after a 32-bit multiply before a load or 16-bit
396 multiply instruction.
397
398
399File: as.info, Node: D30V-Syntax, Next: D30V-Float, Prev: D30V-Opts, Up: D30V-Dependent
400
401Syntax
402------
403
404 The D30V syntax is based on the syntax in Mitsubishi's D30V
405architecture manual. The differences are detailed below.
406
407* Menu:
408
409* D30V-Size:: Size Modifiers
410* D30V-Subs:: Sub-Instructions
411* D30V-Chars:: Special Characters
412* D30V-Guarded:: Guarded Execution
413* D30V-Regs:: Register Names
414* D30V-Addressing:: Addressing Modes
415
416
417File: as.info, Node: D30V-Size, Next: D30V-Subs, Up: D30V-Syntax
418
419Size Modifiers
420..............
421
422 The D30V version of `as' uses the instruction names in the D30V
423Architecture Manual. However, the names in the manual are sometimes
424ambiguous. There are instruction names that can assemble to a short or
425long form opcode. How does the assembler pick the correct form? `as'
426will always pick the smallest form if it can. When dealing with a
427symbol that is not defined yet when a line is being assembled, it will
428always use the long form. If you need to force the assembler to use
429either the short or long form of the instruction, you can append either
430`.s' (short) or `.l' (long) to it. For example, if you are writing an
431assembly program and you want to do a branch to a symbol that is
432defined later in your program, you can write `bra.s foo'. Objdump and
433GDB will always append `.s' or `.l' to instructions which have both
434short and long forms.
435
436
437File: as.info, Node: D30V-Subs, Next: D30V-Chars, Prev: D30V-Size, Up: D30V-Syntax
438
439Sub-Instructions
440................
441
442 The D30V assembler takes as input a series of instructions, either
443one-per-line, or in the special two-per-line format described in the
444next section. Some of these instructions will be short-form or
445sub-instructions. These sub-instructions can be packed into a single
446instruction. The assembler will do this automatically. It will also
447detect when it should not pack instructions. For example, when a label
448is defined, the next instruction will never be packaged with the
449previous one. Whenever a branch and link instruction is called, it
450will not be packaged with the next instruction so the return address
451will be valid. Nops are automatically inserted when necessary.
452
453 If you do not want the assembler automatically making these
454decisions, you can control the packaging and execution type (parallel
455or sequential) with the special execution symbols described in the next
456section.
457
458
459File: as.info, Node: D30V-Chars, Next: D30V-Guarded, Prev: D30V-Subs, Up: D30V-Syntax
460
461Special Characters
462..................
463
464 `;' and `#' are the line comment characters. Sub-instructions may
465be executed in order, in reverse-order, or in parallel. Instructions
466listed in the standard one-per-line format will be executed
467sequentially unless you use the `-O' option.
468
469 To specify the executing order, use the following symbols:
470`->'
471 Sequential with instruction on the left first.
472
473`<-'
474 Sequential with instruction on the right first.
475
476`||'
477 Parallel
478
479 The D30V syntax allows either one instruction per line, one
480instruction per line with the execution symbol, or two instructions per
481line. For example
482`abs r2,r3 -> abs r4,r5'
483 Execute these sequentially. The instruction on the right is in
484 the right container and is executed second.
485
486`abs r2,r3 <- abs r4,r5'
487 Execute these reverse-sequentially. The instruction on the right
488 is in the right container, and is executed first.
489
490`abs r2,r3 || abs r4,r5'
491 Execute these in parallel.
492
493`ldw r2,@(r3,r4) ||'
494`mulx r6,r8,r9'
495 Two-line format. Execute these in parallel.
496
497`mulx a0,r8,r9'
498`stw r2,@(r3,r4)'
499 Two-line format. Execute these sequentially unless `-O' option is
500 used. If the `-O' option is used, the assembler will determine if
501 the instructions could be done in parallel (the above two
502 instructions can be done in parallel), and if so, emit them as
503 parallel instructions. The assembler will put them in the proper
504 containers. In the above example, the assembler will put the
505 `stw' instruction in left container and the `mulx' instruction in
506 the right container.
507
508`stw r2,@(r3,r4) ->'
509`mulx a0,r8,r9'
510 Two-line format. Execute the `stw' instruction followed by the
511 `mulx' instruction sequentially. The first instruction goes in the
512 left container and the second instruction goes into right
513 container. The assembler will give an error if the machine
514 ordering constraints are violated.
515
516`stw r2,@(r3,r4) <-'
517`mulx a0,r8,r9'
518 Same as previous example, except that the `mulx' instruction is
519 executed before the `stw' instruction.
520
521 Since `$' has no special meaning, you may use it in symbol names.
522
523
524File: as.info, Node: D30V-Guarded, Next: D30V-Regs, Prev: D30V-Chars, Up: D30V-Syntax
525
526Guarded Execution
527.................
528
529 `as' supports the full range of guarded execution directives for
530each instruction. Just append the directive after the instruction
531proper. The directives are:
532
533`/tx'
534 Execute the instruction if flag f0 is true.
535
536`/fx'
537 Execute the instruction if flag f0 is false.
538
539`/xt'
540 Execute the instruction if flag f1 is true.
541
542`/xf'
543 Execute the instruction if flag f1 is false.
544
545`/tt'
546 Execute the instruction if both flags f0 and f1 are true.
547
548`/tf'
549 Execute the instruction if flag f0 is true and flag f1 is false.
550
551
552File: as.info, Node: D30V-Regs, Next: D30V-Addressing, Prev: D30V-Guarded, Up: D30V-Syntax
553
554Register Names
555..............
556
557 You can use the predefined symbols `r0' through `r63' to refer to
558the D30V registers. You can also use `sp' as an alias for `r63' and
559`link' as an alias for `r62'. The accumulators are `a0' and `a1'.
560
561 The D30V also has predefined symbols for these control registers and
562status bits:
563`psw'
564 Processor Status Word
565
566`bpsw'
567 Backup Processor Status Word
568
569`pc'
570 Program Counter
571
572`bpc'
573 Backup Program Counter
574
575`rpt_c'
576 Repeat Count
577
578`rpt_s'
579 Repeat Start address
580
581`rpt_e'
582 Repeat End address
583
584`mod_s'
585 Modulo Start address
586
587`mod_e'
588 Modulo End address
589
590`iba'
591 Instruction Break Address
592
593`f0'
594 Flag 0
595
596`f1'
597 Flag 1
598
599`f2'
600 Flag 2
601
602`f3'
603 Flag 3
604
605`f4'
606 Flag 4
607
608`f5'
609 Flag 5
610
611`f6'
612 Flag 6
613
614`f7'
615 Flag 7
616
617`s'
618 Same as flag 4 (saturation flag)
619
620`v'
621 Same as flag 5 (overflow flag)
622
623`va'
624 Same as flag 6 (sticky overflow flag)
625
626`c'
627 Same as flag 7 (carry/borrow flag)
628
629`b'
630 Same as flag 7 (carry/borrow flag)
631
632
633File: as.info, Node: D30V-Addressing, Prev: D30V-Regs, Up: D30V-Syntax
634
635Addressing Modes
636................
637
638 `as' understands the following addressing modes for the D30V. `RN'
639in the following refers to any of the numbered registers, but _not_ the
640control registers.
641`RN'
642 Register direct
643
644`@RN'
645 Register indirect
646
647`@RN+'
648 Register indirect with post-increment
649
650`@RN-'
651 Register indirect with post-decrement
652
653`@-SP'
654 Register indirect with pre-decrement
655
656`@(DISP, RN)'
657 Register indirect with displacement
658
659`ADDR'
660 PC relative address (for branch or rep).
661
662`#IMM'
663 Immediate data (the `#' is optional and ignored)
664
665
666File: as.info, Node: D30V-Float, Next: D30V-Opcodes, Prev: D30V-Syntax, Up: D30V-Dependent
667
668Floating Point
669--------------
670
671 The D30V has no hardware floating point, but the `.float' and
672`.double' directives generates IEEE floating-point numbers for
673compatibility with other development tools.
674
675
676File: as.info, Node: D30V-Opcodes, Prev: D30V-Float, Up: D30V-Dependent
677
678Opcodes
679-------
680
681 For detailed information on the D30V machine instruction set, see
682`D30V Architecture: A VLIW Microprocessor for Multimedia Applications'
683(Mitsubishi Electric Corp.). `as' implements all the standard D30V
684opcodes. The only changes are those described in the section on size
685modifiers
686
687
688File: as.info, Node: H8/300-Dependent, Next: H8/500-Dependent, Prev: D30V-Dependent, Up: Machine Dependencies
689
690H8/300 Dependent Features
691=========================
692
693* Menu:
694
695* H8/300 Options:: Options
696* H8/300 Syntax:: Syntax
697* H8/300 Floating Point:: Floating Point
698* H8/300 Directives:: H8/300 Machine Directives
699* H8/300 Opcodes:: Opcodes
700
701
702File: as.info, Node: H8/300 Options, Next: H8/300 Syntax, Up: H8/300-Dependent
703
704Options
705-------
706
707 `as' has no additional command-line options for the Renesas
708(formerly Hitachi) H8/300 family.
709
710
711File: as.info, Node: H8/300 Syntax, Next: H8/300 Floating Point, Prev: H8/300 Options, Up: H8/300-Dependent
712
713Syntax
714------
715
716* Menu:
717
718* H8/300-Chars:: Special Characters
719* H8/300-Regs:: Register Names
720* H8/300-Addressing:: Addressing Modes
721
722
723File: as.info, Node: H8/300-Chars, Next: H8/300-Regs, Up: H8/300 Syntax
724
725Special Characters
726..................
727
728 `;' is the line comment character.
729
730 `$' can be used instead of a newline to separate statements.
731Therefore _you may not use `$' in symbol names_ on the H8/300.
732
733
734File: as.info, Node: H8/300-Regs, Next: H8/300-Addressing, Prev: H8/300-Chars, Up: H8/300 Syntax
735
736Register Names
737..............
738
739 You can use predefined symbols of the form `rNh' and `rNl' to refer
740to the H8/300 registers as sixteen 8-bit general-purpose registers. N
741is a digit from `0' to `7'); for instance, both `r0h' and `r7l' are
742valid register names.
743
744 You can also use the eight predefined symbols `rN' to refer to the
745H8/300 registers as 16-bit registers (you must use this form for
746addressing).
747
748 On the H8/300H, you can also use the eight predefined symbols `erN'
749(`er0' ... `er7') to refer to the 32-bit general purpose registers.
750
751 The two control registers are called `pc' (program counter; a 16-bit
752register, except on the H8/300H where it is 24 bits) and `ccr'
753(condition code register; an 8-bit register). `r7' is used as the
754stack pointer, and can also be called `sp'.
755
756
757File: as.info, Node: H8/300-Addressing, Prev: H8/300-Regs, Up: H8/300 Syntax
758
759Addressing Modes
760................
761
762 as understands the following addressing modes for the H8/300:
763`rN'
764 Register direct
765
766`@rN'
767 Register indirect
768
769`@(D, rN)'
770`@(D:16, rN)'
771`@(D:24, rN)'
772 Register indirect: 16-bit or 24-bit displacement D from register
773 N. (24-bit displacements are only meaningful on the H8/300H.)
774
775`@rN+'
776 Register indirect with post-increment
777
778`@-rN'
779 Register indirect with pre-decrement
780
781``@'AA'
782``@'AA:8'
783``@'AA:16'
784``@'AA:24'
785 Absolute address `aa'. (The address size `:24' only makes sense
786 on the H8/300H.)
787
788`#XX'
789`#XX:8'
790`#XX:16'
791`#XX:32'
792 Immediate data XX. You may specify the `:8', `:16', or `:32' for
793 clarity, if you wish; but `as' neither requires this nor uses
794 it--the data size required is taken from context.
795
796``@'`@'AA'
797``@'`@'AA:8'
798 Memory indirect. You may specify the `:8' for clarity, if you
799 wish; but `as' neither requires this nor uses it.
800
801
802File: as.info, Node: H8/300 Floating Point, Next: H8/300 Directives, Prev: H8/300 Syntax, Up: H8/300-Dependent
803
804Floating Point
805--------------
806
807 The H8/300 family has no hardware floating point, but the `.float'
808directive generates IEEE floating-point numbers for compatibility with
809other development tools.
810
811
812File: as.info, Node: H8/300 Directives, Next: H8/300 Opcodes, Prev: H8/300 Floating Point, Up: H8/300-Dependent
813
814H8/300 Machine Directives
815-------------------------
816
817 `as' has the following machine-dependent directives for the H8/300:
818
819`.h8300h'
820 Recognize and emit additional instructions for the H8/300H
821 variant, and also make `.int' emit 32-bit numbers rather than the
822 usual (16-bit) for the H8/300 family.
823
824`.h8300s'
825 Recognize and emit additional instructions for the H8S variant, and
826 also make `.int' emit 32-bit numbers rather than the usual (16-bit)
827 for the H8/300 family.
828
829`.h8300hn'
830 Recognize and emit additional instructions for the H8/300H variant
831 in normal mode, and also make `.int' emit 32-bit numbers rather
832 than the usual (16-bit) for the H8/300 family.
833
834`.h8300sn'
835 Recognize and emit additional instructions for the H8S variant in
836 normal mode, and also make `.int' emit 32-bit numbers rather than
837 the usual (16-bit) for the H8/300 family.
838
839 On the H8/300 family (including the H8/300H) `.word' directives
840generate 16-bit numbers.
841
842
843File: as.info, Node: H8/300 Opcodes, Prev: H8/300 Directives, Up: H8/300-Dependent
844
845Opcodes
846-------
847
848 For detailed information on the H8/300 machine instruction set, see
849`H8/300 Series Programming Manual'. For information specific to the
850H8/300H, see `H8/300H Series Programming Manual' (Renesas).
851
852 `as' implements all the standard H8/300 opcodes. No additional
853pseudo-instructions are needed on this family.
854
855 The following table summarizes the H8/300 opcodes, and their
856arguments. Entries marked `*' are opcodes used only on the H8/300H.
857
858 Legend:
859 Rs source register
860 Rd destination register
861 abs absolute address
862 imm immediate data
863 disp:N N-bit displacement from a register
864 pcrel:N N-bit displacement relative to program counter
865
866 add.b #imm,rd * andc #imm,ccr
867 add.b rs,rd band #imm,rd
868 add.w rs,rd band #imm,@rd
869 * add.w #imm,rd band #imm,@abs:8
870 * add.l rs,rd bra pcrel:8
871 * add.l #imm,rd * bra pcrel:16
872 adds #imm,rd bt pcrel:8
873 addx #imm,rd * bt pcrel:16
874 addx rs,rd brn pcrel:8
875 and.b #imm,rd * brn pcrel:16
876 and.b rs,rd bf pcrel:8
877 * and.w rs,rd * bf pcrel:16
878 * and.w #imm,rd bhi pcrel:8
879 * and.l #imm,rd * bhi pcrel:16
880 * and.l rs,rd bls pcrel:8
881
882 * bls pcrel:16 bld #imm,rd
883 bcc pcrel:8 bld #imm,@rd
884 * bcc pcrel:16 bld #imm,@abs:8
885 bhs pcrel:8 bnot #imm,rd
886 * bhs pcrel:16 bnot #imm,@rd
887 bcs pcrel:8 bnot #imm,@abs:8
888 * bcs pcrel:16 bnot rs,rd
889 blo pcrel:8 bnot rs,@rd
890 * blo pcrel:16 bnot rs,@abs:8
891 bne pcrel:8 bor #imm,rd
892 * bne pcrel:16 bor #imm,@rd
893 beq pcrel:8 bor #imm,@abs:8
894 * beq pcrel:16 bset #imm,rd
895 bvc pcrel:8 bset #imm,@rd
896 * bvc pcrel:16 bset #imm,@abs:8
897 bvs pcrel:8 bset rs,rd
898 * bvs pcrel:16 bset rs,@rd
899 bpl pcrel:8 bset rs,@abs:8
900 * bpl pcrel:16 bsr pcrel:8
901 bmi pcrel:8 bsr pcrel:16
902 * bmi pcrel:16 bst #imm,rd
903 bge pcrel:8 bst #imm,@rd
904 * bge pcrel:16 bst #imm,@abs:8
905 blt pcrel:8 btst #imm,rd
906 * blt pcrel:16 btst #imm,@rd
907 bgt pcrel:8 btst #imm,@abs:8
908 * bgt pcrel:16 btst rs,rd
909 ble pcrel:8 btst rs,@rd
910 * ble pcrel:16 btst rs,@abs:8
911 bclr #imm,rd bxor #imm,rd
912 bclr #imm,@rd bxor #imm,@rd
913 bclr #imm,@abs:8 bxor #imm,@abs:8
914 bclr rs,rd cmp.b #imm,rd
915 bclr rs,@rd cmp.b rs,rd
916 bclr rs,@abs:8 cmp.w rs,rd
917 biand #imm,rd cmp.w rs,rd
918 biand #imm,@rd * cmp.w #imm,rd
919 biand #imm,@abs:8 * cmp.l #imm,rd
920 bild #imm,rd * cmp.l rs,rd
921 bild #imm,@rd daa rs
922 bild #imm,@abs:8 das rs
923 bior #imm,rd dec.b rs
924 bior #imm,@rd * dec.w #imm,rd
925 bior #imm,@abs:8 * dec.l #imm,rd
926 bist #imm,rd divxu.b rs,rd
927 bist #imm,@rd * divxu.w rs,rd
928 bist #imm,@abs:8 * divxs.b rs,rd
929 bixor #imm,rd * divxs.w rs,rd
930 bixor #imm,@rd eepmov
931 bixor #imm,@abs:8 * eepmovw
932
933 * exts.w rd mov.w rs,@abs:16
934 * exts.l rd * mov.l #imm,rd
935 * extu.w rd * mov.l rs,rd
936 * extu.l rd * mov.l @rs,rd
937 inc rs * mov.l @(disp:16,rs),rd
938 * inc.w #imm,rd * mov.l @(disp:24,rs),rd
939 * inc.l #imm,rd * mov.l @rs+,rd
940 jmp @rs * mov.l @abs:16,rd
941 jmp abs * mov.l @abs:24,rd
942 jmp @@abs:8 * mov.l rs,@rd
943 jsr @rs * mov.l rs,@(disp:16,rd)
944 jsr abs * mov.l rs,@(disp:24,rd)
945 jsr @@abs:8 * mov.l rs,@-rd
946 ldc #imm,ccr * mov.l rs,@abs:16
947 ldc rs,ccr * mov.l rs,@abs:24
948 * ldc @abs:16,ccr movfpe @abs:16,rd
949 * ldc @abs:24,ccr movtpe rs,@abs:16
950 * ldc @(disp:16,rs),ccr mulxu.b rs,rd
951 * ldc @(disp:24,rs),ccr * mulxu.w rs,rd
952 * ldc @rs+,ccr * mulxs.b rs,rd
953 * ldc @rs,ccr * mulxs.w rs,rd
954 * mov.b @(disp:24,rs),rd neg.b rs
955 * mov.b rs,@(disp:24,rd) * neg.w rs
956 mov.b @abs:16,rd * neg.l rs
957 mov.b rs,rd nop
958 mov.b @abs:8,rd not.b rs
959 mov.b rs,@abs:8 * not.w rs
960 mov.b rs,rd * not.l rs
961 mov.b #imm,rd or.b #imm,rd
962 mov.b @rs,rd or.b rs,rd
963 mov.b @(disp:16,rs),rd * or.w #imm,rd
964 mov.b @rs+,rd * or.w rs,rd
965 mov.b @abs:8,rd * or.l #imm,rd
966 mov.b rs,@rd * or.l rs,rd
967 mov.b rs,@(disp:16,rd) orc #imm,ccr
968 mov.b rs,@-rd pop.w rs
969 mov.b rs,@abs:8 * pop.l rs
970 mov.w rs,@rd push.w rs
971 * mov.w @(disp:24,rs),rd * push.l rs
972 * mov.w rs,@(disp:24,rd) rotl.b rs
973 * mov.w @abs:24,rd * rotl.w rs
974 * mov.w rs,@abs:24 * rotl.l rs
975 mov.w rs,rd rotr.b rs
976 mov.w #imm,rd * rotr.w rs
977 mov.w @rs,rd * rotr.l rs
978 mov.w @(disp:16,rs),rd rotxl.b rs
979 mov.w @rs+,rd * rotxl.w rs
980 mov.w @abs:16,rd * rotxl.l rs
981 mov.w rs,@(disp:16,rd) rotxr.b rs
982 mov.w rs,@-rd * rotxr.w rs
983
984 * rotxr.l rs * stc ccr,@(disp:24,rd)
985 bpt * stc ccr,@-rd
986 rte * stc ccr,@abs:16
987 rts * stc ccr,@abs:24
988 shal.b rs sub.b rs,rd
989 * shal.w rs sub.w rs,rd
990 * shal.l rs * sub.w #imm,rd
991 shar.b rs * sub.l rs,rd
992 * shar.w rs * sub.l #imm,rd
993 * shar.l rs subs #imm,rd
994 shll.b rs subx #imm,rd
995 * shll.w rs subx rs,rd
996 * shll.l rs * trapa #imm
997 shlr.b rs xor #imm,rd
998 * shlr.w rs xor rs,rd
999 * shlr.l rs * xor.w #imm,rd
1000 sleep * xor.w rs,rd
1001 stc ccr,rd * xor.l #imm,rd
1002 * stc ccr,@rs * xor.l rs,rd
1003 * stc ccr,@(disp:16,rd) xorc #imm,ccr
1004
1005 Four H8/300 instructions (`add', `cmp', `mov', `sub') are defined
1006with variants using the suffixes `.b', `.w', and `.l' to specify the
1007size of a memory operand. `as' supports these suffixes, but does not
1008require them; since one of the operands is always a register, `as' can
1009deduce the correct size.
1010
1011 For example, since `r0' refers to a 16-bit register,
1012 mov r0,@foo
1013is equivalent to
1014 mov.w r0,@foo
1015
1016 If you use the size suffixes, `as' issues a warning when the suffix
1017and the register size do not match.
1018
1019
1020File: as.info, Node: H8/500-Dependent, Next: HPPA-Dependent, Prev: H8/300-Dependent, Up: Machine Dependencies
1021
1022H8/500 Dependent Features
1023=========================
1024
1025* Menu:
1026
1027* H8/500 Options:: Options
1028* H8/500 Syntax:: Syntax
1029* H8/500 Floating Point:: Floating Point
1030* H8/500 Directives:: H8/500 Machine Directives
1031* H8/500 Opcodes:: Opcodes
1032
1033
1034File: as.info, Node: H8/500 Options, Next: H8/500 Syntax, Up: H8/500-Dependent
1035
1036Options
1037-------
1038
1039 `as' has no additional command-line options for the Renesas
1040(formerly Hitachi) H8/500 family.
1041
1042
1043File: as.info, Node: H8/500 Syntax, Next: H8/500 Floating Point, Prev: H8/500 Options, Up: H8/500-Dependent
1044
1045Syntax
1046------
1047
1048* Menu:
1049
1050* H8/500-Chars:: Special Characters
1051* H8/500-Regs:: Register Names
1052* H8/500-Addressing:: Addressing Modes
1053
1054
1055File: as.info, Node: H8/500-Chars, Next: H8/500-Regs, Up: H8/500 Syntax
1056
1057Special Characters
1058..................
1059
1060 `!' is the line comment character.
1061
1062 `;' can be used instead of a newline to separate statements.
1063
1064 Since `$' has no special meaning, you may use it in symbol names.
1065
1066
1067File: as.info, Node: H8/500-Regs, Next: H8/500-Addressing, Prev: H8/500-Chars, Up: H8/500 Syntax
1068
1069Register Names
1070..............
1071
1072 You can use the predefined symbols `r0', `r1', `r2', `r3', `r4',
1073`r5', `r6', and `r7' to refer to the H8/500 registers.
1074
1075 The H8/500 also has these control registers:
1076
1077`cp'
1078 code pointer
1079
1080`dp'
1081 data pointer
1082
1083`bp'
1084 base pointer
1085
1086`tp'
1087 stack top pointer
1088
1089`ep'
1090 extra pointer
1091
1092`sr'
1093 status register
1094
1095`ccr'
1096 condition code register
1097
1098 All registers are 16 bits long. To represent 32 bit numbers, use two
1099adjacent registers; for distant memory addresses, use one of the segment
1100pointers (`cp' for the program counter; `dp' for `r0'-`r3'; `ep' for
1101`r4' and `r5'; and `tp' for `r6' and `r7'.
1102
1103
1104File: as.info, Node: H8/500-Addressing, Prev: H8/500-Regs, Up: H8/500 Syntax
1105
1106Addressing Modes
1107................
1108
1109 as understands the following addressing modes for the H8/500:
1110`RN'
1111 Register direct
1112
1113`@RN'
1114 Register indirect
1115
1116`@(d:8, RN)'
1117 Register indirect with 8 bit signed displacement
1118
1119`@(d:16, RN)'
1120 Register indirect with 16 bit signed displacement
1121
1122`@-RN'
1123 Register indirect with pre-decrement
1124
1125`@RN+'
1126 Register indirect with post-increment
1127
1128`@AA:8'
1129 8 bit absolute address
1130
1131`@AA:16'
1132 16 bit absolute address
1133
1134`#XX:8'
1135 8 bit immediate
1136
1137`#XX:16'
1138 16 bit immediate
1139
1140
1141File: as.info, Node: H8/500 Floating Point, Next: H8/500 Directives, Prev: H8/500 Syntax, Up: H8/500-Dependent
1142
1143Floating Point
1144--------------
1145
1146 The H8/500 family has no hardware floating point, but the `.float'
1147directive generates IEEE floating-point numbers for compatibility with
1148other development tools.
1149
1150
1151File: as.info, Node: H8/500 Directives, Next: H8/500 Opcodes, Prev: H8/500 Floating Point, Up: H8/500-Dependent
1152
1153H8/500 Machine Directives
1154-------------------------
1155
1156 `as' has no machine-dependent directives for the H8/500. However,
1157on this platform the `.int' and `.word' directives generate 16-bit
1158numbers.
1159
1160
1161File: as.info, Node: H8/500 Opcodes, Prev: H8/500 Directives, Up: H8/500-Dependent
1162
1163Opcodes
1164-------
1165
1166 For detailed information on the H8/500 machine instruction set, see
1167`H8/500 Series Programming Manual' (Renesas M21T001).
1168
1169 `as' implements all the standard H8/500 opcodes. No additional
1170pseudo-instructions are needed on this family.
1171
1172 The following table summarizes H8/500 opcodes and their operands:
1173
1174 Legend:
1175 abs8 8-bit absolute address
1176 abs16 16-bit absolute address
1177 abs24 24-bit absolute address
1178 crb `ccr', `br', `ep', `dp', `tp', `dp'
1179 disp8 8-bit displacement
1180 ea `rn', `@rn', `@(d:8, rn)', `@(d:16, rn)',
1181 `@-rn', `@rn+', `@aa:8', `@aa:16',
1182 `#xx:8', `#xx:16'
1183 ea_mem `@rn', `@(d:8, rn)', `@(d:16, rn)',
1184 `@-rn', `@rn+', `@aa:8', `@aa:16'
1185 ea_noimm `rn', `@rn', `@(d:8, rn)', `@(d:16, rn)',
1186 `@-rn', `@rn+', `@aa:8', `@aa:16'
1187 fp r6
1188 imm4 4-bit immediate data
1189 imm8 8-bit immediate data
1190 imm16 16-bit immediate data
1191 pcrel8 8-bit offset from program counter
1192 pcrel16 16-bit offset from program counter
1193 qim `-2', `-1', `1', `2'
1194 rd any register
1195 rs a register distinct from rd
1196 rlist comma-separated list of registers in parentheses;
1197 register ranges `rd-rs' are allowed
1198 sp stack pointer (`r7')
1199 sr status register
1200 sz size; `.b' or `.w'. If omitted, default `.w'
1201
1202 ldc[.b] ea,crb bcc[.w] pcrel16
1203 ldc[.w] ea,sr bcc[.b] pcrel8
1204 add[:q] sz qim,ea_noimm bhs[.w] pcrel16
1205 add[:g] sz ea,rd bhs[.b] pcrel8
1206 adds sz ea,rd bcs[.w] pcrel16
1207 addx sz ea,rd bcs[.b] pcrel8
1208 and sz ea,rd blo[.w] pcrel16
1209 andc[.b] imm8,crb blo[.b] pcrel8
1210 andc[.w] imm16,sr bne[.w] pcrel16
1211 bpt bne[.b] pcrel8
1212 bra[.w] pcrel16 beq[.w] pcrel16
1213 bra[.b] pcrel8 beq[.b] pcrel8
1214 bt[.w] pcrel16 bvc[.w] pcrel16
1215 bt[.b] pcrel8 bvc[.b] pcrel8
1216 brn[.w] pcrel16 bvs[.w] pcrel16
1217 brn[.b] pcrel8 bvs[.b] pcrel8
1218 bf[.w] pcrel16 bpl[.w] pcrel16
1219 bf[.b] pcrel8 bpl[.b] pcrel8
1220 bhi[.w] pcrel16 bmi[.w] pcrel16
1221 bhi[.b] pcrel8 bmi[.b] pcrel8
1222 bls[.w] pcrel16 bge[.w] pcrel16
1223 bls[.b] pcrel8 bge[.b] pcrel8
1224
1225 blt[.w] pcrel16 mov[:g][.b] imm8,ea_mem
1226 blt[.b] pcrel8 mov[:g][.w] imm16,ea_mem
1227 bgt[.w] pcrel16 movfpe[.b] ea,rd
1228 bgt[.b] pcrel8 movtpe[.b] rs,ea_noimm
1229 ble[.w] pcrel16 mulxu sz ea,rd
1230 ble[.b] pcrel8 neg sz ea
1231 bclr sz imm4,ea_noimm nop
1232 bclr sz rs,ea_noimm not sz ea
1233 bnot sz imm4,ea_noimm or sz ea,rd
1234 bnot sz rs,ea_noimm orc[.b] imm8,crb
1235 bset sz imm4,ea_noimm orc[.w] imm16,sr
1236 bset sz rs,ea_noimm pjmp abs24
1237 bsr[.b] pcrel8 pjmp @rd
1238 bsr[.w] pcrel16 pjsr abs24
1239 btst sz imm4,ea_noimm pjsr @rd
1240 btst sz rs,ea_noimm prtd imm8
1241 clr sz ea prtd imm16
1242 cmp[:e][.b] imm8,rd prts
1243 cmp[:i][.w] imm16,rd rotl sz ea
1244 cmp[:g].b imm8,ea_noimm rotr sz ea
1245 cmp[:g][.w] imm16,ea_noimm rotxl sz ea
1246 Cmp[:g] sz ea,rd rotxr sz ea
1247 dadd rs,rd rtd imm8
1248 divxu sz ea,rd rtd imm16
1249 dsub rs,rd rts
1250 exts[.b] rd scb/f rs,pcrel8
1251 extu[.b] rd scb/ne rs,pcrel8
1252 jmp @rd scb/eq rs,pcrel8
1253 jmp @(imm8,rd) shal sz ea
1254 jmp @(imm16,rd) shar sz ea
1255 jmp abs16 shll sz ea
1256 jsr @rd shlr sz ea
1257 jsr @(imm8,rd) sleep
1258 jsr @(imm16,rd) stc[.b] crb,ea_noimm
1259 jsr abs16 stc[.w] sr,ea_noimm
1260 ldm @sp+,(rlist) stm (rlist),@-sp
1261 link fp,imm8 sub sz ea,rd
1262 link fp,imm16 subs sz ea,rd
1263 mov[:e][.b] imm8,rd subx sz ea,rd
1264 mov[:i][.w] imm16,rd swap[.b] rd
1265 mov[:l][.w] abs8,rd tas[.b] ea
1266 mov[:l].b abs8,rd trapa imm4
1267 mov[:s][.w] rs,abs8 trap/vs
1268 mov[:s].b rs,abs8 tst sz ea
1269 mov[:f][.w] @(disp8,fp),rd unlk fp
1270 mov[:f][.w] rs,@(disp8,fp) xch[.w] rs,rd
1271 mov[:f].b @(disp8,fp),rd xor sz ea,rd
1272 mov[:f].b rs,@(disp8,fp) xorc.b imm8,crb
1273 mov[:g] sz rs,ea_mem xorc.w imm16,sr
1274 mov[:g] sz ea,rd
1275
1276
1277File: as.info, Node: HPPA-Dependent, Next: ESA/390-Dependent, Prev: H8/500-Dependent, Up: Machine Dependencies
1278
1279HPPA Dependent Features
1280=======================
1281
1282* Menu:
1283
1284* HPPA Notes:: Notes
1285* HPPA Options:: Options
1286* HPPA Syntax:: Syntax
1287* HPPA Floating Point:: Floating Point
1288* HPPA Directives:: HPPA Machine Directives
1289* HPPA Opcodes:: Opcodes
1290
1291
1292File: as.info, Node: HPPA Notes, Next: HPPA Options, Up: HPPA-Dependent
1293
1294Notes
1295-----
1296
1297 As a back end for GNU CC `as' has been throughly tested and should
1298work extremely well. We have tested it only minimally on hand written
1299assembly code and no one has tested it much on the assembly output from
1300the HP compilers.
1301
1302 The format of the debugging sections has changed since the original
1303`as' port (version 1.3X) was released; therefore, you must rebuild all
1304HPPA objects and libraries with the new assembler so that you can debug
1305the final executable.
1306
1307 The HPPA `as' port generates a small subset of the relocations
1308available in the SOM and ELF object file formats. Additional relocation
1309support will be added as it becomes necessary.
1310
1311
1312File: as.info, Node: HPPA Options, Next: HPPA Syntax, Prev: HPPA Notes, Up: HPPA-Dependent
1313
1314Options
1315-------
1316
1317 `as' has no machine-dependent command-line options for the HPPA.
1318
1319
1320File: as.info, Node: HPPA Syntax, Next: HPPA Floating Point, Prev: HPPA Options, Up: HPPA-Dependent
1321
1322Syntax
1323------
1324
1325 The assembler syntax closely follows the HPPA instruction set
1326reference manual; assembler directives and general syntax closely
1327follow the HPPA assembly language reference manual, with a few
1328noteworthy differences.
1329
1330 First, a colon may immediately follow a label definition. This is
1331simply for compatibility with how most assembly language programmers
1332write code.
1333
1334 Some obscure expression parsing problems may affect hand written
1335code which uses the `spop' instructions, or code which makes significant
1336use of the `!' line separator.
1337
1338 `as' is much less forgiving about missing arguments and other
1339similar oversights than the HP assembler. `as' notifies you of missing
1340arguments as syntax errors; this is regarded as a feature, not a bug.
1341
1342 Finally, `as' allows you to use an external symbol without
1343explicitly importing the symbol. _Warning:_ in the future this will be
1344an error for HPPA targets.
1345
1346 Special characters for HPPA targets include:
1347
1348 `;' is the line comment character.
1349
1350 `!' can be used instead of a newline to separate statements.
1351
1352 Since `$' has no special meaning, you may use it in symbol names.
1353
1354
1355File: as.info, Node: HPPA Floating Point, Next: HPPA Directives, Prev: HPPA Syntax, Up: HPPA-Dependent
1356
1357Floating Point
1358--------------
1359
1360 The HPPA family uses IEEE floating-point numbers.
1361
Note: See TracBrowser for help on using the repository browser.