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