]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gas/doc/c-m32r.texi
* irix5-nat.c: Include mips-tdep.h.
[thirdparty/binutils-gdb.git] / gas / doc / c-m32r.texi
CommitLineData
9f7598c1 1@c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2003
f7e42eb4 2@c Free Software Foundation, Inc.
252b5132
RH
3@c This is part of the GAS manual.
4@c For copying conditions, see the file as.texinfo.
5@ifset GENERIC
6@page
7@node M32R-Dependent
8@chapter M32R Dependent Features
9@end ifset
10@ifclear GENERIC
11@node Machine Dependencies
12@chapter M32R Dependent Features
13@end ifclear
14
41acf796
DE
15@cindex M32R support
16@menu
17* M32R-Opts:: M32R Options
9f7598c1 18* M32R-Directives:: M32R Directives
41acf796
DE
19* M32R-Warnings:: M32R Warnings
20@end menu
21
22@node M32R-Opts
23@section M32R Options
24
25@cindex options, M32R
26@cindex M32R options
27
26597c86 28The Renease M32R version of @code{@value{AS}} has a few machine
41acf796
DE
29dependent options:
30
31@table @code
88845958 32
41acf796
DE
33@item -m32rx
34@cindex @samp{-m32rx} option, M32RX
35@cindex architecture options, M32RX
36@cindex M32R architecture options
37@code{@value{AS}} can assemble code for several different members of the
26597c86 38Renesas M32R family. Normally the default is to assemble code for
41acf796
DE
39the M32R microprocessor. This option may be used to change the default
40to the M32RX microprocessor, which adds some more instructions to the
41basic M32R instruction set, and some additional parameters to some of
42the original instructions.
43
88845958
NC
44@item -m32r2
45@cindex @samp{-m32rx} option, M32R2
46@cindex architecture options, M32R2
47@cindex M32R architecture options
48This option changes the target processor to the the M32R2
49microprocessor.
50
ded0aeb7
NC
51@item -m32r
52@cindex @samp{-m32r} option, M32R
53@cindex architecture options, M32R
54@cindex M32R architecture options
55This option can be used to restore the assembler's default behaviour of
56assembling for the M32R microprocessor. This can be useful if the
57default has been changed by a previous command line option.
58
88845958
NC
59@item -little
60@cindex @code{-little} option, M32R
61This option tells the assembler to produce little-endian code and
62data. The default is dependent upon how the toolchain was
63configured.
64
65@item -EL
66@cindex @code{-EL} option, M32R
67This is a synonum for @emph{-little}.
68
69@item -big
70@cindex @code{-big} option, M32R
71This option tells the assembler to produce big-endian code and
72data.
73
74@item -EB
75@cindex @code{-EB} option, M32R
76This is a synonum for @emph{-big}.
77
78@item -parallel
79@cindex @code{-parallel} option, M32RX
80This option tells the assembler to attempts to combine two sequential
81instructions into a single, parallel instruction, where it is legal to
82do so.
83
84@item -no-parallel
85@cindex @code{-no-parallel} option, M32RX
86This option disables a previously enabled @emph{-parallel} option.
87
88@item -O
89@cindex @code{-O} option, M32RX
90This option tells the assembler to attempt to optimize the
91instructions that it produces. This includes filling delay slots and
92converting sequential instructions into parallel ones. This option
93implies @emph{-parallel}.
94
41acf796
DE
95@item -warn-explicit-parallel-conflicts
96@cindex @samp{-warn-explicit-parallel-conflicts} option, M32RX
97Instructs @code{@value{AS}} to produce warning messages when
98questionable parallel instructions are encountered. This option is
99enabled by default, but @code{@value{GCC}} disables it when it invokes
100@code{@value{AS}} directly. Questionable instructions are those whoes
101behaviour would be different if they were executed sequentially. For
102example the code fragment @samp{mv r1, r2 || mv r3, r1} produces a
103different result from @samp{mv r1, r2 \n mv r3, r1} since the former
104moves r1 into r3 and then r2 into r1, whereas the later moves r2 into r1
105and r3.
106
107@item -Wp
108@cindex @samp{-Wp} option, M32RX
109This is a shorter synonym for the @emph{-warn-explicit-parallel-conflicts}
110option.
111
112@item -no-warn-explicit-parallel-conflicts
113@cindex @samp{-no-warn-explicit-parallel-conflicts} option, M32RX
114Instructs @code{@value{AS}} not to produce warning messages when
115questionable parallel instructions are encountered.
116
117@item -Wnp
118@cindex @samp{-Wnp} option, M32RX
119This is a shorter synonym for the @emph{-no-warn-explicit-parallel-conflicts}
120option.
121
88845958
NC
122@item -error-explicit-parallel-conflicts
123@cindex @samp{-error-explicit-parallel-conflicts} option, M32RX
124This option performs the same thing as the
125@emph{-warn-explicit-parallel-conflicts} expcept that instead of
126warning messages being produced, error messages will be produced. If
127any error messages are generated then GAS will not produce an output
128file.
129
130@item -no-error-explicit-parallel-conflicts
131@cindex @samp{-no-error-explicit-parallel-conflicts} option, M32RX
132This option disables a previously enabled
133@emph{-error-explicit-parallel-conflicts} option.
134
135@item -Ep
136@cindex @samp{-Ep} option, M32RX
137This is a shorter synonym for the @emph{-error-explicit-parallel-conflicts}
138option.
139
140@item -Enp
141@cindex @samp{-Enp} option, M32RX
142This is a shorter synonym for the @emph{-no-error-explicit-parallel-conflicts}
143option.
144
145@item -warn-unmatched-high
146@cindex @samp{-warn-unmatched-high} option, M32R
147This option tells the assembler to produce a warning message if a
148@code{.high} pseudo op is encountered without a mathcing @code{.low}
149pseudo op. The presence of such an unmatches pseudo op usually
150indicates a programming error.
151
152@item -no-warn-unmatched-high
153@cindex @samp{-no-warn-unmatched-high} option, M32R
154Disables a previously enabled @emph{-warn-unmatched-high} option.
155
156@item -Wuh
157@cindex @samp{-Wuh} option, M32RX
158This is a shorter synonym for the @emph{-warn-unmatched-high} option.
159
160@item -Wnuh
161@cindex @samp{-Wnuh} option, M32RX
162This is a shorter synonym for the @emph{-no-warn-unmatched-high} option.
163
41acf796
DE
164@end table
165
9f7598c1
NC
166@node M32R-Directives
167@section M32R Directives
168@cindex directives, M32R
169@cindex M32R directives
170
171The Renease M32R version of @code{@value{AS}} has a few architecture
172specific directives:
173
174@table @code
88845958
NC
175
176@cindex @code{low} directive, M32R
177@item low @var{expression}
178The @code{low} directive computes the value of its expression and
9f7598c1
NC
179places the lower 16-bits of the result into the immediate-field of the
180instruction. For example:
181
182@smallexample
183 or3 r0, r0, #low(0x12345678) ; compute r0 = r0 | 0x5678
184 add3, r0, r0, #low(fred) ; compute r0 = r0 + low 16-bits of address of fred
185@end smallexample
186
88845958
NC
187@item high @var{expression}
188@cindex @code{high} directive, M32R
189The @code{high} directive computes the value of its expression and
9f7598c1
NC
190places the upper 16-bits of the result into the immediate-field of the
191instruction. For example:
192
193@smallexample
194 seth r0, #high(0x12345678) ; compute r0 = 0x12340000
195 seth, r0, #high(fred) ; compute r0 = upper 16-bits of address of fred
196@end smallexample
197
88845958
NC
198@item shigh @var{expression}
199@cindex @code{shigh} directive, M32R
200The @code{shigh} directive is very similar to the @code{high}
9f7598c1
NC
201directive. It also computes the value of its expression and places
202the upper 16-bits of the result into the immediate-field of the
88845958 203instruction. The difference is that @code{shigh} also checks to see
9f7598c1
NC
204if the lower 16-bits could be interpreted as a signed number, and if
205so it assumes that a borrow will occur from the upper-16 bits. To
88845958 206compensate for this the @code{shigh} directive pre-biases the upper
9f7598c1
NC
20716 bit value by adding one to it. For example:
208
209For example:
210
211@smallexample
212 seth r0, #shigh(0x12345678) ; compute r0 = 0x12340000
213 seth r0, #shigh(0x00008000) ; compute r0 = 0x00010000
214@end smallexample
215
216In the second example the lower 16-bits are 0x8000. If these are
217treated as a signed value and sign extended to 32-bits then the value
218becomes 0xffff8000. If this value is then added to 0x00010000 then
219the result is 0x00008000.
220
221This behaviour is to allow for the different semantics of the
222@code{or3} and @code{add3} instructions. The @code{or3} instruction
223treats its 16-bit immediate argument as unsigned whereas the
224@code{add3} treats its 16-bit immediate as a signed value. So for
225example:
226
227@smallexample
228 seth r0, #shigh(0x00008000)
229 add3 r0, r0, #low(0x00008000)
230@end smallexample
231
232Produces the correct result in r0, whereas:
233
234@smallexample
235 seth r0, #shigh(0x00008000)
236 or3 r0, r0, #low(0x00008000)
237@end smallexample
238
239Stores 0xffff8000 into r0.
240
241Note - the @code{shigh} directive does not know where in the assembly
242source code the lower 16-bits of the value are going set, so it cannot
243check to make sure that an @code{or3} instruction is being used rather
244than an @code{add3} instruction. It is up to the programmer to make
245sure that correct directives are used.
88845958
NC
246
247@cindex @code{.m32r} directive, M32R
248@item .m32r
249The directive performs a similar thing as the @emph{-m32r} command
250line option. It tells the assembler to only accept M32R instructions
251from now on. An instructions from later M32R architectures are
252refused.
253
254@cindex @code{.m32rx} directive, M32RX
255@item .m32rx
256The directive performs a similar thing as the @emph{-m32rx} command
257line option. It tells the assembler to start accepting the extra
258instructions in the M32RX ISA as well as the ordinary M32R ISA.
259
260@cindex @code{.m32r2} directive, M32R2
261@item .m32r2
262The directive performs a similar thing as the @emph{-m32r2} command
263line option. It tells the assembler to start accepting the extra
264instructions in the M32R2 ISA as well as the ordinary M32R ISA.
265
266@cindex @code{.little} directive, M32RX
267@item .little
268The directive performs a similar thing as the @emph{-little} command
269line option. It tells the assembler to start producing little-endian
270code and data. This option should be used with care as producing
271mixed-endian binary files is frought with danger.
272
273@cindex @code{.big} directive, M32RX
274@item .big
275The directive performs a similar thing as the @emph{-big} command
276line option. It tells the assembler to start producing big-endian
277code and data. This option should be used with care as producing
278mixed-endian binary files is frought with danger.
279
9f7598c1
NC
280@end table
281
41acf796
DE
282@node M32R-Warnings
283@section M32R Warnings
284
285@cindex warnings, M32R
286@cindex M32R warnings
287
288There are several warning and error messages that can be produced by
289@code{@value{AS}} which are specific to the M32R:
290
291@table @code
292
293@item output of 1st instruction is the same as an input to 2nd instruction - is this intentional ?
294This message is only produced if warnings for explicit parallel
295conflicts have been enabled. It indicates that the assembler has
296encountered a parallel instruction in which the destination register of
297the left hand instruction is used as an input register in the right hand
298instruction. For example in this code fragment
299@samp{mv r1, r2 || neg r3, r1} register r1 is the destination of the
300move instruction and the input to the neg instruction.
301
302@item output of 2nd instruction is the same as an input to 1st instruction - is this intentional ?
303This message is only produced if warnings for explicit parallel
304conflicts have been enabled. It indicates that the assembler has
305encountered a parallel instruction in which the destination register of
306the right hand instruction is used as an input register in the left hand
307instruction. For example in this code fragment
308@samp{mv r1, r2 || neg r2, r3} register r2 is the destination of the
309neg instruction and the input to the move instruction.
310
311@item instruction @samp{...} is for the M32RX only
312This message is produced when the assembler encounters an instruction
313which is only supported by the M32Rx processor, and the @samp{-m32rx}
314command line flag has not been specified to allow assembly of such
315instructions.
316
317@item unknown instruction @samp{...}
318This message is produced when the assembler encounters an instruction
9f7598c1 319which it does not recognise.
41acf796
DE
320
321@item only the NOP instruction can be issued in parallel on the m32r
322This message is produced when the assembler encounters a parallel
323instruction which does not involve a NOP instruction and the
324@samp{-m32rx} command line flag has not been specified. Only the M32Rx
325processor is able to execute two instructions in parallel.
326
327@item instruction @samp{...} cannot be executed in parallel.
328This message is produced when the assembler encounters a parallel
329instruction which is made up of one or two instructions which cannot be
330executed in parallel.
331
332@item Instructions share the same execution pipeline
333This message is produced when the assembler encounters a parallel
334instruction whoes components both use the same execution pipeline.
335
336@item Instructions write to the same destination register.
337This message is produced when the assembler encounters a parallel
338instruction where both components attempt to modify the same register.
339For example these code fragments will produce this message:
340@samp{mv r1, r2 || neg r1, r3}
341@samp{jl r0 || mv r14, r1}
342@samp{st r2, @@-r1 || mv r1, r3}
343@samp{mv r1, r2 || ld r0, @@r1+}
344@samp{cmp r1, r2 || addx r3, r4} (Both write to the condition bit)
345
346@end table