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