@c Copyright 1997, 2002, 2003 Free Software Foundation, Inc.@c This is part of the GAS manual.@c For copying conditions, see the file as.texinfo.@node V850-Dependent@chapter v850 Dependent Features@cindex V850 support@menu* V850 Options:: Options* V850 Syntax:: Syntax* V850 Floating Point:: Floating Point* V850 Directives:: V850 Machine Directives* V850 Opcodes:: Opcodes@end menu@node V850 Options@section Options@cindex V850 options (none)@cindex options for V850 (none)@code{@value{AS}} supports the following additional command-line optionsfor the V850 processor family:@cindex command line options, V850@cindex V850 command line options@table @code@cindex @code{-wsigned_overflow} command line option, V850@item -wsigned_overflowCauses warnings to be produced when signed immediate values overflow thespace available for then within their opcodes. By default this optionis disabled as it is possible to receive spurious warnings due to usingexact bit patterns as immediate constants.@cindex @code{-wunsigned_overflow} command line option, V850@item -wunsigned_overflowCauses warnings to be produced when unsigned immediate values overflowthe space available for then within their opcodes. By default thisoption is disabled as it is possible to receive spurious warnings due tousing exact bit patterns as immediate constants.@cindex @code{-mv850} command line option, V850@item -mv850Specifies that the assembled code should be marked as being targeted atthe V850 processor. This allows the linker to detect attempts to linksuch code with code assembled for other processors.@cindex @code{-mv850e} command line option, V850@item -mv850eSpecifies that the assembled code should be marked as being targeted atthe V850E processor. This allows the linker to detect attempts to linksuch code with code assembled for other processors.@cindex @code{-mv850e1} command line option, V850@item -mv850e1Specifies that the assembled code should be marked as being targeted atthe V850E1 processor. This allows the linker to detect attempts to linksuch code with code assembled for other processors.@cindex @code{-mv850any} command line option, V850@item -mv850anySpecifies that the assembled code should be marked as being targeted atthe V850 processor but support instructions that are specific to theextended variants of the process. This allows the production ofbinaries that contain target specific code, but which are also intendedto be used in a generic fashion. For example libgcc.a contains genericroutines used by the code produced by GCC for all versions of the v850architecture, together with support routines only used by the V850Earchitecture.@cindex @code{-mrelax} command line option, V850@item -mrelaxEnables relaxation. This allows the .longcall and .longjump pseudoops to be used in the assembler source code. These ops label sectionsof code which are either a long function call or a long branch. Theassembler will then flag these sections of code and the linker willattempt to relax them.@end table@node V850 Syntax@section Syntax@menu* V850-Chars:: Special Characters* V850-Regs:: Register Names@end menu@node V850-Chars@subsection Special Characters@cindex line comment character, V850@cindex V850 line comment character@samp{#} is the line comment character.@node V850-Regs@subsection Register Names@cindex V850 register names@cindex register names, V850@code{@value{AS}} supports the following names for registers:@table @code@cindex @code{zero} register, V850@item general register 0r0, zero@item general register 1r1@item general register 2r2, hp@cindex @code{sp} register, V850@item general register 3r3, sp@cindex @code{gp} register, V850@item general register 4r4, gp@cindex @code{tp} register, V850@item general register 5r5, tp@item general register 6r6@item general register 7r7@item general register 8r8@item general register 9r9@item general register 10r10@item general register 11r11@item general register 12r12@item general register 13r13@item general register 14r14@item general register 15r15@item general register 16r16@item general register 17r17@item general register 18r18@item general register 19r19@item general register 20r20@item general register 21r21@item general register 22r22@item general register 23r23@item general register 24r24@item general register 25r25@item general register 26r26@item general register 27r27@item general register 28r28@item general register 29r29@cindex @code{ep} register, V850@item general register 30r30, ep@cindex @code{lp} register, V850@item general register 31r31, lp@cindex @code{eipc} register, V850@item system register 0eipc@cindex @code{eipsw} register, V850@item system register 1eipsw@cindex @code{fepc} register, V850@item system register 2fepc@cindex @code{fepsw} register, V850@item system register 3fepsw@cindex @code{ecr} register, V850@item system register 4ecr@cindex @code{psw} register, V850@item system register 5psw@cindex @code{ctpc} register, V850@item system register 16ctpc@cindex @code{ctpsw} register, V850@item system register 17ctpsw@cindex @code{dbpc} register, V850@item system register 18dbpc@cindex @code{dbpsw} register, V850@item system register 19dbpsw@cindex @code{ctbp} register, V850@item system register 20ctbp@end table@node V850 Floating Point@section Floating Point@cindex floating point, V850 (@sc{ieee})@cindex V850 floating point (@sc{ieee})The V850 family uses @sc{ieee} floating-point numbers.@node V850 Directives@section V850 Machine Directives@cindex machine directives, V850@cindex V850 machine directives@table @code@cindex @code{offset} directive, V850@item .offset @var{<expression>}Moves the offset into the current section to the specified amount.@cindex @code{section} directive, V850@item .section "name", <type>This is an extension to the standard .section directive. It sets thecurrent section to be <type> and creates an alias for this sectioncalled "name".@cindex @code{.v850} directive, V850@item .v850Specifies that the assembled code should be marked as being targeted atthe V850 processor. This allows the linker to detect attempts to linksuch code with code assembled for other processors.@cindex @code{.v850e} directive, V850@item .v850eSpecifies that the assembled code should be marked as being targeted atthe V850E processor. This allows the linker to detect attempts to linksuch code with code assembled for other processors.@cindex @code{.v850e1} directive, V850@item .v850e1Specifies that the assembled code should be marked as being targeted atthe V850E1 processor. This allows the linker to detect attempts to linksuch code with code assembled for other processors.@end table@node V850 Opcodes@section Opcodes@cindex V850 opcodes@cindex opcodes for V850@code{@value{AS}} implements all the standard V850 opcodes.@code{@value{AS}} also implements the following pseudo ops:@table @code@cindex @code{hi0} pseudo-op, V850@item hi0()Computes the higher 16 bits of the given expression and stores it intothe immediate operand field of the given instruction. For example:@samp{mulhi hi0(here - there), r5, r6}computes the difference between the address of labels 'here' and'there', takes the upper 16 bits of this difference, shifts it down 16bits and then mutliplies it by the lower 16 bits in register 5, puttingthe result into register 6.@cindex @code{lo} pseudo-op, V850@item lo()Computes the lower 16 bits of the given expression and stores it intothe immediate operand field of the given instruction. For example:@samp{addi lo(here - there), r5, r6}computes the difference between the address of labels 'here' and'there', takes the lower 16 bits of this difference and adds it toregister 5, putting the result into register 6.@cindex @code{hi} pseudo-op, V850@item hi()Computes the higher 16 bits of the given expression and then adds thevalue of the most significant bit of the lower 16 bits of the expressionand stores the result into the immediate operand field of the giveninstruction. For example the following code can be used to compute theaddress of the label 'here' and store it into register 6:@samp{movhi hi(here), r0, r6}@samp{movea lo(here), r6, r6}The reason for this special behaviour is that movea performs a signextension on its immediate operand. So for example if the address of'here' was 0xFFFFFFFF then without the special behaviour of the hi()pseudo-op the movhi instruction would put 0xFFFF0000 into r6, then themovea instruction would takes its immediate operand, 0xFFFF, sign extendit to 32 bits, 0xFFFFFFFF, and then add it into r6 giving 0xFFFEFFFFwhich is wrong (the fifth nibble is E). With the hi() pseudo op addingin the top bit of the lo() pseudo op, the movhi instruction actuallystores 0 into r6 (0xFFFF + 1 = 0x0000), so that the movea instructionstores 0xFFFFFFFF into r6 - the right value.@cindex @code{hilo} pseudo-op, V850@item hilo()Computes the 32 bit value of the given expression and stores it intothe immediate operand field of the given instruction (which must be amov instruction). For example:@samp{mov hilo(here), r6}computes the absolute address of label 'here' and puts the result intoregister 6.@cindex @code{sdaoff} pseudo-op, V850@item sdaoff()Computes the offset of the named variable from the start of the SmallData Area (whoes address is held in register 4, the GP register) andstores the result as a 16 bit signed value in the immediate operandfield of the given instruction. For example:@samp{ld.w sdaoff(_a_variable)[gp],r6}loads the contents of the location pointed to by the label '_a_variable'into register 6, provided that the label is located somewhere within +/-32K of the address held in the GP register. [Note the linker assumesthat the GP register contains a fixed address set to the address of thelabel called '__gp'. This can either be set up automatically by thelinker, or specifically set by using the @samp{--defsym __gp=<value>}command line option].@cindex @code{tdaoff} pseudo-op, V850@item tdaoff()Computes the offset of the named variable from the start of the TinyData Area (whoes address is held in register 30, the EP register) andstores the result as a 4,5, 7 or 8 bit unsigned value in the immediateoperand field of the given instruction. For example:@samp{sld.w tdaoff(_a_variable)[ep],r6}loads the contents of the location pointed to by the label '_a_variable'into register 6, provided that the label is located somewhere within +256bytes of the address held in the EP register. [Note the linker assumesthat the EP register contains a fixed address set to the address of thelabel called '__ep'. This can either be set up automatically by thelinker, or specifically set by using the @samp{--defsym __ep=<value>}command line option].@cindex @code{zdaoff} pseudo-op, V850@item zdaoff()Computes the offset of the named variable from address 0 and stores theresult as a 16 bit signed value in the immediate operand field of thegiven instruction. For example:@samp{movea zdaoff(_a_variable),zero,r6}puts the address of the label '_a_variable' into register 6, assumingthat the label is somewhere within the first 32K of memory. (Strictlyspeaking it also possible to access the last 32K of memory as well, asthe offsets are signed).@cindex @code{ctoff} pseudo-op, V850@item ctoff()Computes the offset of the named variable from the start of the CallTable Area (whoes address is helg in system register 20, the CTBPregister) and stores the result a 6 or 16 bit unsigned value in theimmediate field of then given instruction or piece of data. Forexample:@samp{callt ctoff(table_func1)}will put the call the function whoes address is held in the call tableat the location labeled 'table_func1'.@cindex @code{longcall} pseudo-op, V850@item .longcall @code{name}Indicates that the following sequence of instructions is a long callto function @code{name}. The linker will attempt to shorten this callsequence if @code{name} is within a 22bit offset of the call. Onlyvalid if the @code{-mrelax} command line switch has been enabled.@cindex @code{longjump} pseudo-op, V850@item .longjump @code{name}Indicates that the following sequence of instructions is a long jumpto label @code{name}. The linker will attempt to shorten this codesequence if @code{name} is within a 22bit offset of the jump. Onlyvalid if the @code{-mrelax} command line switch has been enabled.@end tableFor information on the V850 instruction set, see @cite{V850Family 32-/16-Bit single-Chip Microcontroller Architecture Manual} from NEC.Ltd.