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