]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gas/doc/c-d10v.texi
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gas / doc / c-d10v.texi
CommitLineData
250d07de 1@c Copyright (C) 1996-2021 Free Software Foundation, Inc.
252b5132
RH
2@c This is part of the GAS manual.
3@c For copying conditions, see the file as.texinfo.
4@ifset GENERIC
5@page
6@node D10V-Dependent
7@chapter D10V Dependent Features
8@end ifset
9@ifclear GENERIC
10@node Machine Dependencies
11@chapter D10V Dependent Features
12@end ifclear
13
14@cindex D10V support
15@menu
16* D10V-Opts:: D10V Options
17* D10V-Syntax:: Syntax
18* D10V-Float:: Floating Point
19* D10V-Opcodes:: Opcodes
20@end menu
21
22@node D10V-Opts
23@section D10V Options
24@cindex options, D10V
25@cindex D10V options
26The Mitsubishi D10V version of @code{@value{AS}} has a few machine
27dependent options.
28
29@table @samp
30@item -O
31The D10V can often execute two sub-instructions in parallel. When this option
32is used, @code{@value{AS}} will attempt to optimize its output by detecting when
33instructions can be executed in parallel.
34@item --nowarnswap
35To optimize execution performance, @code{@value{AS}} will sometimes swap the
34bca508 36order of instructions. Normally this generates a warning. When this option
252b5132 37is used, no warning will be generated when instructions are swapped.
bccba5f0 38@item --gstabs-packing
1f9bb1ca 39@itemx --no-gstabs-packing
bccba5f0
NC
40@code{@value{AS}} packs adjacent short instructions into a single packed
41instruction. @samp{--no-gstabs-packing} turns instruction packing off if
42@samp{--gstabs} is specified as well; @samp{--gstabs-packing} (the
43default) turns instruction packing on even when @samp{--gstabs} is
44specified.
252b5132
RH
45@end table
46
47@node D10V-Syntax
48@section Syntax
49@cindex D10V syntax
50@cindex syntax, D10V
51
52The D10V syntax is based on the syntax in Mitsubishi's D10V architecture manual.
53The differences are detailed below.
54
55@menu
56* D10V-Size:: Size Modifiers
57* D10V-Subs:: Sub-Instructions
58* D10V-Chars:: Special Characters
59* D10V-Regs:: Register Names
60* D10V-Addressing:: Addressing Modes
61* D10V-Word:: @@WORD Modifier
62@end menu
63
64
65@node D10V-Size
66@subsection Size Modifiers
67@cindex D10V size modifiers
68@cindex size modifiers, D10V
69The D10V version of @code{@value{AS}} uses the instruction names in the D10V
70Architecture Manual. However, the names in the manual are sometimes ambiguous.
71There are instruction names that can assemble to a short or long form opcode.
72How does the assembler pick the correct form? @code{@value{AS}} will always pick the
73smallest form if it can. When dealing with a symbol that is not defined yet when a
34bca508 74line is being assembled, it will always use the long form. If you need to force the
252b5132 75assembler to use either the short or long form of the instruction, you can append
34bca508 76either @samp{.s} (short) or @samp{.l} (long) to it. For example, if you are writing
252b5132 77an assembly program and you want to do a branch to a symbol that is defined later
34bca508 78in your program, you can write @samp{bra.s foo}.
252b5132
RH
79Objdump and GDB will always append @samp{.s} or @samp{.l} to instructions which
80have both short and long forms.
81
82@node D10V-Subs
83@subsection Sub-Instructions
84@cindex D10V sub-instructions
85@cindex sub-instructions, D10V
86The D10V assembler takes as input a series of instructions, either one-per-line,
87or in the special two-per-line format described in the next section. Some of these
88instructions will be short-form or sub-instructions. These sub-instructions can be packed
89into a single instruction. The assembler will do this automatically. It will also detect
90when it should not pack instructions. For example, when a label is defined, the next
91instruction will never be packaged with the previous one. Whenever a branch and link
92instruction is called, it will not be packaged with the next instruction so the return
93address will be valid. Nops are automatically inserted when necessary.
94
95If you do not want the assembler automatically making these decisions, you can control
34bca508
L
96the packaging and execution type (parallel or sequential) with the special execution
97symbols described in the next section.
252b5132
RH
98
99@node D10V-Chars
100@subsection Special Characters
101@cindex line comment character, D10V
102@cindex D10V line comment character
7c31ae13
NC
103A semicolon (@samp{;}) can be used anywhere on a line to start a
104comment that extends to the end of the line.
105
106If a @samp{#} appears as the first character of a line, the whole line
107is treated as a comment, but in this case the line could also be a
108logical line number directive (@pxref{Comments}) or a preprocessor
109control command (@pxref{Preprocessing}).
110
252b5132
RH
111@cindex sub-instruction ordering, D10V
112@cindex D10V sub-instruction ordering
113Sub-instructions may be executed in order, in reverse-order, or in parallel.
114Instructions listed in the standard one-per-line format will be executed sequentially.
34bca508 115To specify the executing order, use the following symbols:
252b5132
RH
116@table @samp
117@item ->
118Sequential with instruction on the left first.
119@item <-
120Sequential with instruction on the right first.
121@item ||
122Parallel
123@end table
124The D10V syntax allows either one instruction per line, one instruction per line with
125the execution symbol, or two instructions per line. For example
126@table @code
127@item abs a1 -> abs r0
128Execute these sequentially. The instruction on the right is in the right
129container and is executed second.
130@item abs r0 <- abs a1
131Execute these reverse-sequentially. The instruction on the right is in the right
132container, and is executed first.
133@item ld2w r2,@@r8+ || mac a0,r0,r7
134Execute these in parallel.
34bca508 135@item ld2w r2,@@r8+ ||
252b5132
RH
136@itemx mac a0,r0,r7
137Two-line format. Execute these in parallel.
34bca508 138@item ld2w r2,@@r8+
252b5132
RH
139@itemx mac a0,r0,r7
140Two-line format. Execute these sequentially. Assembler will
141put them in the proper containers.
142@item ld2w r2,@@r8+ ->
143@itemx mac a0,r0,r7
144Two-line format. Execute these sequentially. Same as above but
34bca508 145second instruction will always go into right container.
252b5132
RH
146@end table
147@cindex symbol names, @samp{$} in
148@cindex @code{$} in symbol names
149Since @samp{$} has no special meaning, you may use it in symbol names.
150
151@node D10V-Regs
152@subsection Register Names
153@cindex D10V registers
154@cindex registers, D10V
34bca508 155You can use the predefined symbols @samp{r0} through @samp{r15} to refer to the D10V
252b5132 156registers. You can also use @samp{sp} as an alias for @samp{r15}. The accumulators
34bca508
L
157are @samp{a0} and @samp{a1}. There are special register-pair names that may
158optionally be used in opcodes that require even-numbered registers. Register names are
159not case sensitive.
252b5132
RH
160
161Register Pairs
162@table @code
163@item r0-r1
164@item r2-r3
165@item r4-r5
166@item r6-r7
167@item r8-r9
168@item r10-r11
169@item r12-r13
170@item r14-r15
171@end table
172
173The D10V also has predefined symbols for these control registers and status bits:
174@table @code
175@item psw
176Processor Status Word
177@item bpsw
178Backup Processor Status Word
179@item pc
180Program Counter
181@item bpc
182Backup Program Counter
183@item rpt_c
184Repeat Count
185@item rpt_s
186Repeat Start address
187@item rpt_e
188Repeat End address
189@item mod_s
190Modulo Start address
191@item mod_e
192Modulo End address
193@item iba
194Instruction Break Address
195@item f0
196Flag 0
197@item f1
198Flag 1
199@item c
200Carry flag
201@end table
34bca508 202
252b5132
RH
203@node D10V-Addressing
204@subsection Addressing Modes
205@cindex addressing modes, D10V
206@cindex D10V addressing modes
207@code{@value{AS}} understands the following addressing modes for the D10V.
208@code{R@var{n}} in the following refers to any of the numbered
209registers, but @emph{not} the control registers.
210@table @code
211@item R@var{n}
212Register direct
213@item @@R@var{n}
214Register indirect
215@item @@R@var{n}+
216Register indirect with post-increment
217@item @@R@var{n}-
218Register indirect with post-decrement
219@item @@-SP
220Register indirect with pre-decrement
221@item @@(@var{disp}, R@var{n})
222Register indirect with displacement
223@item @var{addr}
34bca508 224PC relative address (for branch or rep).
252b5132
RH
225@item #@var{imm}
226Immediate data (the @samp{#} is optional and ignored)
227@end table
228
229@node D10V-Word
230@subsection @@WORD Modifier
231@cindex D10V @@word modifier
232@cindex @@word modifier, D10V
233Any symbol followed by @code{@@word} will be replaced by the symbol's value
234shifted right by 2. This is used in situations such as loading a register
235with the address of a function (or any other code fragment). For example, if
236you want to load a register with the location of the function @code{main} then
062b7c0c 237jump to that function, you could do it as follows:
252b5132
RH
238@smallexample
239@group
240ldi r2, main@@word
241jmp r2
242@end group
243@end smallexample
244
245@node D10V-Float
246@section Floating Point
247@cindex floating point, D10V
248@cindex D10V floating point
249The D10V has no hardware floating point, but the @code{.float} and @code{.double}
250directives generates @sc{ieee} floating-point numbers for compatibility
34bca508 251with other development tools.
252b5132
RH
252
253@node D10V-Opcodes
254@section Opcodes
255@cindex D10V opcode summary
256@cindex opcode summary, D10V
257@cindex mnemonics, D10V
258@cindex instruction summary, D10V
259For detailed information on the D10V machine instruction set, see
34bca508 260@cite{D10V Architecture: A VLIW Microprocessor for Multimedia Applications}
252b5132
RH
261(Mitsubishi Electric Corp.).
262@code{@value{AS}} implements all the standard D10V opcodes. The only changes are those
263described in the section on size modifiers
264