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