13d8817e4Smiod@c Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 23d8817e4Smiod@c 2002, 2003, 2004 33d8817e4Smiod@c Free Software Foundation, Inc. 43d8817e4Smiod@c This is part of the GAS manual. 53d8817e4Smiod@c For copying conditions, see the file as.texinfo. 63d8817e4Smiod@ifset GENERIC 73d8817e4Smiod@page 83d8817e4Smiod@node MIPS-Dependent 93d8817e4Smiod@chapter MIPS Dependent Features 103d8817e4Smiod@end ifset 113d8817e4Smiod@ifclear GENERIC 123d8817e4Smiod@node Machine Dependencies 133d8817e4Smiod@chapter MIPS Dependent Features 143d8817e4Smiod@end ifclear 153d8817e4Smiod 163d8817e4Smiod@cindex MIPS processor 173d8817e4Smiod@sc{gnu} @code{@value{AS}} for @sc{mips} architectures supports several 183d8817e4Smioddifferent @sc{mips} processors, and MIPS ISA levels I through V, MIPS32, 193d8817e4Smiodand MIPS64. For information about the @sc{mips} instruction set, see 203d8817e4Smiod@cite{MIPS RISC Architecture}, by Kane and Heindrich (Prentice-Hall). 213d8817e4SmiodFor an overview of @sc{mips} assembly conventions, see ``Appendix D: 223d8817e4SmiodAssembly Language Programming'' in the same work. 233d8817e4Smiod 243d8817e4Smiod@menu 253d8817e4Smiod* MIPS Opts:: Assembler options 263d8817e4Smiod* MIPS Object:: ECOFF object code 273d8817e4Smiod* MIPS Stabs:: Directives for debugging information 283d8817e4Smiod* MIPS ISA:: Directives to override the ISA level 293d8817e4Smiod* MIPS symbol sizes:: Directives to override the size of symbols 303d8817e4Smiod* MIPS autoextend:: Directives for extending MIPS 16 bit instructions 313d8817e4Smiod* MIPS insn:: Directive to mark data as an instruction 323d8817e4Smiod* MIPS option stack:: Directives to save and restore options 333d8817e4Smiod* MIPS ASE instruction generation overrides:: Directives to control 343d8817e4Smiod generation of MIPS ASE instructions 353d8817e4Smiod@end menu 363d8817e4Smiod 373d8817e4Smiod@node MIPS Opts 383d8817e4Smiod@section Assembler options 393d8817e4Smiod 403d8817e4SmiodThe @sc{mips} configurations of @sc{gnu} @code{@value{AS}} support these 413d8817e4Smiodspecial options: 423d8817e4Smiod 433d8817e4Smiod@table @code 443d8817e4Smiod@cindex @code{-G} option (MIPS) 453d8817e4Smiod@item -G @var{num} 463d8817e4SmiodThis option sets the largest size of an object that can be referenced 473d8817e4Smiodimplicitly with the @code{gp} register. It is only accepted for targets 483d8817e4Smiodthat use @sc{ecoff} format. The default value is 8. 493d8817e4Smiod 503d8817e4Smiod@cindex @code{-EB} option (MIPS) 513d8817e4Smiod@cindex @code{-EL} option (MIPS) 523d8817e4Smiod@cindex MIPS big-endian output 533d8817e4Smiod@cindex MIPS little-endian output 543d8817e4Smiod@cindex big-endian output, MIPS 553d8817e4Smiod@cindex little-endian output, MIPS 563d8817e4Smiod@item -EB 573d8817e4Smiod@itemx -EL 583d8817e4SmiodAny @sc{mips} configuration of @code{@value{AS}} can select big-endian or 593d8817e4Smiodlittle-endian output at run time (unlike the other @sc{gnu} development 603d8817e4Smiodtools, which must be configured for one or the other). Use @samp{-EB} 613d8817e4Smiodto select big-endian output, and @samp{-EL} for little-endian. 623d8817e4Smiod 633d8817e4Smiod@cindex MIPS architecture options 643d8817e4Smiod@item -mips1 653d8817e4Smiod@itemx -mips2 663d8817e4Smiod@itemx -mips3 673d8817e4Smiod@itemx -mips4 683d8817e4Smiod@itemx -mips5 693d8817e4Smiod@itemx -mips32 703d8817e4Smiod@itemx -mips32r2 713d8817e4Smiod@itemx -mips64 723d8817e4Smiod@itemx -mips64r2 733d8817e4SmiodGenerate code for a particular MIPS Instruction Set Architecture level. 743d8817e4Smiod@samp{-mips1} corresponds to the @sc{r2000} and @sc{r3000} processors, 753d8817e4Smiod@samp{-mips2} to the @sc{r6000} processor, @samp{-mips3} to the 763d8817e4Smiod@sc{r4000} processor, and @samp{-mips4} to the @sc{r8000} and 773d8817e4Smiod@sc{r10000} processors. @samp{-mips5}, @samp{-mips32}, @samp{-mips32r2}, 783d8817e4Smiod@samp{-mips64}, and @samp{-mips64r2} 793d8817e4Smiodcorrespond to generic 803d8817e4Smiod@sc{MIPS V}, @sc{MIPS32}, @sc{MIPS32 Release 2}, @sc{MIPS64}, 813d8817e4Smiodand @sc{MIPS64 Release 2} 823d8817e4SmiodISA processors, respectively. You can also switch 833d8817e4Smiodinstruction sets during the assembly; see @ref{MIPS ISA, Directives to 843d8817e4Smiodoverride the ISA level}. 853d8817e4Smiod 863d8817e4Smiod@item -mgp32 873d8817e4Smiod@itemx -mfp32 883d8817e4SmiodSome macros have different expansions for 32-bit and 64-bit registers. 893d8817e4SmiodThe register sizes are normally inferred from the ISA and ABI, but these 903d8817e4Smiodflags force a certain group of registers to be treated as 32 bits wide at 913d8817e4Smiodall times. @samp{-mgp32} controls the size of general-purpose registers 923d8817e4Smiodand @samp{-mfp32} controls the size of floating-point registers. 933d8817e4Smiod 943d8817e4SmiodOn some MIPS variants there is a 32-bit mode flag; when this flag is 953d8817e4Smiodset, 64-bit instructions generate a trap. Also, some 32-bit OSes only 963d8817e4Smiodsave the 32-bit registers on a context switch, so it is essential never 973d8817e4Smiodto use the 64-bit registers. 983d8817e4Smiod 993d8817e4Smiod@item -mgp64 1003d8817e4SmiodAssume that 64-bit general purpose registers are available. This is 1013d8817e4Smiodprovided in the interests of symmetry with -gp32. 1023d8817e4Smiod 1033d8817e4Smiod@item -mips16 1043d8817e4Smiod@itemx -no-mips16 1053d8817e4SmiodGenerate code for the MIPS 16 processor. This is equivalent to putting 1063d8817e4Smiod@samp{.set mips16} at the start of the assembly file. @samp{-no-mips16} 1073d8817e4Smiodturns off this option. 1083d8817e4Smiod 1093d8817e4Smiod@item -mips3d 1103d8817e4Smiod@itemx -no-mips3d 1113d8817e4SmiodGenerate code for the MIPS-3D Application Specific Extension. 1123d8817e4SmiodThis tells the assembler to accept MIPS-3D instructions. 1133d8817e4Smiod@samp{-no-mips3d} turns off this option. 1143d8817e4Smiod 1153d8817e4Smiod@item -mdmx 1163d8817e4Smiod@itemx -no-mdmx 1173d8817e4SmiodGenerate code for the MDMX Application Specific Extension. 1183d8817e4SmiodThis tells the assembler to accept MDMX instructions. 1193d8817e4Smiod@samp{-no-mdmx} turns off this option. 1203d8817e4Smiod 1213d8817e4Smiod@item -mdsp 1223d8817e4Smiod@itemx -mno-dsp 1233d8817e4SmiodGenerate code for the DSP Application Specific Extension. 1243d8817e4SmiodThis tells the assembler to accept DSP instructions. 1253d8817e4Smiod@samp{-mno-dsp} turns off this option. 1263d8817e4Smiod 1273d8817e4Smiod@item -mmt 1283d8817e4Smiod@itemx -mno-mt 1293d8817e4SmiodGenerate code for the MT Application Specific Extension. 1303d8817e4SmiodThis tells the assembler to accept MT instructions. 1313d8817e4Smiod@samp{-mno-mt} turns off this option. 1323d8817e4Smiod 1333d8817e4Smiod@item -mfix7000 1343d8817e4Smiod@itemx -mno-fix7000 1353d8817e4SmiodCause nops to be inserted if the read of the destination register 1363d8817e4Smiodof an mfhi or mflo instruction occurs in the following two instructions. 1373d8817e4Smiod 1383d8817e4Smiod@item -mfix-vr4120 1393d8817e4Smiod@itemx -no-mfix-vr4120 1403d8817e4SmiodInsert nops to work around certain VR4120 errata. This option is 1413d8817e4Smiodintended to be used on GCC-generated code: it is not designed to catch 1423d8817e4Smiodall problems in hand-written assembler code. 1433d8817e4Smiod 1443d8817e4Smiod@item -mfix-vr4130 1453d8817e4Smiod@itemx -no-mfix-vr4130 1463d8817e4SmiodInsert nops to work around the VR4130 @samp{mflo}/@samp{mfhi} errata. 1473d8817e4Smiod 148*d2386abeSmiod@item -mfix-loongson2f-btb 149*d2386abeSmiod@itemx -mno-fix-loongson2f-btb 150*d2386abeSmiodClear the Branch Target Buffer before any jump through a register. This 151*d2386abeSmiodoption is intended to be used on kernel code for the Loongson 2F processor 152*d2386abeSmiodonly; userland code compiled with this option will fault, and kernel code 153*d2386abeSmiodcompiled with this option run on another processor than Loongson 2E and 2F 154*d2386abeSmiodwill yield unpredictable results. 155*d2386abeSmiod 1563d8817e4Smiod@item -m4010 1573d8817e4Smiod@itemx -no-m4010 1583d8817e4SmiodGenerate code for the LSI @sc{r4010} chip. This tells the assembler to 1593d8817e4Smiodaccept the @sc{r4010} specific instructions (@samp{addciu}, @samp{ffc}, 1603d8817e4Smiodetc.), and to not schedule @samp{nop} instructions around accesses to 1613d8817e4Smiodthe @samp{HI} and @samp{LO} registers. @samp{-no-m4010} turns off this 1623d8817e4Smiodoption. 1633d8817e4Smiod 1643d8817e4Smiod@item -m4650 1653d8817e4Smiod@itemx -no-m4650 1663d8817e4SmiodGenerate code for the MIPS @sc{r4650} chip. This tells the assembler to accept 1673d8817e4Smiodthe @samp{mad} and @samp{madu} instruction, and to not schedule @samp{nop} 1683d8817e4Smiodinstructions around accesses to the @samp{HI} and @samp{LO} registers. 1693d8817e4Smiod@samp{-no-m4650} turns off this option. 1703d8817e4Smiod 1713d8817e4Smiod@itemx -m3900 1723d8817e4Smiod@itemx -no-m3900 1733d8817e4Smiod@itemx -m4100 1743d8817e4Smiod@itemx -no-m4100 1753d8817e4SmiodFor each option @samp{-m@var{nnnn}}, generate code for the MIPS 1763d8817e4Smiod@sc{r@var{nnnn}} chip. This tells the assembler to accept instructions 1773d8817e4Smiodspecific to that chip, and to schedule for that chip's hazards. 1783d8817e4Smiod 1793d8817e4Smiod@item -march=@var{cpu} 1803d8817e4SmiodGenerate code for a particular MIPS cpu. It is exactly equivalent to 1813d8817e4Smiod@samp{-m@var{cpu}}, except that there are more value of @var{cpu} 1823d8817e4Smiodunderstood. Valid @var{cpu} value are: 1833d8817e4Smiod 1843d8817e4Smiod@quotation 1853d8817e4Smiod2000, 1863d8817e4Smiod3000, 1873d8817e4Smiod3900, 1883d8817e4Smiod4000, 1893d8817e4Smiod4010, 1903d8817e4Smiod4100, 1913d8817e4Smiod4111, 1923d8817e4Smiodvr4120, 1933d8817e4Smiodvr4130, 1943d8817e4Smiodvr4181, 1953d8817e4Smiod4300, 1963d8817e4Smiod4400, 1973d8817e4Smiod4600, 1983d8817e4Smiod4650, 1993d8817e4Smiod5000, 2003d8817e4Smiodrm5200, 2013d8817e4Smiodrm5230, 2023d8817e4Smiodrm5231, 2033d8817e4Smiodrm5261, 2043d8817e4Smiodrm5721, 2053d8817e4Smiodvr5400, 2063d8817e4Smiodvr5500, 2073d8817e4Smiod6000, 2083d8817e4Smiodrm7000, 2093d8817e4Smiod8000, 2103d8817e4Smiodrm9000, 2113d8817e4Smiod10000, 2123d8817e4Smiod12000, 2133d8817e4Smiodmips32-4k, 2143d8817e4Smiodsb1 2153d8817e4Smiod@end quotation 2163d8817e4Smiod 2173d8817e4Smiod@item -mtune=@var{cpu} 2183d8817e4SmiodSchedule and tune for a particular MIPS cpu. Valid @var{cpu} values are 2193d8817e4Smiodidentical to @samp{-march=@var{cpu}}. 2203d8817e4Smiod 2213d8817e4Smiod@item -mabi=@var{abi} 2223d8817e4SmiodRecord which ABI the source code uses. The recognized arguments 2233d8817e4Smiodare: @samp{32}, @samp{n32}, @samp{o64}, @samp{64} and @samp{eabi}. 2243d8817e4Smiod 2253d8817e4Smiod@item -msym32 2263d8817e4Smiod@itemx -mno-sym32 2273d8817e4Smiod@cindex -msym32 2283d8817e4Smiod@cindex -mno-sym32 2293d8817e4SmiodEquivalent to adding @code{.set sym32} or @code{.set nosym32} to 2303d8817e4Smiodthe beginning of the assembler input. @xref{MIPS symbol sizes}. 2313d8817e4Smiod 2323d8817e4Smiod@cindex @code{-nocpp} ignored (MIPS) 2333d8817e4Smiod@item -nocpp 2343d8817e4SmiodThis option is ignored. It is accepted for command-line compatibility with 2353d8817e4Smiodother assemblers, which use it to turn off C style preprocessing. With 2363d8817e4Smiod@sc{gnu} @code{@value{AS}}, there is no need for @samp{-nocpp}, because the 2373d8817e4Smiod@sc{gnu} assembler itself never runs the C preprocessor. 2383d8817e4Smiod 2393d8817e4Smiod@item --construct-floats 2403d8817e4Smiod@itemx --no-construct-floats 2413d8817e4Smiod@cindex --construct-floats 2423d8817e4Smiod@cindex --no-construct-floats 2433d8817e4SmiodThe @code{--no-construct-floats} option disables the construction of 2443d8817e4Smioddouble width floating point constants by loading the two halves of the 2453d8817e4Smiodvalue into the two single width floating point registers that make up 2463d8817e4Smiodthe double width register. This feature is useful if the processor 2473d8817e4Smiodsupport the FR bit in its status register, and this bit is known (by 2483d8817e4Smiodthe programmer) to be set. This bit prevents the aliasing of the double 2493d8817e4Smiodwidth register by the single width registers. 2503d8817e4Smiod 2513d8817e4SmiodBy default @code{--construct-floats} is selected, allowing construction 2523d8817e4Smiodof these floating point constants. 2533d8817e4Smiod 2543d8817e4Smiod@item --trap 2553d8817e4Smiod@itemx --no-break 2563d8817e4Smiod@c FIXME! (1) reflect these options (next item too) in option summaries; 2573d8817e4Smiod@c (2) stop teasing, say _which_ instructions expanded _how_. 2583d8817e4Smiod@code{@value{AS}} automatically macro expands certain division and 2593d8817e4Smiodmultiplication instructions to check for overflow and division by zero. This 2603d8817e4Smiodoption causes @code{@value{AS}} to generate code to take a trap exception 2613d8817e4Smiodrather than a break exception when an error is detected. The trap instructions 2623d8817e4Smiodare only supported at Instruction Set Architecture level 2 and higher. 2633d8817e4Smiod 2643d8817e4Smiod@item --break 2653d8817e4Smiod@itemx --no-trap 2663d8817e4SmiodGenerate code to take a break exception rather than a trap exception when an 2673d8817e4Smioderror is detected. This is the default. 2683d8817e4Smiod 2693d8817e4Smiod@item -mpdr 2703d8817e4Smiod@itemx -mno-pdr 2713d8817e4SmiodControl generation of @code{.pdr} sections. Off by default on IRIX, on 2723d8817e4Smiodelsewhere. 2733d8817e4Smiod 2743d8817e4Smiod@item -mshared 2753d8817e4Smiod@itemx -mno-shared 2763d8817e4SmiodWhen generating code using the Unix calling conventions (selected by 2773d8817e4Smiod@samp{-KPIC} or @samp{-mcall_shared}), gas will normally generate code 2783d8817e4Smiodwhich can go into a shared library. The @samp{-mno-shared} option 2793d8817e4Smiodtells gas to generate code which uses the calling convention, but can 2803d8817e4Smiodnot go into a shared library. The resulting code is slightly more 2813d8817e4Smiodefficient. This option only affects the handling of the 2823d8817e4Smiod@samp{.cpload} and @samp{.cpsetup} pseudo-ops. 2833d8817e4Smiod@end table 2843d8817e4Smiod 2853d8817e4Smiod@node MIPS Object 2863d8817e4Smiod@section MIPS ECOFF object code 2873d8817e4Smiod 2883d8817e4Smiod@cindex ECOFF sections 2893d8817e4Smiod@cindex MIPS ECOFF sections 2903d8817e4SmiodAssembling for a @sc{mips} @sc{ecoff} target supports some additional sections 2913d8817e4Smiodbesides the usual @code{.text}, @code{.data} and @code{.bss}. The 2923d8817e4Smiodadditional sections are @code{.rdata}, used for read-only data, 2933d8817e4Smiod@code{.sdata}, used for small data, and @code{.sbss}, used for small 2943d8817e4Smiodcommon objects. 2953d8817e4Smiod 2963d8817e4Smiod@cindex small objects, MIPS ECOFF 2973d8817e4Smiod@cindex @code{gp} register, MIPS 2983d8817e4SmiodWhen assembling for @sc{ecoff}, the assembler uses the @code{$gp} (@code{$28}) 2993d8817e4Smiodregister to form the address of a ``small object''. Any object in the 3003d8817e4Smiod@code{.sdata} or @code{.sbss} sections is considered ``small'' in this sense. 3013d8817e4SmiodFor external objects, or for objects in the @code{.bss} section, you can use 3023d8817e4Smiodthe @code{@value{GCC}} @samp{-G} option to control the size of objects addressed via 3033d8817e4Smiod@code{$gp}; the default value is 8, meaning that a reference to any object 3043d8817e4Smiodeight bytes or smaller uses @code{$gp}. Passing @samp{-G 0} to 3053d8817e4Smiod@code{@value{AS}} prevents it from using the @code{$gp} register on the basis 3063d8817e4Smiodof object size (but the assembler uses @code{$gp} for objects in @code{.sdata} 3073d8817e4Smiodor @code{sbss} in any case). The size of an object in the @code{.bss} section 3083d8817e4Smiodis set by the @code{.comm} or @code{.lcomm} directive that defines it. The 3093d8817e4Smiodsize of an external object may be set with the @code{.extern} directive. For 3103d8817e4Smiodexample, @samp{.extern sym,4} declares that the object at @code{sym} is 4 bytes 3113d8817e4Smiodin length, whie leaving @code{sym} otherwise undefined. 3123d8817e4Smiod 3133d8817e4SmiodUsing small @sc{ecoff} objects requires linker support, and assumes that the 3143d8817e4Smiod@code{$gp} register is correctly initialized (normally done automatically by 3153d8817e4Smiodthe startup code). @sc{mips} @sc{ecoff} assembly code must not modify the 3163d8817e4Smiod@code{$gp} register. 3173d8817e4Smiod 3183d8817e4Smiod@node MIPS Stabs 3193d8817e4Smiod@section Directives for debugging information 3203d8817e4Smiod 3213d8817e4Smiod@cindex MIPS debugging directives 3223d8817e4Smiod@sc{mips} @sc{ecoff} @code{@value{AS}} supports several directives used for 3233d8817e4Smiodgenerating debugging information which are not support by traditional @sc{mips} 3243d8817e4Smiodassemblers. These are @code{.def}, @code{.endef}, @code{.dim}, @code{.file}, 3253d8817e4Smiod@code{.scl}, @code{.size}, @code{.tag}, @code{.type}, @code{.val}, 3263d8817e4Smiod@code{.stabd}, @code{.stabn}, and @code{.stabs}. The debugging information 3273d8817e4Smiodgenerated by the three @code{.stab} directives can only be read by @sc{gdb}, 3283d8817e4Smiodnot by traditional @sc{mips} debuggers (this enhancement is required to fully 3293d8817e4Smiodsupport C++ debugging). These directives are primarily used by compilers, not 3303d8817e4Smiodassembly language programmers! 3313d8817e4Smiod 3323d8817e4Smiod@node MIPS symbol sizes 3333d8817e4Smiod@section Directives to override the size of symbols 3343d8817e4Smiod 3353d8817e4Smiod@cindex @code{.set sym32} 3363d8817e4Smiod@cindex @code{.set nosym32} 3373d8817e4SmiodThe n64 ABI allows symbols to have any 64-bit value. Although this 3383d8817e4Smiodprovides a great deal of flexibility, it means that some macros have 3393d8817e4Smiodmuch longer expansions than their 32-bit counterparts. For example, 3403d8817e4Smiodthe non-PIC expansion of @samp{dla $4,sym} is usually: 3413d8817e4Smiod 3423d8817e4Smiod@smallexample 3433d8817e4Smiodlui $4,%highest(sym) 3443d8817e4Smiodlui $1,%hi(sym) 3453d8817e4Smioddaddiu $4,$4,%higher(sym) 3463d8817e4Smioddaddiu $1,$1,%lo(sym) 3473d8817e4Smioddsll32 $4,$4,0 3483d8817e4Smioddaddu $4,$4,$1 3493d8817e4Smiod@end smallexample 3503d8817e4Smiod 3513d8817e4Smiodwhereas the 32-bit expansion is simply: 3523d8817e4Smiod 3533d8817e4Smiod@smallexample 3543d8817e4Smiodlui $4,%hi(sym) 3553d8817e4Smioddaddiu $4,$4,%lo(sym) 3563d8817e4Smiod@end smallexample 3573d8817e4Smiod 3583d8817e4Smiodn64 code is sometimes constructed in such a way that all symbolic 3593d8817e4Smiodconstants are known to have 32-bit values, and in such cases, it's 3603d8817e4Smiodpreferable to use the 32-bit expansion instead of the 64-bit 3613d8817e4Smiodexpansion. 3623d8817e4Smiod 3633d8817e4SmiodYou can use the @code{.set sym32} directive to tell the assembler 3643d8817e4Smiodthat, from this point on, all expressions of the form 3653d8817e4Smiod@samp{@var{symbol}} or @samp{@var{symbol} + @var{offset}} 3663d8817e4Smiodhave 32-bit values. For example: 3673d8817e4Smiod 3683d8817e4Smiod@smallexample 3693d8817e4Smiod.set sym32 3703d8817e4Smioddla $4,sym 3713d8817e4Smiodlw $4,sym+16 3723d8817e4Smiodsw $4,sym+0x8000($4) 3733d8817e4Smiod@end smallexample 3743d8817e4Smiod 3753d8817e4Smiodwill cause the assembler to treat @samp{sym}, @code{sym+16} and 3763d8817e4Smiod@code{sym+0x8000} as 32-bit values. The handling of non-symbolic 3773d8817e4Smiodaddresses is not affected. 3783d8817e4Smiod 3793d8817e4SmiodThe directive @code{.set nosym32} ends a @code{.set sym32} block and 3803d8817e4Smiodreverts to the normal behavior. It is also possible to change the 3813d8817e4Smiodsymbol size using the command-line options @option{-msym32} and 3823d8817e4Smiod@option{-mno-sym32}. 3833d8817e4Smiod 3843d8817e4SmiodThese options and directives are always accepted, but at present, 3853d8817e4Smiodthey have no effect for anything other than n64. 3863d8817e4Smiod 3873d8817e4Smiod@node MIPS ISA 3883d8817e4Smiod@section Directives to override the ISA level 3893d8817e4Smiod 3903d8817e4Smiod@cindex MIPS ISA override 3913d8817e4Smiod@kindex @code{.set mips@var{n}} 3923d8817e4Smiod@sc{gnu} @code{@value{AS}} supports an additional directive to change 3933d8817e4Smiodthe @sc{mips} Instruction Set Architecture level on the fly: @code{.set 3943d8817e4Smiodmips@var{n}}. @var{n} should be a number from 0 to 5, or 32, 32r2, 64 3953d8817e4Smiodor 64r2. 3963d8817e4SmiodThe values other than 0 make the assembler accept instructions 3973d8817e4Smiodfor the corresponding @sc{isa} level, from that point on in the 3983d8817e4Smiodassembly. @code{.set mips@var{n}} affects not only which instructions 3993d8817e4Smiodare permitted, but also how certain macros are expanded. @code{.set 4003d8817e4Smiodmips0} restores the @sc{isa} level to its original level: either the 4013d8817e4Smiodlevel you selected with command line options, or the default for your 4023d8817e4Smiodconfiguration. You can use this feature to permit specific @sc{r4000} 4033d8817e4Smiodinstructions while assembling in 32 bit mode. Use this directive with 4043d8817e4Smiodcare! 4053d8817e4Smiod 4063d8817e4SmiodThe directive @samp{.set mips16} puts the assembler into MIPS 16 mode, 4073d8817e4Smiodin which it will assemble instructions for the MIPS 16 processor. Use 4083d8817e4Smiod@samp{.set nomips16} to return to normal 32 bit mode. 4093d8817e4Smiod 4103d8817e4SmiodTraditional @sc{mips} assemblers do not support this directive. 4113d8817e4Smiod 4123d8817e4Smiod@node MIPS autoextend 4133d8817e4Smiod@section Directives for extending MIPS 16 bit instructions 4143d8817e4Smiod 4153d8817e4Smiod@kindex @code{.set autoextend} 4163d8817e4Smiod@kindex @code{.set noautoextend} 4173d8817e4SmiodBy default, MIPS 16 instructions are automatically extended to 32 bits 4183d8817e4Smiodwhen necessary. The directive @samp{.set noautoextend} will turn this 4193d8817e4Smiodoff. When @samp{.set noautoextend} is in effect, any 32 bit instruction 4203d8817e4Smiodmust be explicitly extended with the @samp{.e} modifier (e.g., 4213d8817e4Smiod@samp{li.e $4,1000}). The directive @samp{.set autoextend} may be used 4223d8817e4Smiodto once again automatically extend instructions when necessary. 4233d8817e4Smiod 4243d8817e4SmiodThis directive is only meaningful when in MIPS 16 mode. Traditional 4253d8817e4Smiod@sc{mips} assemblers do not support this directive. 4263d8817e4Smiod 4273d8817e4Smiod@node MIPS insn 4283d8817e4Smiod@section Directive to mark data as an instruction 4293d8817e4Smiod 4303d8817e4Smiod@kindex @code{.insn} 4313d8817e4SmiodThe @code{.insn} directive tells @code{@value{AS}} that the following 4323d8817e4Smioddata is actually instructions. This makes a difference in MIPS 16 mode: 4333d8817e4Smiodwhen loading the address of a label which precedes instructions, 4343d8817e4Smiod@code{@value{AS}} automatically adds 1 to the value, so that jumping to 4353d8817e4Smiodthe loaded address will do the right thing. 4363d8817e4Smiod 4373d8817e4Smiod@node MIPS option stack 4383d8817e4Smiod@section Directives to save and restore options 4393d8817e4Smiod 4403d8817e4Smiod@cindex MIPS option stack 4413d8817e4Smiod@kindex @code{.set push} 4423d8817e4Smiod@kindex @code{.set pop} 4433d8817e4SmiodThe directives @code{.set push} and @code{.set pop} may be used to save 4443d8817e4Smiodand restore the current settings for all the options which are 4453d8817e4Smiodcontrolled by @code{.set}. The @code{.set push} directive saves the 4463d8817e4Smiodcurrent settings on a stack. The @code{.set pop} directive pops the 4473d8817e4Smiodstack and restores the settings. 4483d8817e4Smiod 4493d8817e4SmiodThese directives can be useful inside an macro which must change an 4503d8817e4Smiodoption such as the ISA level or instruction reordering but does not want 4513d8817e4Smiodto change the state of the code which invoked the macro. 4523d8817e4Smiod 4533d8817e4SmiodTraditional @sc{mips} assemblers do not support these directives. 4543d8817e4Smiod 4553d8817e4Smiod@node MIPS ASE instruction generation overrides 4563d8817e4Smiod@section Directives to control generation of MIPS ASE instructions 4573d8817e4Smiod 4583d8817e4Smiod@cindex MIPS MIPS-3D instruction generation override 4593d8817e4Smiod@kindex @code{.set mips3d} 4603d8817e4Smiod@kindex @code{.set nomips3d} 4613d8817e4SmiodThe directive @code{.set mips3d} makes the assembler accept instructions 4623d8817e4Smiodfrom the MIPS-3D Application Specific Extension from that point on 4633d8817e4Smiodin the assembly. The @code{.set nomips3d} directive prevents MIPS-3D 4643d8817e4Smiodinstructions from being accepted. 4653d8817e4Smiod 4663d8817e4Smiod@cindex MIPS MDMX instruction generation override 4673d8817e4Smiod@kindex @code{.set mdmx} 4683d8817e4Smiod@kindex @code{.set nomdmx} 4693d8817e4SmiodThe directive @code{.set mdmx} makes the assembler accept instructions 4703d8817e4Smiodfrom the MDMX Application Specific Extension from that point on 4713d8817e4Smiodin the assembly. The @code{.set nomdmx} directive prevents MDMX 4723d8817e4Smiodinstructions from being accepted. 4733d8817e4Smiod 4743d8817e4Smiod@cindex MIPS DSP instruction generation override 4753d8817e4Smiod@kindex @code{.set dsp} 4763d8817e4Smiod@kindex @code{.set nodsp} 4773d8817e4SmiodThe directive @code{.set dsp} makes the assembler accept instructions 4783d8817e4Smiodfrom the DSP Application Specific Extension from that point on 4793d8817e4Smiodin the assembly. The @code{.set nodsp} directive prevents DSP 4803d8817e4Smiodinstructions from being accepted. 4813d8817e4Smiod 4823d8817e4Smiod@cindex MIPS MT instruction generation override 4833d8817e4Smiod@kindex @code{.set mt} 4843d8817e4Smiod@kindex @code{.set nomt} 4853d8817e4SmiodThe directive @code{.set mt} makes the assembler accept instructions 4863d8817e4Smiodfrom the MT Application Specific Extension from that point on 4873d8817e4Smiodin the assembly. The @code{.set nomt} directive prevents MT 4883d8817e4Smiodinstructions from being accepted. 4893d8817e4Smiod 4903d8817e4SmiodTraditional @sc{mips} assemblers do not support these directives. 491