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