1 @c Copyright (C) 1997, 1998 Free Software Foundation, Inc.
2 @c This is part of the GAS manual.
3 @c For copying conditions, see the file as.texinfo.
6 @chapter v850 Dependent Features
10 * V850 Options:: Options
11 * V850 Syntax:: Syntax
12 * V850 Floating Point:: Floating Point
13 * V850 Directives:: V850 Machine Directives
14 * V850 Opcodes:: Opcodes
19 @cindex V850 options (none)
20 @cindex options for V850 (none)
21 @code{@value{AS}} supports the following additional command-line options
22 for the V850 processor family:
24 @cindex command line options, V850
25 @cindex V850 command line options
28 @cindex @code{-wsigned_overflow} command line option, V850
29 @item -wsigned_overflow
30 Causes warnings to be produced when signed immediate values overflow the
31 space available for then within their opcodes. By default this option
32 is disabled as it is possible to receive spurious warnings due to using
33 exact bit patterns as immediate constants.
35 @cindex @code{-wunsigned_overflow} command line option, V850
36 @item -wunsigned_overflow
37 Causes warnings to be produced when unsigned immediate values overflow
38 the space available for then within their opcodes. By default this
39 option is disabled as it is possible to receive spurious warnings due to
40 using exact bit patterns as immediate constants.
42 @cindex @code{-mv850} command line option, V850
44 Specifies that the assembled code should be marked as being targeted at
45 the V850 processor. This allows the linker to detect attempts to link
46 such code with code assembled for other processors.
48 @cindex @code{-mv850e} command line option, V850
50 Specifies that the assembled code should be marked as being targeted at
51 the V850E processor. This allows the linker to detect attempts to link
52 such code with code assembled for other processors.
54 @cindex @code{-mv850any} command line option, V850
56 Specifies that the assembled code should be marked as being targeted at
57 the V850 processor but support instructions that are specific to the
58 extended variants of the process. This allows the production of
59 binaries that contain target specific code, but which are also intended
60 to be used in a generic fashion. For example libgcc.a contains generic
61 routines used by the code produced by GCC for all versions of the v850
62 architecture, together with support routines only used by the V850E
71 * V850-Chars:: Special Characters
72 * V850-Regs:: Register Names
76 @subsection Special Characters
78 @cindex line comment character, V850
79 @cindex V850 line comment character
80 @samp{#} is the line comment character.
82 @subsection Register Names
84 @cindex V850 register names
85 @cindex register names, V850
86 @code{@value{AS}} supports the following names for registers:
88 @cindex @code{zero} register, V850
89 @item general register 0
91 @item general register 1
93 @item general register 2
95 @cindex @code{sp} register, V850
96 @item general register 3
98 @cindex @code{gp} register, V850
99 @item general register 4
101 @cindex @code{tp} register, V850
102 @item general register 5
104 @item general register 6
106 @item general register 7
108 @item general register 8
110 @item general register 9
112 @item general register 10
114 @item general register 11
116 @item general register 12
118 @item general register 13
120 @item general register 14
122 @item general register 15
124 @item general register 16
126 @item general register 17
128 @item general register 18
130 @item general register 19
132 @item general register 20
134 @item general register 21
136 @item general register 22
138 @item general register 23
140 @item general register 24
142 @item general register 25
144 @item general register 26
146 @item general register 27
148 @item general register 28
150 @item general register 29
152 @cindex @code{ep} register, V850
153 @item general register 30
155 @cindex @code{lp} register, V850
156 @item general register 31
158 @cindex @code{eipc} register, V850
159 @item system register 0
161 @cindex @code{eipsw} register, V850
162 @item system register 1
164 @cindex @code{fepc} register, V850
165 @item system register 2
167 @cindex @code{fepsw} register, V850
168 @item system register 3
170 @cindex @code{ecr} register, V850
171 @item system register 4
173 @cindex @code{psw} register, V850
174 @item system register 5
176 @cindex @code{ctpc} register, V850
177 @item system register 16
179 @cindex @code{ctpsw} register, V850
180 @item system register 17
182 @cindex @code{dbpc} register, V850
183 @item system register 18
185 @cindex @code{dbpsw} register, V850
186 @item system register 19
188 @cindex @code{ctbp} register, V850
189 @item system register 20
193 @node V850 Floating Point
194 @section Floating Point
196 @cindex floating point, V850 (@sc{ieee})
197 @cindex V850 floating point (@sc{ieee})
198 The V850 family uses @sc{ieee} floating-point numbers.
200 @node V850 Directives
201 @section V850 Machine Directives
203 @cindex machine directives, V850
204 @cindex V850 machine directives
206 @cindex @code{offset} directive, V850
207 @item .offset @var{<expression>}
208 Moves the offset into the current section to the specified amount.
210 @cindex @code{section} directive, V850
211 @item .section "name", <type>
212 This is an extension to the standard .section directive. It sets the
213 current section to be <type> and creates an alias for this section
216 @cindex @code{.v850} directive, V850
218 Specifies that the assembled code should be marked as being targeted at
219 the V850 processor. This allows the linker to detect attempts to link
220 such code with code assembled for other processors.
222 @cindex @code{.v850e} directive, V850
224 Specifies that the assembled code should be marked as being targeted at
225 the V850E processor. This allows the linker to detect attempts to link
226 such code with code assembled for other processors.
234 @cindex opcodes for V850
235 @code{@value{AS}} implements all the standard V850 opcodes.
237 @code{@value{AS}} also implements the following pseudo ops:
241 @cindex @code{hi0} pseudo-op, V850
243 Computes the higher 16 bits of the given expression and stores it into
244 the immediate operand field of the given instruction. For example:
246 @samp{mulhi hi0(here - there), r5, r6}
248 computes the difference between the address of labels 'here' and
249 'there', takes the upper 16 bits of this difference, shifts it down 16
250 bits and then mutliplies it by the lower 16 bits in register 5, putting
251 the result into register 6.
253 @cindex @code{lo} pseudo-op, V850
255 Computes the lower 16 bits of the given expression and stores it into
256 the immediate operand field of the given instruction. For example:
258 @samp{addi lo(here - there), r5, r6}
260 computes the difference between the address of labels 'here' and
261 'there', takes the lower 16 bits of this difference and adds it to
262 register 5, putting the result into register 6.
264 @cindex @code{hi} pseudo-op, V850
266 Computes the higher 16 bits of the given expression and then adds the
267 value of the most significant bit of the lower 16 bits of the expression
268 and stores the result into the immediate operand field of the given
269 instruction. For example the following code can be used to compute the
270 address of the label 'here' and store it into register 6:
272 @samp{movhi hi(here), r0, r6}
273 @samp{movea lo(here), r6, r6}
275 The reason for this special behaviour is that movea performs a sign
276 extention on its immediate operand. So for example if the address of
277 'here' was 0xFFFFFFFF then without the special behaviour of the hi()
278 pseudo-op the movhi instruction would put 0xFFFF0000 into r6, then the
279 movea instruction would takes its immediate operand, 0xFFFF, sign extend
280 it to 32 bits, 0xFFFFFFFF, and then add it into r6 giving 0xFFFEFFFF
281 which is wrong (the fifth nibble is E). With the hi() pseudo op adding
282 in the top bit of the lo() pseudo op, the movhi instruction actually
283 stores 0 into r6 (0xFFFF + 1 = 0x0000), so that the movea instruction
284 stores 0xFFFFFFFF into r6 - the right value.
286 @cindex @code{hilo} pseudo-op, V850
288 Computes the 32 bit value of the given expression and stores it into
289 the immediate operand field of the given instruction (which must be a
290 mov instruction). For example:
292 @samp{mov hilo(here), r6}
294 computes the absolute address of label 'here' and puts the result into
297 @cindex @code{sdaoff} pseudo-op, V850
299 Computes the offset of the named variable from the start of the Small
300 Data Area (whoes address is held in register 4, the GP register) and
301 stores the result as a 16 bit signed value in the immediate operand
302 field of the given instruction. For example:
304 @samp{ld.w sdaoff(_a_variable)[gp],r6}
306 loads the contents of the location pointed to by the label '_a_variable'
307 into register 6, provided that the label is located somewhere within +/-
308 32K of the address held in the GP register. [Note the linker assumes
309 that the GP register contains a fixed address set to the address of the
310 label called '__gp'. This can either be set up automatically by the
311 linker, or specifically set by using the @samp{--defsym __gp=<value>}
312 command line option].
314 @cindex @code{tdaoff} pseudo-op, V850
316 Computes the offset of the named variable from the start of the Tiny
317 Data Area (whoes address is held in register 30, the EP register) and
318 stores the result as a 4,5, 7 or 8 bit unsigned value in the immediate
319 operand field of the given instruction. For example:
321 @samp{sld.w tdaoff(_a_variable)[ep],r6}
323 loads the contents of the location pointed to by the label '_a_variable'
324 into register 6, provided that the label is located somewhere within +256
325 bytes of the address held in the EP register. [Note the linker assumes
326 that the EP register contains a fixed address set to the address of the
327 label called '__ep'. This can either be set up automatically by the
328 linker, or specifically set by using the @samp{--defsym __ep=<value>}
329 command line option].
331 @cindex @code{zdaoff} pseudo-op, V850
333 Computes the offset of the named variable from address 0 and stores the
334 result as a 16 bit signed value in the immediate operand field of the
335 given instruction. For example:
337 @samp{movea zdaoff(_a_variable),zero,r6}
339 puts the address of the label '_a_variable' into register 6, assuming
340 that the label is somewhere within the first 32K of memory. (Strictly
341 speaking it also possible to access the last 32K of memory as well, as
342 the offsets are signed).
344 @cindex @code{ctoff} pseudo-op, V850
346 Computes the offset of the named variable from the start of the Call
347 Table Area (whoes address is helg in system register 20, the CTBP
348 register) and stores the result a 6 or 16 bit unsigned value in the
349 immediate field of then given instruction or piece of data. For
352 @samp{callt ctoff(table_func1)}
354 will put the call the function whoes address is held in the call table
355 at the location labeled 'table_func1'.
360 For information on the V850 instruction set, see @cite{V850
361 Family 32-/16-Bit single-Chip Microcontroller Architecture Manual} from NEC.