]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gas/doc/c-v850.texi
Add linker relaxation to v850 toolchain
[thirdparty/binutils-gdb.git] / gas / doc / c-v850.texi
CommitLineData
f7e42eb4 1@c Copyright 1997 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
5@node V850-Dependent
6@chapter v850 Dependent Features
7
8@cindex V850 support
9@menu
10* V850 Options:: Options
11* V850 Syntax:: Syntax
12* V850 Floating Point:: Floating Point
13* V850 Directives:: V850 Machine Directives
14* V850 Opcodes:: Opcodes
15@end menu
16
17@node V850 Options
18@section Options
19@cindex V850 options (none)
20@cindex options for V850 (none)
21@code{@value{AS}} supports the following additional command-line options
22for the V850 processor family:
23
24@cindex command line options, V850
25@cindex V850 command line options
26@table @code
27
28@cindex @code{-wsigned_overflow} command line option, V850
29@item -wsigned_overflow
30Causes warnings to be produced when signed immediate values overflow the
31space available for then within their opcodes. By default this option
32is disabled as it is possible to receive spurious warnings due to using
33exact bit patterns as immediate constants.
34
35@cindex @code{-wunsigned_overflow} command line option, V850
36@item -wunsigned_overflow
37Causes warnings to be produced when unsigned immediate values overflow
38the space available for then within their opcodes. By default this
39option is disabled as it is possible to receive spurious warnings due to
40using exact bit patterns as immediate constants.
41
42@cindex @code{-mv850} command line option, V850
43@item -mv850
44Specifies that the assembled code should be marked as being targeted at
45the V850 processor. This allows the linker to detect attempts to link
46such code with code assembled for other processors.
47
48@cindex @code{-mv850e} command line option, V850
49@item -mv850e
50Specifies that the assembled code should be marked as being targeted at
51the V850E processor. This allows the linker to detect attempts to link
52such code with code assembled for other processors.
53
54@cindex @code{-mv850any} command line option, V850
55@item -mv850any
56Specifies that the assembled code should be marked as being targeted at
57the V850 processor but support instructions that are specific to the
58extended variants of the process. This allows the production of
59binaries that contain target specific code, but which are also intended
60to be used in a generic fashion. For example libgcc.a contains generic
61routines used by the code produced by GCC for all versions of the v850
62architecture, together with support routines only used by the V850E
63architecture.
64
86aba9db
NC
65@cindex @code{-mrelax} command line option, V850
66@item -mrelax
67Enables relaxation. This allows the .longcall and .longjump pseudo
68ops to be used in the assembler source code. These ops label sections
69of code which are either a long function call or a long branch. The
70assembler will then flag these sections of code and the linker will
71attempt to relax them.
72
252b5132
RH
73@end table
74
75
76@node V850 Syntax
77@section Syntax
78@menu
79* V850-Chars:: Special Characters
80* V850-Regs:: Register Names
81@end menu
82
83@node V850-Chars
84@subsection Special Characters
85
86@cindex line comment character, V850
87@cindex V850 line comment character
88@samp{#} is the line comment character.
89@node V850-Regs
90@subsection Register Names
91
92@cindex V850 register names
93@cindex register names, V850
94@code{@value{AS}} supports the following names for registers:
95@table @code
96@cindex @code{zero} register, V850
97@item general register 0
98r0, zero
99@item general register 1
100r1
101@item general register 2
102r2, hp
103@cindex @code{sp} register, V850
104@item general register 3
105r3, sp
106@cindex @code{gp} register, V850
107@item general register 4
108r4, gp
109@cindex @code{tp} register, V850
110@item general register 5
111r5, tp
112@item general register 6
113r6
114@item general register 7
115r7
116@item general register 8
117r8
118@item general register 9
119r9
120@item general register 10
121r10
122@item general register 11
123r11
124@item general register 12
125r12
126@item general register 13
127r13
128@item general register 14
129r14
130@item general register 15
131r15
132@item general register 16
133r16
134@item general register 17
135r17
136@item general register 18
137r18
138@item general register 19
139r19
140@item general register 20
141r20
142@item general register 21
143r21
144@item general register 22
145r22
146@item general register 23
147r23
148@item general register 24
149r24
150@item general register 25
151r25
152@item general register 26
153r26
154@item general register 27
155r27
156@item general register 28
157r28
158@item general register 29
159r29
160@cindex @code{ep} register, V850
161@item general register 30
162r30, ep
163@cindex @code{lp} register, V850
164@item general register 31
165r31, lp
166@cindex @code{eipc} register, V850
167@item system register 0
168eipc
169@cindex @code{eipsw} register, V850
170@item system register 1
171eipsw
172@cindex @code{fepc} register, V850
173@item system register 2
174fepc
175@cindex @code{fepsw} register, V850
176@item system register 3
177fepsw
178@cindex @code{ecr} register, V850
179@item system register 4
180ecr
181@cindex @code{psw} register, V850
182@item system register 5
183psw
184@cindex @code{ctpc} register, V850
185@item system register 16
186ctpc
187@cindex @code{ctpsw} register, V850
188@item system register 17
189ctpsw
190@cindex @code{dbpc} register, V850
191@item system register 18
192dbpc
193@cindex @code{dbpsw} register, V850
194@item system register 19
195dbpsw
196@cindex @code{ctbp} register, V850
197@item system register 20
198ctbp
199@end table
200
201@node V850 Floating Point
202@section Floating Point
203
204@cindex floating point, V850 (@sc{ieee})
205@cindex V850 floating point (@sc{ieee})
206The V850 family uses @sc{ieee} floating-point numbers.
207
208@node V850 Directives
209@section V850 Machine Directives
210
211@cindex machine directives, V850
212@cindex V850 machine directives
213@table @code
214@cindex @code{offset} directive, V850
215@item .offset @var{<expression>}
216Moves the offset into the current section to the specified amount.
217
218@cindex @code{section} directive, V850
219@item .section "name", <type>
220This is an extension to the standard .section directive. It sets the
221current section to be <type> and creates an alias for this section
222called "name".
223
224@cindex @code{.v850} directive, V850
225@item .v850
226Specifies that the assembled code should be marked as being targeted at
227the V850 processor. This allows the linker to detect attempts to link
228such code with code assembled for other processors.
229
230@cindex @code{.v850e} directive, V850
231@item .v850e
232Specifies that the assembled code should be marked as being targeted at
233the V850E processor. This allows the linker to detect attempts to link
234such code with code assembled for other processors.
235
236@end table
237
238@node V850 Opcodes
239@section Opcodes
240
241@cindex V850 opcodes
242@cindex opcodes for V850
243@code{@value{AS}} implements all the standard V850 opcodes.
244
245@code{@value{AS}} also implements the following pseudo ops:
246
247@table @code
248
249@cindex @code{hi0} pseudo-op, V850
250@item hi0()
251Computes the higher 16 bits of the given expression and stores it into
252the immediate operand field of the given instruction. For example:
253
254 @samp{mulhi hi0(here - there), r5, r6}
255
256computes the difference between the address of labels 'here' and
257'there', takes the upper 16 bits of this difference, shifts it down 16
258bits and then mutliplies it by the lower 16 bits in register 5, putting
259the result into register 6.
260
261@cindex @code{lo} pseudo-op, V850
262@item lo()
263Computes the lower 16 bits of the given expression and stores it into
264the immediate operand field of the given instruction. For example:
265
266 @samp{addi lo(here - there), r5, r6}
267
268computes the difference between the address of labels 'here' and
269'there', takes the lower 16 bits of this difference and adds it to
270register 5, putting the result into register 6.
271
272@cindex @code{hi} pseudo-op, V850
273@item hi()
274Computes the higher 16 bits of the given expression and then adds the
275value of the most significant bit of the lower 16 bits of the expression
276and stores the result into the immediate operand field of the given
277instruction. For example the following code can be used to compute the
278address of the label 'here' and store it into register 6:
279
280 @samp{movhi hi(here), r0, r6}
281 @samp{movea lo(here), r6, r6}
282
283The reason for this special behaviour is that movea performs a sign
284extention on its immediate operand. So for example if the address of
285'here' was 0xFFFFFFFF then without the special behaviour of the hi()
286pseudo-op the movhi instruction would put 0xFFFF0000 into r6, then the
287movea instruction would takes its immediate operand, 0xFFFF, sign extend
288it to 32 bits, 0xFFFFFFFF, and then add it into r6 giving 0xFFFEFFFF
289which is wrong (the fifth nibble is E). With the hi() pseudo op adding
290in the top bit of the lo() pseudo op, the movhi instruction actually
291stores 0 into r6 (0xFFFF + 1 = 0x0000), so that the movea instruction
292stores 0xFFFFFFFF into r6 - the right value.
293
294@cindex @code{hilo} pseudo-op, V850
295@item hilo()
296Computes the 32 bit value of the given expression and stores it into
297the immediate operand field of the given instruction (which must be a
298mov instruction). For example:
299
300 @samp{mov hilo(here), r6}
301
302computes the absolute address of label 'here' and puts the result into
303register 6.
304
305@cindex @code{sdaoff} pseudo-op, V850
306@item sdaoff()
307Computes the offset of the named variable from the start of the Small
308Data Area (whoes address is held in register 4, the GP register) and
309stores the result as a 16 bit signed value in the immediate operand
310field of the given instruction. For example:
311
312 @samp{ld.w sdaoff(_a_variable)[gp],r6}
313
314loads the contents of the location pointed to by the label '_a_variable'
315into register 6, provided that the label is located somewhere within +/-
31632K of the address held in the GP register. [Note the linker assumes
317that the GP register contains a fixed address set to the address of the
318label called '__gp'. This can either be set up automatically by the
319linker, or specifically set by using the @samp{--defsym __gp=<value>}
320command line option].
321
322@cindex @code{tdaoff} pseudo-op, V850
323@item tdaoff()
324Computes the offset of the named variable from the start of the Tiny
325Data Area (whoes address is held in register 30, the EP register) and
326stores the result as a 4,5, 7 or 8 bit unsigned value in the immediate
327operand field of the given instruction. For example:
328
329 @samp{sld.w tdaoff(_a_variable)[ep],r6}
330
331loads the contents of the location pointed to by the label '_a_variable'
332into register 6, provided that the label is located somewhere within +256
333bytes of the address held in the EP register. [Note the linker assumes
334that the EP register contains a fixed address set to the address of the
335label called '__ep'. This can either be set up automatically by the
336linker, or specifically set by using the @samp{--defsym __ep=<value>}
337command line option].
338
339@cindex @code{zdaoff} pseudo-op, V850
340@item zdaoff()
341Computes the offset of the named variable from address 0 and stores the
342result as a 16 bit signed value in the immediate operand field of the
343given instruction. For example:
344
345 @samp{movea zdaoff(_a_variable),zero,r6}
346
347puts the address of the label '_a_variable' into register 6, assuming
348that the label is somewhere within the first 32K of memory. (Strictly
349speaking it also possible to access the last 32K of memory as well, as
350the offsets are signed).
351
352@cindex @code{ctoff} pseudo-op, V850
353@item ctoff()
354Computes the offset of the named variable from the start of the Call
355Table Area (whoes address is helg in system register 20, the CTBP
356register) and stores the result a 6 or 16 bit unsigned value in the
357immediate field of then given instruction or piece of data. For
358example:
359
360 @samp{callt ctoff(table_func1)}
361
362will put the call the function whoes address is held in the call table
363at the location labeled 'table_func1'.
364
86aba9db
NC
365@cindex @code{longcall} pseudo-op, V850
366@item .longcall @code{name}
367Indicates that the following sequence of instructions is a long call
368to function @code{name}. The linker will attempt to shorten this call
369sequence if @code{name} is within a 22bit offset of the call. Only
370valid if the @code{-mrelax} command line switch has been enabled.
371
372@cindex @code{longjump} pseudo-op, V850
373@item .longjump @code{name}
374Indicates that the following sequence of instructions is a long jump
375to label @code{name}. The linker will attempt to shorten this code
376sequence if @code{name} is within a 22bit offset of the jump. Only
377valid if the @code{-mrelax} command line switch has been enabled.
378
252b5132
RH
379@end table
380
381
382For information on the V850 instruction set, see @cite{V850
383Family 32-/16-Bit single-Chip Microcontroller Architecture Manual} from NEC.
384Ltd.