1*f7cc78ecSespie@c Copyright (C) 1997 Free Software Foundation, Inc. 2*f7cc78ecSespie@c This is part of the GAS manual. 3*f7cc78ecSespie@c For copying conditions, see the file as.texinfo. 4*f7cc78ecSespie@ifset GENERIC 5*f7cc78ecSespie@page 6*f7cc78ecSespie@node D30V-Dependent 7*f7cc78ecSespie@chapter D30V Dependent Features 8*f7cc78ecSespie@end ifset 9*f7cc78ecSespie@ifclear GENERIC 10*f7cc78ecSespie@node Machine Dependencies 11*f7cc78ecSespie@chapter D30V Dependent Features 12*f7cc78ecSespie@end ifclear 13*f7cc78ecSespie 14*f7cc78ecSespie@cindex D30V support 15*f7cc78ecSespie@menu 16*f7cc78ecSespie* D30V-Opts:: D30V Options 17*f7cc78ecSespie* D30V-Syntax:: Syntax 18*f7cc78ecSespie* D30V-Float:: Floating Point 19*f7cc78ecSespie* D30V-Opcodes:: Opcodes 20*f7cc78ecSespie@end menu 21*f7cc78ecSespie 22*f7cc78ecSespie@node D30V-Opts 23*f7cc78ecSespie@section D30V Options 24*f7cc78ecSespie@cindex options, D30V 25*f7cc78ecSespie@cindex D30V options 26*f7cc78ecSespieThe Mitsubishi D30V version of @code{@value{AS}} has a few machine 27*f7cc78ecSespiedependent options. 28*f7cc78ecSespie 29*f7cc78ecSespie@table @samp 30*f7cc78ecSespie@item -O 31*f7cc78ecSespieThe D30V can often execute two sub-instructions in parallel. When this option 32*f7cc78ecSespieis used, @code{@value{AS}} will attempt to optimize its output by detecting when 33*f7cc78ecSespieinstructions can be executed in parallel. 34*f7cc78ecSespie 35*f7cc78ecSespie@item -n 36*f7cc78ecSespieWhen this option is used, @code{@value{AS}} will issue a warning every 37*f7cc78ecSespietime it adds a nop instruction. 38*f7cc78ecSespie 39*f7cc78ecSespie@item -N 40*f7cc78ecSespieWhen this option is used, @code{@value{AS}} will issue a warning if it 41*f7cc78ecSespieneeds to insert a nop after a 32-bit multiply before a load or 16-bit 42*f7cc78ecSespiemultiply instruction. 43*f7cc78ecSespie@end table 44*f7cc78ecSespie 45*f7cc78ecSespie@node D30V-Syntax 46*f7cc78ecSespie@section Syntax 47*f7cc78ecSespie@cindex D30V syntax 48*f7cc78ecSespie@cindex syntax, D30V 49*f7cc78ecSespie 50*f7cc78ecSespieThe D30V syntax is based on the syntax in Mitsubishi's D30V architecture manual. 51*f7cc78ecSespieThe differences are detailed below. 52*f7cc78ecSespie 53*f7cc78ecSespie@menu 54*f7cc78ecSespie* D30V-Size:: Size Modifiers 55*f7cc78ecSespie* D30V-Subs:: Sub-Instructions 56*f7cc78ecSespie* D30V-Chars:: Special Characters 57*f7cc78ecSespie* D30V-Guarded:: Guarded Execution 58*f7cc78ecSespie* D30V-Regs:: Register Names 59*f7cc78ecSespie* D30V-Addressing:: Addressing Modes 60*f7cc78ecSespie@end menu 61*f7cc78ecSespie 62*f7cc78ecSespie 63*f7cc78ecSespie@node D30V-Size 64*f7cc78ecSespie@subsection Size Modifiers 65*f7cc78ecSespie@cindex D30V size modifiers 66*f7cc78ecSespie@cindex size modifiers, D30V 67*f7cc78ecSespieThe D30V version of @code{@value{AS}} uses the instruction names in the D30V 68*f7cc78ecSespieArchitecture Manual. However, the names in the manual are sometimes ambiguous. 69*f7cc78ecSespieThere are instruction names that can assemble to a short or long form opcode. 70*f7cc78ecSespieHow does the assembler pick the correct form? @code{@value{AS}} will always pick the 71*f7cc78ecSespiesmallest form if it can. When dealing with a symbol that is not defined yet when a 72*f7cc78ecSespieline is being assembled, it will always use the long form. If you need to force the 73*f7cc78ecSespieassembler to use either the short or long form of the instruction, you can append 74*f7cc78ecSespieeither @samp{.s} (short) or @samp{.l} (long) to it. For example, if you are writing 75*f7cc78ecSespiean assembly program and you want to do a branch to a symbol that is defined later 76*f7cc78ecSespiein your program, you can write @samp{bra.s foo}. 77*f7cc78ecSespieObjdump and GDB will always append @samp{.s} or @samp{.l} to instructions which 78*f7cc78ecSespiehave both short and long forms. 79*f7cc78ecSespie 80*f7cc78ecSespie@node D30V-Subs 81*f7cc78ecSespie@subsection Sub-Instructions 82*f7cc78ecSespie@cindex D30V sub-instructions 83*f7cc78ecSespie@cindex sub-instructions, D30V 84*f7cc78ecSespieThe D30V assembler takes as input a series of instructions, either one-per-line, 85*f7cc78ecSespieor in the special two-per-line format described in the next section. Some of these 86*f7cc78ecSespieinstructions will be short-form or sub-instructions. These sub-instructions can be packed 87*f7cc78ecSespieinto a single instruction. The assembler will do this automatically. It will also detect 88*f7cc78ecSespiewhen it should not pack instructions. For example, when a label is defined, the next 89*f7cc78ecSespieinstruction will never be packaged with the previous one. Whenever a branch and link 90*f7cc78ecSespieinstruction is called, it will not be packaged with the next instruction so the return 91*f7cc78ecSespieaddress will be valid. Nops are automatically inserted when necessary. 92*f7cc78ecSespie 93*f7cc78ecSespieIf you do not want the assembler automatically making these decisions, you can control 94*f7cc78ecSespiethe packaging and execution type (parallel or sequential) with the special execution 95*f7cc78ecSespiesymbols described in the next section. 96*f7cc78ecSespie 97*f7cc78ecSespie@node D30V-Chars 98*f7cc78ecSespie@subsection Special Characters 99*f7cc78ecSespie@cindex line comment character, D30V 100*f7cc78ecSespie@cindex D30V line comment character 101*f7cc78ecSespie@samp{;} and @samp{#} are the line comment characters. 102*f7cc78ecSespie@cindex sub-instruction ordering, D30V 103*f7cc78ecSespie@cindex D30V sub-instruction ordering 104*f7cc78ecSespieSub-instructions may be executed in order, in reverse-order, or in parallel. 105*f7cc78ecSespieInstructions listed in the standard one-per-line format will be executed 106*f7cc78ecSespiesequentially unless you use the @samp{-O} option. 107*f7cc78ecSespie 108*f7cc78ecSespieTo specify the executing order, use the following symbols: 109*f7cc78ecSespie@table @samp 110*f7cc78ecSespie@item -> 111*f7cc78ecSespieSequential with instruction on the left first. 112*f7cc78ecSespie 113*f7cc78ecSespie@item <- 114*f7cc78ecSespieSequential with instruction on the right first. 115*f7cc78ecSespie 116*f7cc78ecSespie@item || 117*f7cc78ecSespieParallel 118*f7cc78ecSespie@end table 119*f7cc78ecSespie 120*f7cc78ecSespieThe D30V syntax allows either one instruction per line, one instruction per line with 121*f7cc78ecSespiethe execution symbol, or two instructions per line. For example 122*f7cc78ecSespie@table @code 123*f7cc78ecSespie@item abs r2,r3 -> abs r4,r5 124*f7cc78ecSespieExecute these sequentially. The instruction on the right is in the right 125*f7cc78ecSespiecontainer and is executed second. 126*f7cc78ecSespie 127*f7cc78ecSespie@item abs r2,r3 <- abs r4,r5 128*f7cc78ecSespieExecute these reverse-sequentially. The instruction on the right is in the right 129*f7cc78ecSespiecontainer, and is executed first. 130*f7cc78ecSespie 131*f7cc78ecSespie@item abs r2,r3 || abs r4,r5 132*f7cc78ecSespieExecute these in parallel. 133*f7cc78ecSespie 134*f7cc78ecSespie@item ldw r2,@@(r3,r4) || 135*f7cc78ecSespie@itemx mulx r6,r8,r9 136*f7cc78ecSespieTwo-line format. Execute these in parallel. 137*f7cc78ecSespie 138*f7cc78ecSespie@item mulx a0,r8,r9 139*f7cc78ecSespie@itemx stw r2,@@(r3,r4) 140*f7cc78ecSespieTwo-line format. Execute these sequentially unless @samp{-O} option is 141*f7cc78ecSespieused. If the @samp{-O} option is used, the assembler will determine if 142*f7cc78ecSespiethe instructions could be done in parallel (the above two instructions 143*f7cc78ecSespiecan be done in parallel), and if so, emit them as parallel instructions. 144*f7cc78ecSespieThe assembler will put them in the proper containers. In the above 145*f7cc78ecSespieexample, the assembler will put the @samp{stw} instruction in left 146*f7cc78ecSespiecontainer and the @samp{mulx} instruction in the right container. 147*f7cc78ecSespie 148*f7cc78ecSespie@item stw r2,@@(r3,r4) -> 149*f7cc78ecSespie@itemx mulx a0,r8,r9 150*f7cc78ecSespieTwo-line format. Execute the @samp{stw} instruction followed by the 151*f7cc78ecSespie@samp{mulx} instruction sequentially. The first instruction goes in the 152*f7cc78ecSespieleft container and the second instruction goes into right container. 153*f7cc78ecSespieThe assembler will give an error if the machine ordering constraints are 154*f7cc78ecSespieviolated. 155*f7cc78ecSespie 156*f7cc78ecSespie@item stw r2,@@(r3,r4) <- 157*f7cc78ecSespie@itemx mulx a0,r8,r9 158*f7cc78ecSespieSame as previous example, except that the @samp{mulx} instruction is 159*f7cc78ecSespieexecuted before the @samp{stw} instruction. 160*f7cc78ecSespie@end table 161*f7cc78ecSespie 162*f7cc78ecSespie@cindex symbol names, @samp{$} in 163*f7cc78ecSespie@cindex @code{$} in symbol names 164*f7cc78ecSespieSince @samp{$} has no special meaning, you may use it in symbol names. 165*f7cc78ecSespie 166*f7cc78ecSespie@node D30V-Guarded 167*f7cc78ecSespie@subsection Guarded Execution 168*f7cc78ecSespie@cindex D30V Guarded Execution 169*f7cc78ecSespie@code{@value{AS}} supports the full range of guarded execution 170*f7cc78ecSespiedirectives for each instruction. Just append the directive after the 171*f7cc78ecSespieinstruction proper. The directives are: 172*f7cc78ecSespie 173*f7cc78ecSespie@table @samp 174*f7cc78ecSespie@item /tx 175*f7cc78ecSespieExecute the instruction if flag f0 is true. 176*f7cc78ecSespie@item /fx 177*f7cc78ecSespieExecute the instruction if flag f0 is false. 178*f7cc78ecSespie@item /xt 179*f7cc78ecSespieExecute the instruction if flag f1 is true. 180*f7cc78ecSespie@item /xf 181*f7cc78ecSespieExecute the instruction if flag f1 is false. 182*f7cc78ecSespie@item /tt 183*f7cc78ecSespieExecute the instruction if both flags f0 and f1 are true. 184*f7cc78ecSespie@item /tf 185*f7cc78ecSespieExecute the instruction if flag f0 is true and flag f1 is false. 186*f7cc78ecSespie@end table 187*f7cc78ecSespie 188*f7cc78ecSespie@node D30V-Regs 189*f7cc78ecSespie@subsection Register Names 190*f7cc78ecSespie@cindex D30V registers 191*f7cc78ecSespie@cindex registers, D30V 192*f7cc78ecSespieYou can use the predefined symbols @samp{r0} through @samp{r63} to refer 193*f7cc78ecSespieto the D30V registers. You can also use @samp{sp} as an alias for 194*f7cc78ecSespie@samp{r63} and @samp{link} as an alias for @samp{r62}. The accumulators 195*f7cc78ecSespieare @samp{a0} and @samp{a1}. 196*f7cc78ecSespie 197*f7cc78ecSespieThe D30V also has predefined symbols for these control registers and status bits: 198*f7cc78ecSespie@table @code 199*f7cc78ecSespie@item psw 200*f7cc78ecSespieProcessor Status Word 201*f7cc78ecSespie@item bpsw 202*f7cc78ecSespieBackup Processor Status Word 203*f7cc78ecSespie@item pc 204*f7cc78ecSespieProgram Counter 205*f7cc78ecSespie@item bpc 206*f7cc78ecSespieBackup Program Counter 207*f7cc78ecSespie@item rpt_c 208*f7cc78ecSespieRepeat Count 209*f7cc78ecSespie@item rpt_s 210*f7cc78ecSespieRepeat Start address 211*f7cc78ecSespie@item rpt_e 212*f7cc78ecSespieRepeat End address 213*f7cc78ecSespie@item mod_s 214*f7cc78ecSespieModulo Start address 215*f7cc78ecSespie@item mod_e 216*f7cc78ecSespieModulo End address 217*f7cc78ecSespie@item iba 218*f7cc78ecSespieInstruction Break Address 219*f7cc78ecSespie@item f0 220*f7cc78ecSespieFlag 0 221*f7cc78ecSespie@item f1 222*f7cc78ecSespieFlag 1 223*f7cc78ecSespie@item f2 224*f7cc78ecSespieFlag 2 225*f7cc78ecSespie@item f3 226*f7cc78ecSespieFlag 3 227*f7cc78ecSespie@item f4 228*f7cc78ecSespieFlag 4 229*f7cc78ecSespie@item f5 230*f7cc78ecSespieFlag 5 231*f7cc78ecSespie@item f6 232*f7cc78ecSespieFlag 6 233*f7cc78ecSespie@item f7 234*f7cc78ecSespieFlag 7 235*f7cc78ecSespie@item s 236*f7cc78ecSespieSame as flag 4 (saturation flag) 237*f7cc78ecSespie@item v 238*f7cc78ecSespieSame as flag 5 (overflow flag) 239*f7cc78ecSespie@item va 240*f7cc78ecSespieSame as flag 6 (sticky overflow flag) 241*f7cc78ecSespie@item c 242*f7cc78ecSespieSame as flag 7 (carry/borrow flag) 243*f7cc78ecSespie@item b 244*f7cc78ecSespieSame as flag 7 (carry/borrow flag) 245*f7cc78ecSespie@end table 246*f7cc78ecSespie 247*f7cc78ecSespie@node D30V-Addressing 248*f7cc78ecSespie@subsection Addressing Modes 249*f7cc78ecSespie@cindex addressing modes, D30V 250*f7cc78ecSespie@cindex D30V addressing modes 251*f7cc78ecSespie@code{@value{AS}} understands the following addressing modes for the D30V. 252*f7cc78ecSespie@code{R@var{n}} in the following refers to any of the numbered 253*f7cc78ecSespieregisters, but @emph{not} the control registers. 254*f7cc78ecSespie@table @code 255*f7cc78ecSespie@item R@var{n} 256*f7cc78ecSespieRegister direct 257*f7cc78ecSespie@item @@R@var{n} 258*f7cc78ecSespieRegister indirect 259*f7cc78ecSespie@item @@R@var{n}+ 260*f7cc78ecSespieRegister indirect with post-increment 261*f7cc78ecSespie@item @@R@var{n}- 262*f7cc78ecSespieRegister indirect with post-decrement 263*f7cc78ecSespie@item @@-SP 264*f7cc78ecSespieRegister indirect with pre-decrement 265*f7cc78ecSespie@item @@(@var{disp}, R@var{n}) 266*f7cc78ecSespieRegister indirect with displacement 267*f7cc78ecSespie@item @var{addr} 268*f7cc78ecSespiePC relative address (for branch or rep). 269*f7cc78ecSespie@item #@var{imm} 270*f7cc78ecSespieImmediate data (the @samp{#} is optional and ignored) 271*f7cc78ecSespie@end table 272*f7cc78ecSespie 273*f7cc78ecSespie@node D30V-Float 274*f7cc78ecSespie@section Floating Point 275*f7cc78ecSespie@cindex floating point, D30V 276*f7cc78ecSespie@cindex D30V floating point 277*f7cc78ecSespieThe D30V has no hardware floating point, but the @code{.float} and @code{.double} 278*f7cc78ecSespiedirectives generates @sc{ieee} floating-point numbers for compatibility 279*f7cc78ecSespiewith other development tools. 280*f7cc78ecSespie 281*f7cc78ecSespie@node D30V-Opcodes 282*f7cc78ecSespie@section Opcodes 283*f7cc78ecSespie@cindex D30V opcode summary 284*f7cc78ecSespie@cindex opcode summary, D30V 285*f7cc78ecSespie@cindex mnemonics, D30V 286*f7cc78ecSespie@cindex instruction summary, D30V 287*f7cc78ecSespieFor detailed information on the D30V machine instruction set, see 288*f7cc78ecSespie@cite{D30V Architecture: A VLIW Microprocessor for Multimedia Applications} 289*f7cc78ecSespie(Mitsubishi Electric Corp.). 290*f7cc78ecSespie@code{@value{AS}} implements all the standard D30V opcodes. The only changes are those 291*f7cc78ecSespiedescribed in the section on size modifiers 292*f7cc78ecSespie 293