1*a9fa9459Szrj@c Copyright (C) 1991-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 M32R-Dependent 7*a9fa9459Szrj@chapter M32R Dependent Features 8*a9fa9459Szrj@end ifset 9*a9fa9459Szrj@ifclear GENERIC 10*a9fa9459Szrj@node Machine Dependencies 11*a9fa9459Szrj@chapter M32R Dependent Features 12*a9fa9459Szrj@end ifclear 13*a9fa9459Szrj 14*a9fa9459Szrj@cindex M32R support 15*a9fa9459Szrj@menu 16*a9fa9459Szrj* M32R-Opts:: M32R Options 17*a9fa9459Szrj* M32R-Directives:: M32R Directives 18*a9fa9459Szrj* M32R-Warnings:: M32R Warnings 19*a9fa9459Szrj@end menu 20*a9fa9459Szrj 21*a9fa9459Szrj@node M32R-Opts 22*a9fa9459Szrj@section M32R Options 23*a9fa9459Szrj 24*a9fa9459Szrj@cindex options, M32R 25*a9fa9459Szrj@cindex M32R options 26*a9fa9459Szrj 27*a9fa9459SzrjThe Renease M32R version of @code{@value{AS}} has a few machine 28*a9fa9459Szrjdependent options: 29*a9fa9459Szrj 30*a9fa9459Szrj@table @code 31*a9fa9459Szrj 32*a9fa9459Szrj@item -m32rx 33*a9fa9459Szrj@cindex @samp{-m32rx} option, M32RX 34*a9fa9459Szrj@cindex architecture options, M32RX 35*a9fa9459Szrj@cindex M32R architecture options 36*a9fa9459Szrj@code{@value{AS}} can assemble code for several different members of the 37*a9fa9459SzrjRenesas M32R family. Normally the default is to assemble code for 38*a9fa9459Szrjthe M32R microprocessor. This option may be used to change the default 39*a9fa9459Szrjto the M32RX microprocessor, which adds some more instructions to the 40*a9fa9459Szrjbasic M32R instruction set, and some additional parameters to some of 41*a9fa9459Szrjthe original instructions. 42*a9fa9459Szrj 43*a9fa9459Szrj@item -m32r2 44*a9fa9459Szrj@cindex @samp{-m32rx} option, M32R2 45*a9fa9459Szrj@cindex architecture options, M32R2 46*a9fa9459Szrj@cindex M32R architecture options 47*a9fa9459SzrjThis option changes the target processor to the M32R2 48*a9fa9459Szrjmicroprocessor. 49*a9fa9459Szrj 50*a9fa9459Szrj@item -m32r 51*a9fa9459Szrj@cindex @samp{-m32r} option, M32R 52*a9fa9459Szrj@cindex architecture options, M32R 53*a9fa9459Szrj@cindex M32R architecture options 54*a9fa9459SzrjThis option can be used to restore the assembler's default behaviour of 55*a9fa9459Szrjassembling for the M32R microprocessor. This can be useful if the 56*a9fa9459Szrjdefault has been changed by a previous command line option. 57*a9fa9459Szrj 58*a9fa9459Szrj@item -little 59*a9fa9459Szrj@cindex @code{-little} option, M32R 60*a9fa9459SzrjThis option tells the assembler to produce little-endian code and 61*a9fa9459Szrjdata. The default is dependent upon how the toolchain was 62*a9fa9459Szrjconfigured. 63*a9fa9459Szrj 64*a9fa9459Szrj@item -EL 65*a9fa9459Szrj@cindex @code{-EL} option, M32R 66*a9fa9459SzrjThis is a synonym for @emph{-little}. 67*a9fa9459Szrj 68*a9fa9459Szrj@item -big 69*a9fa9459Szrj@cindex @code{-big} option, M32R 70*a9fa9459SzrjThis option tells the assembler to produce big-endian code and 71*a9fa9459Szrjdata. 72*a9fa9459Szrj 73*a9fa9459Szrj@item -EB 74*a9fa9459Szrj@cindex @code{-EB} option, M32R 75*a9fa9459SzrjThis is a synonum for @emph{-big}. 76*a9fa9459Szrj 77*a9fa9459Szrj@item -KPIC 78*a9fa9459Szrj@cindex @code{-KPIC} option, M32R 79*a9fa9459Szrj@cindex PIC code generation for M32R 80*a9fa9459SzrjThis option specifies that the output of the assembler should be 81*a9fa9459Szrjmarked as position-independent code (PIC). 82*a9fa9459Szrj 83*a9fa9459Szrj@item -parallel 84*a9fa9459Szrj@cindex @code{-parallel} option, M32RX 85*a9fa9459SzrjThis option tells the assembler to attempts to combine two sequential 86*a9fa9459Szrjinstructions into a single, parallel instruction, where it is legal to 87*a9fa9459Szrjdo so. 88*a9fa9459Szrj 89*a9fa9459Szrj@item -no-parallel 90*a9fa9459Szrj@cindex @code{-no-parallel} option, M32RX 91*a9fa9459SzrjThis option disables a previously enabled @emph{-parallel} option. 92*a9fa9459Szrj 93*a9fa9459Szrj@item -no-bitinst 94*a9fa9459Szrj@cindex @samp{-no-bitinst}, M32R2 95*a9fa9459SzrjThis option disables the support for the extended bit-field 96*a9fa9459Szrjinstructions provided by the M32R2. If this support needs to be 97*a9fa9459Szrjre-enabled the @emph{-bitinst} switch can be used to restore it. 98*a9fa9459Szrj 99*a9fa9459Szrj@item -O 100*a9fa9459Szrj@cindex @code{-O} option, M32RX 101*a9fa9459SzrjThis option tells the assembler to attempt to optimize the 102*a9fa9459Szrjinstructions that it produces. This includes filling delay slots and 103*a9fa9459Szrjconverting sequential instructions into parallel ones. This option 104*a9fa9459Szrjimplies @emph{-parallel}. 105*a9fa9459Szrj 106*a9fa9459Szrj@item -warn-explicit-parallel-conflicts 107*a9fa9459Szrj@cindex @samp{-warn-explicit-parallel-conflicts} option, M32RX 108*a9fa9459SzrjInstructs @code{@value{AS}} to produce warning messages when 109*a9fa9459Szrjquestionable parallel instructions are encountered. This option is 110*a9fa9459Szrjenabled by default, but @code{@value{GCC}} disables it when it invokes 111*a9fa9459Szrj@code{@value{AS}} directly. Questionable instructions are those whose 112*a9fa9459Szrjbehaviour would be different if they were executed sequentially. For 113*a9fa9459Szrjexample the code fragment @samp{mv r1, r2 || mv r3, r1} produces a 114*a9fa9459Szrjdifferent result from @samp{mv r1, r2 \n mv r3, r1} since the former 115*a9fa9459Szrjmoves r1 into r3 and then r2 into r1, whereas the later moves r2 into r1 116*a9fa9459Szrjand r3. 117*a9fa9459Szrj 118*a9fa9459Szrj@item -Wp 119*a9fa9459Szrj@cindex @samp{-Wp} option, M32RX 120*a9fa9459SzrjThis is a shorter synonym for the @emph{-warn-explicit-parallel-conflicts} 121*a9fa9459Szrjoption. 122*a9fa9459Szrj 123*a9fa9459Szrj@item -no-warn-explicit-parallel-conflicts 124*a9fa9459Szrj@cindex @samp{-no-warn-explicit-parallel-conflicts} option, M32RX 125*a9fa9459SzrjInstructs @code{@value{AS}} not to produce warning messages when 126*a9fa9459Szrjquestionable parallel instructions are encountered. 127*a9fa9459Szrj 128*a9fa9459Szrj@item -Wnp 129*a9fa9459Szrj@cindex @samp{-Wnp} option, M32RX 130*a9fa9459SzrjThis is a shorter synonym for the @emph{-no-warn-explicit-parallel-conflicts} 131*a9fa9459Szrjoption. 132*a9fa9459Szrj 133*a9fa9459Szrj@item -ignore-parallel-conflicts 134*a9fa9459Szrj@cindex @samp{-ignore-parallel-conflicts} option, M32RX 135*a9fa9459SzrjThis option tells the assembler's to stop checking parallel 136*a9fa9459Szrjinstructions for constraint violations. This ability is provided for 137*a9fa9459Szrjhardware vendors testing chip designs and should not be used under 138*a9fa9459Szrjnormal circumstances. 139*a9fa9459Szrj 140*a9fa9459Szrj@item -no-ignore-parallel-conflicts 141*a9fa9459Szrj@cindex @samp{-no-ignore-parallel-conflicts} option, M32RX 142*a9fa9459SzrjThis option restores the assembler's default behaviour of checking 143*a9fa9459Szrjparallel instructions to detect constraint violations. 144*a9fa9459Szrj 145*a9fa9459Szrj@item -Ip 146*a9fa9459Szrj@cindex @samp{-Ip} option, M32RX 147*a9fa9459SzrjThis is a shorter synonym for the @emph{-ignore-parallel-conflicts} 148*a9fa9459Szrjoption. 149*a9fa9459Szrj 150*a9fa9459Szrj@item -nIp 151*a9fa9459Szrj@cindex @samp{-nIp} option, M32RX 152*a9fa9459SzrjThis is a shorter synonym for the @emph{-no-ignore-parallel-conflicts} 153*a9fa9459Szrjoption. 154*a9fa9459Szrj 155*a9fa9459Szrj@item -warn-unmatched-high 156*a9fa9459Szrj@cindex @samp{-warn-unmatched-high} option, M32R 157*a9fa9459SzrjThis option tells the assembler to produce a warning message if a 158*a9fa9459Szrj@code{.high} pseudo op is encountered without a matching @code{.low} 159*a9fa9459Szrjpseudo op. The presence of such an unmatched pseudo op usually 160*a9fa9459Szrjindicates a programming error. 161*a9fa9459Szrj 162*a9fa9459Szrj@item -no-warn-unmatched-high 163*a9fa9459Szrj@cindex @samp{-no-warn-unmatched-high} option, M32R 164*a9fa9459SzrjDisables a previously enabled @emph{-warn-unmatched-high} option. 165*a9fa9459Szrj 166*a9fa9459Szrj@item -Wuh 167*a9fa9459Szrj@cindex @samp{-Wuh} option, M32RX 168*a9fa9459SzrjThis is a shorter synonym for the @emph{-warn-unmatched-high} option. 169*a9fa9459Szrj 170*a9fa9459Szrj@item -Wnuh 171*a9fa9459Szrj@cindex @samp{-Wnuh} option, M32RX 172*a9fa9459SzrjThis is a shorter synonym for the @emph{-no-warn-unmatched-high} option. 173*a9fa9459Szrj 174*a9fa9459Szrj@end table 175*a9fa9459Szrj 176*a9fa9459Szrj@node M32R-Directives 177*a9fa9459Szrj@section M32R Directives 178*a9fa9459Szrj@cindex directives, M32R 179*a9fa9459Szrj@cindex M32R directives 180*a9fa9459Szrj 181*a9fa9459SzrjThe Renease M32R version of @code{@value{AS}} has a few architecture 182*a9fa9459Szrjspecific directives: 183*a9fa9459Szrj 184*a9fa9459Szrj@table @code 185*a9fa9459Szrj 186*a9fa9459Szrj@cindex @code{low} directive, M32R 187*a9fa9459Szrj@item low @var{expression} 188*a9fa9459SzrjThe @code{low} directive computes the value of its expression and 189*a9fa9459Szrjplaces the lower 16-bits of the result into the immediate-field of the 190*a9fa9459Szrjinstruction. For example: 191*a9fa9459Szrj 192*a9fa9459Szrj@smallexample 193*a9fa9459Szrj or3 r0, r0, #low(0x12345678) ; compute r0 = r0 | 0x5678 194*a9fa9459Szrj add3, r0, r0, #low(fred) ; compute r0 = r0 + low 16-bits of address of fred 195*a9fa9459Szrj@end smallexample 196*a9fa9459Szrj 197*a9fa9459Szrj@item high @var{expression} 198*a9fa9459Szrj@cindex @code{high} directive, M32R 199*a9fa9459SzrjThe @code{high} directive computes the value of its expression and 200*a9fa9459Szrjplaces the upper 16-bits of the result into the immediate-field of the 201*a9fa9459Szrjinstruction. For example: 202*a9fa9459Szrj 203*a9fa9459Szrj@smallexample 204*a9fa9459Szrj seth r0, #high(0x12345678) ; compute r0 = 0x12340000 205*a9fa9459Szrj seth, r0, #high(fred) ; compute r0 = upper 16-bits of address of fred 206*a9fa9459Szrj@end smallexample 207*a9fa9459Szrj 208*a9fa9459Szrj@item shigh @var{expression} 209*a9fa9459Szrj@cindex @code{shigh} directive, M32R 210*a9fa9459SzrjThe @code{shigh} directive is very similar to the @code{high} 211*a9fa9459Szrjdirective. It also computes the value of its expression and places 212*a9fa9459Szrjthe upper 16-bits of the result into the immediate-field of the 213*a9fa9459Szrjinstruction. The difference is that @code{shigh} also checks to see 214*a9fa9459Szrjif the lower 16-bits could be interpreted as a signed number, and if 215*a9fa9459Szrjso it assumes that a borrow will occur from the upper-16 bits. To 216*a9fa9459Szrjcompensate for this the @code{shigh} directive pre-biases the upper 217*a9fa9459Szrj16 bit value by adding one to it. For example: 218*a9fa9459Szrj 219*a9fa9459SzrjFor example: 220*a9fa9459Szrj 221*a9fa9459Szrj@smallexample 222*a9fa9459Szrj seth r0, #shigh(0x12345678) ; compute r0 = 0x12340000 223*a9fa9459Szrj seth r0, #shigh(0x00008000) ; compute r0 = 0x00010000 224*a9fa9459Szrj@end smallexample 225*a9fa9459Szrj 226*a9fa9459SzrjIn the second example the lower 16-bits are 0x8000. If these are 227*a9fa9459Szrjtreated as a signed value and sign extended to 32-bits then the value 228*a9fa9459Szrjbecomes 0xffff8000. If this value is then added to 0x00010000 then 229*a9fa9459Szrjthe result is 0x00008000. 230*a9fa9459Szrj 231*a9fa9459SzrjThis behaviour is to allow for the different semantics of the 232*a9fa9459Szrj@code{or3} and @code{add3} instructions. The @code{or3} instruction 233*a9fa9459Szrjtreats its 16-bit immediate argument as unsigned whereas the 234*a9fa9459Szrj@code{add3} treats its 16-bit immediate as a signed value. So for 235*a9fa9459Szrjexample: 236*a9fa9459Szrj 237*a9fa9459Szrj@smallexample 238*a9fa9459Szrj seth r0, #shigh(0x00008000) 239*a9fa9459Szrj add3 r0, r0, #low(0x00008000) 240*a9fa9459Szrj@end smallexample 241*a9fa9459Szrj 242*a9fa9459SzrjProduces the correct result in r0, whereas: 243*a9fa9459Szrj 244*a9fa9459Szrj@smallexample 245*a9fa9459Szrj seth r0, #shigh(0x00008000) 246*a9fa9459Szrj or3 r0, r0, #low(0x00008000) 247*a9fa9459Szrj@end smallexample 248*a9fa9459Szrj 249*a9fa9459SzrjStores 0xffff8000 into r0. 250*a9fa9459Szrj 251*a9fa9459SzrjNote - the @code{shigh} directive does not know where in the assembly 252*a9fa9459Szrjsource code the lower 16-bits of the value are going set, so it cannot 253*a9fa9459Szrjcheck to make sure that an @code{or3} instruction is being used rather 254*a9fa9459Szrjthan an @code{add3} instruction. It is up to the programmer to make 255*a9fa9459Szrjsure that correct directives are used. 256*a9fa9459Szrj 257*a9fa9459Szrj@cindex @code{.m32r} directive, M32R 258*a9fa9459Szrj@item .m32r 259*a9fa9459SzrjThe directive performs a similar thing as the @emph{-m32r} command 260*a9fa9459Szrjline option. It tells the assembler to only accept M32R instructions 261*a9fa9459Szrjfrom now on. An instructions from later M32R architectures are 262*a9fa9459Szrjrefused. 263*a9fa9459Szrj 264*a9fa9459Szrj@cindex @code{.m32rx} directive, M32RX 265*a9fa9459Szrj@item .m32rx 266*a9fa9459SzrjThe directive performs a similar thing as the @emph{-m32rx} command 267*a9fa9459Szrjline option. It tells the assembler to start accepting the extra 268*a9fa9459Szrjinstructions in the M32RX ISA as well as the ordinary M32R ISA. 269*a9fa9459Szrj 270*a9fa9459Szrj@cindex @code{.m32r2} directive, M32R2 271*a9fa9459Szrj@item .m32r2 272*a9fa9459SzrjThe directive performs a similar thing as the @emph{-m32r2} command 273*a9fa9459Szrjline option. It tells the assembler to start accepting the extra 274*a9fa9459Szrjinstructions in the M32R2 ISA as well as the ordinary M32R ISA. 275*a9fa9459Szrj 276*a9fa9459Szrj@cindex @code{.little} directive, M32RX 277*a9fa9459Szrj@item .little 278*a9fa9459SzrjThe directive performs a similar thing as the @emph{-little} command 279*a9fa9459Szrjline option. It tells the assembler to start producing little-endian 280*a9fa9459Szrjcode and data. This option should be used with care as producing 281*a9fa9459Szrjmixed-endian binary files is fraught with danger. 282*a9fa9459Szrj 283*a9fa9459Szrj@cindex @code{.big} directive, M32RX 284*a9fa9459Szrj@item .big 285*a9fa9459SzrjThe directive performs a similar thing as the @emph{-big} command 286*a9fa9459Szrjline option. It tells the assembler to start producing big-endian 287*a9fa9459Szrjcode and data. This option should be used with care as producing 288*a9fa9459Szrjmixed-endian binary files is fraught with danger. 289*a9fa9459Szrj 290*a9fa9459Szrj@end table 291*a9fa9459Szrj 292*a9fa9459Szrj@node M32R-Warnings 293*a9fa9459Szrj@section M32R Warnings 294*a9fa9459Szrj 295*a9fa9459Szrj@cindex warnings, M32R 296*a9fa9459Szrj@cindex M32R warnings 297*a9fa9459Szrj 298*a9fa9459SzrjThere are several warning and error messages that can be produced by 299*a9fa9459Szrj@code{@value{AS}} which are specific to the M32R: 300*a9fa9459Szrj 301*a9fa9459Szrj@table @code 302*a9fa9459Szrj 303*a9fa9459Szrj@item output of 1st instruction is the same as an input to 2nd instruction - is this intentional ? 304*a9fa9459SzrjThis message is only produced if warnings for explicit parallel 305*a9fa9459Szrjconflicts have been enabled. It indicates that the assembler has 306*a9fa9459Szrjencountered a parallel instruction in which the destination register of 307*a9fa9459Szrjthe left hand instruction is used as an input register in the right hand 308*a9fa9459Szrjinstruction. For example in this code fragment 309*a9fa9459Szrj@samp{mv r1, r2 || neg r3, r1} register r1 is the destination of the 310*a9fa9459Szrjmove instruction and the input to the neg instruction. 311*a9fa9459Szrj 312*a9fa9459Szrj@item output of 2nd instruction is the same as an input to 1st instruction - is this intentional ? 313*a9fa9459SzrjThis message is only produced if warnings for explicit parallel 314*a9fa9459Szrjconflicts have been enabled. It indicates that the assembler has 315*a9fa9459Szrjencountered a parallel instruction in which the destination register of 316*a9fa9459Szrjthe right hand instruction is used as an input register in the left hand 317*a9fa9459Szrjinstruction. For example in this code fragment 318*a9fa9459Szrj@samp{mv r1, r2 || neg r2, r3} register r2 is the destination of the 319*a9fa9459Szrjneg instruction and the input to the move instruction. 320*a9fa9459Szrj 321*a9fa9459Szrj@item instruction @samp{...} is for the M32RX only 322*a9fa9459SzrjThis message is produced when the assembler encounters an instruction 323*a9fa9459Szrjwhich is only supported by the M32Rx processor, and the @samp{-m32rx} 324*a9fa9459Szrjcommand line flag has not been specified to allow assembly of such 325*a9fa9459Szrjinstructions. 326*a9fa9459Szrj 327*a9fa9459Szrj@item unknown instruction @samp{...} 328*a9fa9459SzrjThis message is produced when the assembler encounters an instruction 329*a9fa9459Szrjwhich it does not recognize. 330*a9fa9459Szrj 331*a9fa9459Szrj@item only the NOP instruction can be issued in parallel on the m32r 332*a9fa9459SzrjThis message is produced when the assembler encounters a parallel 333*a9fa9459Szrjinstruction which does not involve a NOP instruction and the 334*a9fa9459Szrj@samp{-m32rx} command line flag has not been specified. Only the M32Rx 335*a9fa9459Szrjprocessor is able to execute two instructions in parallel. 336*a9fa9459Szrj 337*a9fa9459Szrj@item instruction @samp{...} cannot be executed in parallel. 338*a9fa9459SzrjThis message is produced when the assembler encounters a parallel 339*a9fa9459Szrjinstruction which is made up of one or two instructions which cannot be 340*a9fa9459Szrjexecuted in parallel. 341*a9fa9459Szrj 342*a9fa9459Szrj@item Instructions share the same execution pipeline 343*a9fa9459SzrjThis message is produced when the assembler encounters a parallel 344*a9fa9459Szrjinstruction whoes components both use the same execution pipeline. 345*a9fa9459Szrj 346*a9fa9459Szrj@item Instructions write to the same destination register. 347*a9fa9459SzrjThis message is produced when the assembler encounters a parallel 348*a9fa9459Szrjinstruction where both components attempt to modify the same register. 349*a9fa9459SzrjFor example these code fragments will produce this message: 350*a9fa9459Szrj@samp{mv r1, r2 || neg r1, r3} 351*a9fa9459Szrj@samp{jl r0 || mv r14, r1} 352*a9fa9459Szrj@samp{st r2, @@-r1 || mv r1, r3} 353*a9fa9459Szrj@samp{mv r1, r2 || ld r0, @@r1+} 354*a9fa9459Szrj@samp{cmp r1, r2 || addx r3, r4} (Both write to the condition bit) 355*a9fa9459Szrj 356*a9fa9459Szrj@end table 357