xref: /netbsd-src/external/gpl3/binutils.old/dist/gas/doc/c-mips.texi (revision e992f068c547fd6e84b3f104dc2340adcc955732)
1*e992f068Schristos@c Copyright (C) 1991-2022 Free Software Foundation, Inc.
216dce513Schristos@c This is part of the GAS manual.
316dce513Schristos@c For copying conditions, see the file as.texinfo.
416dce513Schristos@ifset GENERIC
516dce513Schristos@page
616dce513Schristos@node MIPS-Dependent
716dce513Schristos@chapter MIPS Dependent Features
816dce513Schristos@end ifset
916dce513Schristos@ifclear GENERIC
1016dce513Schristos@node Machine Dependencies
1116dce513Schristos@chapter MIPS Dependent Features
1216dce513Schristos@end ifclear
1316dce513Schristos
1416dce513Schristos@cindex MIPS processor
1516dce513Schristos@sc{gnu} @code{@value{AS}} for MIPS architectures supports several
1616dce513Schristosdifferent MIPS processors, and MIPS ISA levels I through V, MIPS32,
1716dce513Schristosand MIPS64.  For information about the MIPS instruction set, see
1816dce513Schristos@cite{MIPS RISC Architecture}, by Kane and Heindrich (Prentice-Hall).
1916dce513SchristosFor an overview of MIPS assembly conventions, see ``Appendix D:
2016dce513SchristosAssembly Language Programming'' in the same work.
2116dce513Schristos
2216dce513Schristos@menu
2316dce513Schristos* MIPS Options::   	Assembler options
2416dce513Schristos* MIPS Macros:: 	High-level assembly macros
2516dce513Schristos* MIPS Symbol Sizes::	Directives to override the size of symbols
2616dce513Schristos* MIPS Small Data:: 	Controlling the use of small data accesses
2716dce513Schristos* MIPS ISA::    	Directives to override the ISA level
2816dce513Schristos* MIPS assembly options:: Directives to control code generation
2916dce513Schristos* MIPS autoextend::	Directives for extending MIPS 16 bit instructions
3016dce513Schristos* MIPS insn::		Directive to mark data as an instruction
3116dce513Schristos* MIPS FP ABIs::	Marking which FP ABI is in use
3216dce513Schristos* MIPS NaN Encodings::	Directives to record which NaN encoding is being used
3316dce513Schristos* MIPS Option Stack::	Directives to save and restore options
3416dce513Schristos* MIPS ASE Instruction Generation Overrides:: Directives to control
3516dce513Schristos  			generation of MIPS ASE instructions
3616dce513Schristos* MIPS Floating-Point:: Directives to override floating-point options
3716dce513Schristos* MIPS Syntax::         MIPS specific syntactical considerations
3816dce513Schristos@end menu
3916dce513Schristos
4016dce513Schristos@node MIPS Options
4116dce513Schristos@section Assembler options
4216dce513Schristos
4316dce513SchristosThe MIPS configurations of @sc{gnu} @code{@value{AS}} support these
4416dce513Schristosspecial options:
4516dce513Schristos
4616dce513Schristos@table @code
4716dce513Schristos@cindex @code{-G} option (MIPS)
4816dce513Schristos@item -G @var{num}
4916dce513SchristosSet the ``small data'' limit to @var{n} bytes.  The default limit is 8 bytes.
5016dce513Schristos@xref{MIPS Small Data,, Controlling the use of small data accesses}.
5116dce513Schristos
5216dce513Schristos@cindex @code{-EB} option (MIPS)
5316dce513Schristos@cindex @code{-EL} option (MIPS)
5416dce513Schristos@cindex MIPS big-endian output
5516dce513Schristos@cindex MIPS little-endian output
5616dce513Schristos@cindex big-endian output, MIPS
5716dce513Schristos@cindex little-endian output, MIPS
5816dce513Schristos@item -EB
5916dce513Schristos@itemx -EL
6016dce513SchristosAny MIPS configuration of @code{@value{AS}} can select big-endian or
6116dce513Schristoslittle-endian output at run time (unlike the other @sc{gnu} development
6216dce513Schristostools, which must be configured for one or the other).  Use @samp{-EB}
6316dce513Schristosto select big-endian output, and @samp{-EL} for little-endian.
6416dce513Schristos
6516dce513Schristos@item -KPIC
6616dce513Schristos@cindex PIC selection, MIPS
6716dce513Schristos@cindex @option{-KPIC} option, MIPS
6816dce513SchristosGenerate SVR4-style PIC.  This option tells the assembler to generate
6916dce513SchristosSVR4-style position-independent macro expansions.  It also tells the
7016dce513Schristosassembler to mark the output file as PIC.
7116dce513Schristos
7216dce513Schristos@item -mvxworks-pic
7316dce513Schristos@cindex @option{-mvxworks-pic} option, MIPS
7416dce513SchristosGenerate VxWorks PIC.  This option tells the assembler to generate
7516dce513SchristosVxWorks-style position-independent macro expansions.
7616dce513Schristos
7716dce513Schristos@cindex MIPS architecture options
7816dce513Schristos@item -mips1
7916dce513Schristos@itemx -mips2
8016dce513Schristos@itemx -mips3
8116dce513Schristos@itemx -mips4
8216dce513Schristos@itemx -mips5
8316dce513Schristos@itemx -mips32
8416dce513Schristos@itemx -mips32r2
8516dce513Schristos@itemx -mips32r3
8616dce513Schristos@itemx -mips32r5
8716dce513Schristos@itemx -mips32r6
8816dce513Schristos@itemx -mips64
8916dce513Schristos@itemx -mips64r2
9016dce513Schristos@itemx -mips64r3
9116dce513Schristos@itemx -mips64r5
9216dce513Schristos@itemx -mips64r6
9316dce513SchristosGenerate code for a particular MIPS Instruction Set Architecture level.
9416dce513Schristos@samp{-mips1} corresponds to the R2000 and R3000 processors,
9516dce513Schristos@samp{-mips2} to the R6000 processor, @samp{-mips3} to the
9616dce513SchristosR4000 processor, and @samp{-mips4} to the R8000 and R10000 processors.
9716dce513Schristos@samp{-mips5}, @samp{-mips32}, @samp{-mips32r2}, @samp{-mips32r3},
9816dce513Schristos@samp{-mips32r5}, @samp{-mips32r6}, @samp{-mips64}, @samp{-mips64r2},
9916dce513Schristos@samp{-mips64r3}, @samp{-mips64r5}, and @samp{-mips64r6} correspond to
10016dce513Schristosgeneric MIPS V, MIPS32, MIPS32 Release 2, MIPS32 Release 3, MIPS32
10116dce513SchristosRelease 5, MIPS32 Release 6, MIPS64, and MIPS64 Release 2, MIPS64
10216dce513SchristosRelease 3, MIPS64 Release 5, and MIPS64 Release 6 ISA processors,
10316dce513Schristosrespectively.  You can also switch instruction sets during the assembly;
10416dce513Schristossee @ref{MIPS ISA, Directives to override the ISA level}.
10516dce513Schristos
10616dce513Schristos@item -mgp32
10716dce513Schristos@itemx -mfp32
10816dce513SchristosSome macros have different expansions for 32-bit and 64-bit registers.
10916dce513SchristosThe register sizes are normally inferred from the ISA and ABI, but these
11016dce513Schristosflags force a certain group of registers to be treated as 32 bits wide at
11116dce513Schristosall times.  @samp{-mgp32} controls the size of general-purpose registers
11216dce513Schristosand @samp{-mfp32} controls the size of floating-point registers.
11316dce513Schristos
11416dce513SchristosThe @code{.set gp=32} and @code{.set fp=32} directives allow the size
11516dce513Schristosof registers to be changed for parts of an object. The default value is
11616dce513Schristosrestored by @code{.set gp=default} and @code{.set fp=default}.
11716dce513Schristos
11816dce513SchristosOn some MIPS variants there is a 32-bit mode flag; when this flag is
11916dce513Schristosset, 64-bit instructions generate a trap.  Also, some 32-bit OSes only
12016dce513Schristossave the 32-bit registers on a context switch, so it is essential never
12116dce513Schristosto use the 64-bit registers.
12216dce513Schristos
12316dce513Schristos@item -mgp64
12416dce513Schristos@itemx -mfp64
12516dce513SchristosAssume that 64-bit registers are available.  This is provided in the
12616dce513Schristosinterests of symmetry with @samp{-mgp32} and @samp{-mfp32}.
12716dce513Schristos
12816dce513SchristosThe @code{.set gp=64} and @code{.set fp=64} directives allow the size
12916dce513Schristosof registers to be changed for parts of an object. The default value is
13016dce513Schristosrestored by @code{.set gp=default} and @code{.set fp=default}.
13116dce513Schristos
13216dce513Schristos@item -mfpxx
13316dce513SchristosMake no assumptions about whether 32-bit or 64-bit floating-point
13416dce513Schristosregisters are available. This is provided to support having modules
13516dce513Schristoscompatible with either @samp{-mfp32} or @samp{-mfp64}. This option can
13616dce513Schristosonly be used with MIPS II and above.
13716dce513Schristos
13816dce513SchristosThe @code{.set fp=xx} directive allows a part of an object to be marked
13916dce513Schristosas not making assumptions about 32-bit or 64-bit FP registers.  The
14016dce513Schristosdefault value is restored by @code{.set fp=default}.
14116dce513Schristos
14216dce513Schristos@item -modd-spreg
14316dce513Schristos@itemx -mno-odd-spreg
14416dce513SchristosEnable use of floating-point operations on odd-numbered single-precision
14516dce513Schristosregisters when supported by the ISA.  @samp{-mfpxx} implies
14616dce513Schristos@samp{-mno-odd-spreg}, otherwise the default is @samp{-modd-spreg}
14716dce513Schristos
14816dce513Schristos@item -mips16
14916dce513Schristos@itemx -no-mips16
15016dce513SchristosGenerate code for the MIPS 16 processor.  This is equivalent to putting
151ede78133Schristos@code{.module mips16} at the start of the assembly file.  @samp{-no-mips16}
15216dce513Schristosturns off this option.
15316dce513Schristos
154ede78133Schristos@item -mmips16e2
155ede78133Schristos@itemx -mno-mips16e2
156ede78133SchristosEnable the use of MIPS16e2 instructions in MIPS16 mode.  This is equivalent
157ede78133Schristosto putting @code{.module mips16e2} at the start of the assembly file.
158ede78133Schristos@samp{-mno-mips16e2} turns off this option.
159ede78133Schristos
16016dce513Schristos@item -mmicromips
16116dce513Schristos@itemx -mno-micromips
16216dce513SchristosGenerate code for the microMIPS processor.  This is equivalent to putting
163ede78133Schristos@code{.module micromips} at the start of the assembly file.
164ede78133Schristos@samp{-mno-micromips} turns off this option.  This is equivalent to putting
165ede78133Schristos@code{.module nomicromips} at the start of the assembly file.
16616dce513Schristos
16716dce513Schristos@item -msmartmips
16816dce513Schristos@itemx -mno-smartmips
16916dce513SchristosEnables the SmartMIPS extensions to the MIPS32 instruction set, which
17016dce513Schristosprovides a number of new instructions which target smartcard and
17116dce513Schristoscryptographic applications.  This is equivalent to putting
172ede78133Schristos@code{.module smartmips} at the start of the assembly file.
17316dce513Schristos@samp{-mno-smartmips} turns off this option.
17416dce513Schristos
17516dce513Schristos@item -mips3d
17616dce513Schristos@itemx -no-mips3d
17716dce513SchristosGenerate code for the MIPS-3D Application Specific Extension.
17816dce513SchristosThis tells the assembler to accept MIPS-3D instructions.
17916dce513Schristos@samp{-no-mips3d} turns off this option.
18016dce513Schristos
18116dce513Schristos@item -mdmx
18216dce513Schristos@itemx -no-mdmx
18316dce513SchristosGenerate code for the MDMX Application Specific Extension.
18416dce513SchristosThis tells the assembler to accept MDMX instructions.
18516dce513Schristos@samp{-no-mdmx} turns off this option.
18616dce513Schristos
18716dce513Schristos@item -mdsp
18816dce513Schristos@itemx -mno-dsp
18916dce513SchristosGenerate code for the DSP Release 1 Application Specific Extension.
19016dce513SchristosThis tells the assembler to accept DSP Release 1 instructions.
19116dce513Schristos@samp{-mno-dsp} turns off this option.
19216dce513Schristos
19316dce513Schristos@item -mdspr2
19416dce513Schristos@itemx -mno-dspr2
19516dce513SchristosGenerate code for the DSP Release 2 Application Specific Extension.
19616dce513SchristosThis option implies @samp{-mdsp}.
19716dce513SchristosThis tells the assembler to accept DSP Release 2 instructions.
19816dce513Schristos@samp{-mno-dspr2} turns off this option.
19916dce513Schristos
20016dce513Schristos@item -mdspr3
20116dce513Schristos@itemx -mno-dspr3
20216dce513SchristosGenerate code for the DSP Release 3 Application Specific Extension.
20316dce513SchristosThis option implies @samp{-mdsp} and @samp{-mdspr2}.
20416dce513SchristosThis tells the assembler to accept DSP Release 3 instructions.
20516dce513Schristos@samp{-mno-dspr3} turns off this option.
20616dce513Schristos
20716dce513Schristos@item -mmt
20816dce513Schristos@itemx -mno-mt
20916dce513SchristosGenerate code for the MT Application Specific Extension.
21016dce513SchristosThis tells the assembler to accept MT instructions.
21116dce513Schristos@samp{-mno-mt} turns off this option.
21216dce513Schristos
21316dce513Schristos@item -mmcu
21416dce513Schristos@itemx -mno-mcu
21516dce513SchristosGenerate code for the MCU Application Specific Extension.
21616dce513SchristosThis tells the assembler to accept MCU instructions.
21716dce513Schristos@samp{-mno-mcu} turns off this option.
21816dce513Schristos
21916dce513Schristos@item -mmsa
22016dce513Schristos@itemx -mno-msa
22116dce513SchristosGenerate code for the MIPS SIMD Architecture Extension.
22216dce513SchristosThis tells the assembler to accept MSA instructions.
22316dce513Schristos@samp{-mno-msa} turns off this option.
22416dce513Schristos
22516dce513Schristos@item -mxpa
22616dce513Schristos@itemx -mno-xpa
22716dce513SchristosGenerate code for the MIPS eXtended Physical Address (XPA) Extension.
22816dce513SchristosThis tells the assembler to accept XPA instructions.
22916dce513Schristos@samp{-mno-xpa} turns off this option.
23016dce513Schristos
23116dce513Schristos@item -mvirt
23216dce513Schristos@itemx -mno-virt
23316dce513SchristosGenerate code for the Virtualization Application Specific Extension.
23416dce513SchristosThis tells the assembler to accept Virtualization instructions.
23516dce513Schristos@samp{-mno-virt} turns off this option.
23616dce513Schristos
237ede78133Schristos@item -mcrc
238ede78133Schristos@itemx -mno-crc
239ede78133SchristosGenerate code for the cyclic redundancy check (CRC) Application Specific
240ede78133SchristosExtension.  This tells the assembler to accept CRC instructions.
241ede78133Schristos@samp{-mno-crc} turns off this option.
242ede78133Schristos
243ede78133Schristos@item -mginv
244ede78133Schristos@itemx -mno-ginv
245ede78133SchristosGenerate code for the Global INValidate (GINV) Application Specific
246ede78133SchristosExtension.  This tells the assembler to accept GINV instructions.
247ede78133Schristos@samp{-mno-ginv} turns off this option.
248ede78133Schristos
249012573ebSchristos@item -mloongson-mmi
250012573ebSchristos@itemx -mno-loongson-mmi
251012573ebSchristosGenerate code for the Loongson MultiMedia extensions Instructions (MMI)
252012573ebSchristosApplication Specific Extension.  This tells the assembler to accept MMI
253012573ebSchristosinstructions.
254012573ebSchristos@samp{-mno-loongson-mmi} turns off this option.
255012573ebSchristos
256012573ebSchristos@item -mloongson-cam
257012573ebSchristos@itemx -mno-loongson-cam
258012573ebSchristosGenerate code for the Loongson Content Address Memory (CAM)
259012573ebSchristosApplication Specific Extension.  This tells the assembler to accept CAM
260012573ebSchristosinstructions.
261012573ebSchristos@samp{-mno-loongson-cam} turns off this option.
262012573ebSchristos
263012573ebSchristos@item -mloongson-ext
264012573ebSchristos@itemx -mno-loongson-ext
265012573ebSchristosGenerate code for the Loongson EXTensions (EXT) instructions
266012573ebSchristosApplication Specific Extension.  This tells the assembler to accept EXT
267012573ebSchristosinstructions.
268012573ebSchristos@samp{-mno-loongson-ext} turns off this option.
269012573ebSchristos
270012573ebSchristos@item -mloongson-ext2
271012573ebSchristos@itemx -mno-loongson-ext2
272012573ebSchristosGenerate code for the Loongson EXTensions R2 (EXT2) instructions
273012573ebSchristosApplication Specific Extension.  This tells the assembler to accept EXT2
274012573ebSchristosinstructions.
275012573ebSchristos@samp{-mno-loongson-ext2} turns off this option.
276012573ebSchristos
27716dce513Schristos@item -minsn32
27816dce513Schristos@itemx -mno-insn32
27916dce513SchristosOnly use 32-bit instruction encodings when generating code for the
28016dce513SchristosmicroMIPS processor.  This option inhibits the use of any 16-bit
28116dce513Schristosinstructions.  This is equivalent to putting @code{.set insn32} at
28216dce513Schristosthe start of the assembly file.  @samp{-mno-insn32} turns off this
28316dce513Schristosoption.  This is equivalent to putting @code{.set noinsn32} at the
28416dce513Schristosstart of the assembly file.  By default @samp{-mno-insn32} is
28516dce513Schristosselected, allowing all instructions to be used.
28616dce513Schristos
28716dce513Schristos@item -mfix7000
28816dce513Schristos@itemx -mno-fix7000
28916dce513SchristosCause nops to be inserted if the read of the destination register
29016dce513Schristosof an mfhi or mflo instruction occurs in the following two instructions.
29116dce513Schristos
29216dce513Schristos@item -mfix-rm7000
29316dce513Schristos@itemx -mno-fix-rm7000
29416dce513SchristosCause nops to be inserted if a dmult or dmultu instruction is
29516dce513Schristosfollowed by a load instruction.
29616dce513Schristos
29716dce513Schristos@item -mfix-loongson2f-jump
29816dce513Schristos@itemx -mno-fix-loongson2f-jump
29916dce513SchristosEliminate instruction fetch from outside 256M region to work around the
30016dce513SchristosLoongson2F @samp{jump} instructions.  Without it, under extreme cases,
30116dce513Schristosthe kernel may crash.  The issue has been solved in latest processor
30216dce513Schristosbatches, but this fix has no side effect to them.
30316dce513Schristos
30416dce513Schristos@item -mfix-loongson2f-nop
30516dce513Schristos@itemx -mno-fix-loongson2f-nop
30616dce513SchristosReplace nops by @code{or at,at,zero} to work around the Loongson2F
30716dce513Schristos@samp{nop} errata.  Without it, under extreme cases, the CPU might
30816dce513Schristosdeadlock.  The issue has been solved in later Loongson2F batches, but
30916dce513Schristosthis fix has no side effect to them.
31016dce513Schristos
311012573ebSchristos@item -mfix-loongson3-llsc
312012573ebSchristos@itemx -mno-fix-loongson3-llsc
313012573ebSchristosInsert @samp{sync} before @samp{ll} and @samp{lld} to work around
314012573ebSchristosLoongson3 LLSC errata.  Without it, under extrame cases, the CPU might
315012573ebSchristosdeadlock. The default can be controlled by the
316012573ebSchristos@option{--enable-mips-fix-loongson3-llsc=[yes|no]} configure option.
317012573ebSchristos
31816dce513Schristos@item -mfix-vr4120
31916dce513Schristos@itemx -mno-fix-vr4120
32016dce513SchristosInsert nops to work around certain VR4120 errata.  This option is
32116dce513Schristosintended to be used on GCC-generated code: it is not designed to catch
32216dce513Schristosall problems in hand-written assembler code.
32316dce513Schristos
32416dce513Schristos@item -mfix-vr4130
32516dce513Schristos@itemx -mno-fix-vr4130
32616dce513SchristosInsert nops to work around the VR4130 @samp{mflo}/@samp{mfhi} errata.
32716dce513Schristos
32816dce513Schristos@item -mfix-loongson2f-btb
32916dce513Schristos@itemx -mno-fix-loongson2f-btb
33016dce513SchristosClear the Branch Target Buffer before any jump through a register.  This
33116dce513Schristosoption is intended to be used on kernel code for the Loongson 2F processor
33216dce513Schristosonly; userland code compiled with this option will fault, and kernel code
33316dce513Schristoscompiled with this option run on another processor than Loongson 2F will
33416dce513Schristosyield unpredictable results.
33516dce513Schristos
33616dce513Schristos@item -mfix-24k
33716dce513Schristos@itemx -mno-fix-24k
33816dce513SchristosInsert nops to work around the 24K @samp{eret}/@samp{deret} errata.
33916dce513Schristos
34016dce513Schristos@item -mfix-cn63xxp1
34116dce513Schristos@itemx -mno-fix-cn63xxp1
34216dce513SchristosReplace @code{pref} hints 0 - 4 and 6 - 24 with hint 28 to work around
34316dce513Schristoscertain CN63XXP1 errata.
34416dce513Schristos
345012573ebSchristos@item -mfix-r5900
346012573ebSchristos@itemx -mno-fix-r5900
347012573ebSchristosDo not attempt to schedule the preceding instruction into the delay slot
348012573ebSchristosof a branch instruction placed at the end of a short loop of six
349012573ebSchristosinstructions or fewer and always schedule a @code{nop} instruction there
350012573ebSchristosinstead.  The short loop bug under certain conditions causes loops to
351012573ebSchristosexecute only once or twice, due to a hardware bug in the R5900 chip.
352012573ebSchristos
35316dce513Schristos@item -m4010
35416dce513Schristos@itemx -no-m4010
35516dce513SchristosGenerate code for the LSI R4010 chip.  This tells the assembler to
35616dce513Schristosaccept the R4010-specific instructions (@samp{addciu}, @samp{ffc},
35716dce513Schristosetc.), and to not schedule @samp{nop} instructions around accesses to
35816dce513Schristosthe @samp{HI} and @samp{LO} registers.  @samp{-no-m4010} turns off this
35916dce513Schristosoption.
36016dce513Schristos
36116dce513Schristos@item -m4650
36216dce513Schristos@itemx -no-m4650
36316dce513SchristosGenerate code for the MIPS R4650 chip.  This tells the assembler to accept
36416dce513Schristosthe @samp{mad} and @samp{madu} instruction, and to not schedule @samp{nop}
36516dce513Schristosinstructions around accesses to the @samp{HI} and @samp{LO} registers.
36616dce513Schristos@samp{-no-m4650} turns off this option.
36716dce513Schristos
36816dce513Schristos@item -m3900
36916dce513Schristos@itemx -no-m3900
37016dce513Schristos@itemx -m4100
37116dce513Schristos@itemx -no-m4100
37216dce513SchristosFor each option @samp{-m@var{nnnn}}, generate code for the MIPS
37316dce513SchristosR@var{nnnn} chip.  This tells the assembler to accept instructions
37416dce513Schristosspecific to that chip, and to schedule for that chip's hazards.
37516dce513Schristos
37616dce513Schristos@item -march=@var{cpu}
37716dce513SchristosGenerate code for a particular MIPS CPU.  It is exactly equivalent to
37816dce513Schristos@samp{-m@var{cpu}}, except that there are more value of @var{cpu}
37916dce513Schristosunderstood.  Valid @var{cpu} value are:
38016dce513Schristos
38116dce513Schristos@quotation
38216dce513Schristos2000,
38316dce513Schristos3000,
38416dce513Schristos3900,
38516dce513Schristos4000,
38616dce513Schristos4010,
38716dce513Schristos4100,
38816dce513Schristos4111,
38916dce513Schristosvr4120,
39016dce513Schristosvr4130,
39116dce513Schristosvr4181,
39216dce513Schristos4300,
39316dce513Schristos4400,
39416dce513Schristos4600,
39516dce513Schristos4650,
39616dce513Schristos5000,
39716dce513Schristosrm5200,
39816dce513Schristosrm5230,
39916dce513Schristosrm5231,
40016dce513Schristosrm5261,
40116dce513Schristosrm5721,
40216dce513Schristosvr5400,
40316dce513Schristosvr5500,
40416dce513Schristos6000,
40516dce513Schristosrm7000,
40616dce513Schristos8000,
40716dce513Schristosrm9000,
40816dce513Schristos10000,
40916dce513Schristos12000,
41016dce513Schristos14000,
41116dce513Schristos16000,
41216dce513Schristos4kc,
41316dce513Schristos4km,
41416dce513Schristos4kp,
41516dce513Schristos4ksc,
41616dce513Schristos4kec,
41716dce513Schristos4kem,
41816dce513Schristos4kep,
41916dce513Schristos4ksd,
42016dce513Schristosm4k,
42116dce513Schristosm4kp,
42216dce513Schristosm14k,
42316dce513Schristosm14kc,
42416dce513Schristosm14ke,
42516dce513Schristosm14kec,
42616dce513Schristos24kc,
42716dce513Schristos24kf2_1,
42816dce513Schristos24kf,
42916dce513Schristos24kf1_1,
43016dce513Schristos24kec,
43116dce513Schristos24kef2_1,
43216dce513Schristos24kef,
43316dce513Schristos24kef1_1,
43416dce513Schristos34kc,
43516dce513Schristos34kf2_1,
43616dce513Schristos34kf,
43716dce513Schristos34kf1_1,
43816dce513Schristos34kn,
43916dce513Schristos74kc,
44016dce513Schristos74kf2_1,
44116dce513Schristos74kf,
44216dce513Schristos74kf1_1,
44316dce513Schristos74kf3_2,
44416dce513Schristos1004kc,
44516dce513Schristos1004kf2_1,
44616dce513Schristos1004kf,
44716dce513Schristos1004kf1_1,
44816dce513Schristosinteraptiv,
449ede78133Schristosinteraptiv-mr2,
45016dce513Schristosm5100,
45116dce513Schristosm5101,
45216dce513Schristosp5600,
45316dce513Schristos5kc,
45416dce513Schristos5kf,
45516dce513Schristos20kc,
45616dce513Schristos25kf,
45716dce513Schristossb1,
45816dce513Schristossb1a,
45916dce513Schristosi6400,
460012573ebSchristosi6500,
46116dce513Schristosp6600,
46216dce513Schristosloongson2e,
46316dce513Schristosloongson2f,
464012573ebSchristosgs464,
465012573ebSchristosgs464e,
466012573ebSchristosgs264e,
46716dce513Schristosocteon,
46816dce513Schristosocteon+,
46916dce513Schristosocteon2,
47016dce513Schristosocteon3,
47116dce513Schristosxlr,
47216dce513Schristosxlp
47316dce513Schristos@end quotation
47416dce513Schristos
47516dce513SchristosFor compatibility reasons, @samp{@var{n}x} and @samp{@var{b}fx} are
47616dce513Schristosaccepted as synonyms for @samp{@var{n}f1_1}.  These values are
47716dce513Schristosdeprecated.
47816dce513Schristos
47916dce513Schristos@item -mtune=@var{cpu}
48016dce513SchristosSchedule and tune for a particular MIPS CPU.  Valid @var{cpu} values are
48116dce513Schristosidentical to @samp{-march=@var{cpu}}.
48216dce513Schristos
48316dce513Schristos@item -mabi=@var{abi}
48416dce513SchristosRecord which ABI the source code uses.  The recognized arguments
48516dce513Schristosare: @samp{32}, @samp{n32}, @samp{o64}, @samp{64} and @samp{eabi}.
48616dce513Schristos
48716dce513Schristos@item -msym32
48816dce513Schristos@itemx -mno-sym32
48916dce513Schristos@cindex -msym32
49016dce513Schristos@cindex -mno-sym32
49116dce513SchristosEquivalent to adding @code{.set sym32} or @code{.set nosym32} to
49216dce513Schristosthe beginning of the assembler input.  @xref{MIPS Symbol Sizes}.
49316dce513Schristos
49416dce513Schristos@cindex @code{-nocpp} ignored (MIPS)
49516dce513Schristos@item -nocpp
49616dce513SchristosThis option is ignored.  It is accepted for command-line compatibility with
49716dce513Schristosother assemblers, which use it to turn off C style preprocessing.  With
49816dce513Schristos@sc{gnu} @code{@value{AS}}, there is no need for @samp{-nocpp}, because the
49916dce513Schristos@sc{gnu} assembler itself never runs the C preprocessor.
50016dce513Schristos
50116dce513Schristos@item -msoft-float
50216dce513Schristos@itemx -mhard-float
50316dce513SchristosDisable or enable floating-point instructions.  Note that by default
50416dce513Schristosfloating-point instructions are always allowed even with CPU targets
50516dce513Schristosthat don't have support for these instructions.
50616dce513Schristos
50716dce513Schristos@item -msingle-float
50816dce513Schristos@itemx -mdouble-float
50916dce513SchristosDisable or enable double-precision floating-point operations.  Note
51016dce513Schristosthat by default double-precision floating-point operations are always
51116dce513Schristosallowed even with CPU targets that don't have support for these
51216dce513Schristosoperations.
51316dce513Schristos
51416dce513Schristos@item --construct-floats
51516dce513Schristos@itemx --no-construct-floats
51616dce513SchristosThe @code{--no-construct-floats} option disables the construction of
51716dce513Schristosdouble width floating point constants by loading the two halves of the
51816dce513Schristosvalue into the two single width floating point registers that make up
51916dce513Schristosthe double width register.  This feature is useful if the processor
52016dce513Schristossupport the FR bit in its status  register, and this bit is known (by
52116dce513Schristosthe programmer) to be set.  This bit prevents the aliasing of the double
52216dce513Schristoswidth register by the single width registers.
52316dce513Schristos
52416dce513SchristosBy default @code{--construct-floats} is selected, allowing construction
52516dce513Schristosof these floating point constants.
52616dce513Schristos
52716dce513Schristos@item --relax-branch
52816dce513Schristos@itemx --no-relax-branch
52916dce513SchristosThe @samp{--relax-branch} option enables the relaxation of out-of-range
53016dce513Schristosbranches.  Any branches whose target cannot be reached directly are
53116dce513Schristosconverted to a small instruction sequence including an inverse-condition
53216dce513Schristosbranch to the physically next instruction, and a jump to the original
53316dce513Schristostarget is inserted between the two instructions.  In PIC code the jump
53416dce513Schristoswill involve further instructions for address calculation.
53516dce513Schristos
53616dce513SchristosThe @code{BC1ANY2F}, @code{BC1ANY2T}, @code{BC1ANY4F}, @code{BC1ANY4T},
53716dce513Schristos@code{BPOSGE32} and @code{BPOSGE64} instructions are excluded from
53816dce513Schristosrelaxation, because they have no complementing counterparts.  They could
53916dce513Schristosbe relaxed with the use of a longer sequence involving another branch,
54016dce513Schristoshowever this has not been implemented and if their target turns out of
54116dce513Schristosreach, they produce an error even if branch relaxation is enabled.
54216dce513Schristos
54316dce513SchristosAlso no MIPS16 branches are ever relaxed.
54416dce513Schristos
54516dce513SchristosBy default @samp{--no-relax-branch} is selected, causing any out-of-range
54616dce513Schristosbranches to produce an error.
54716dce513Schristos
548ede78133Schristos@item -mignore-branch-isa
549ede78133Schristos@itemx -mno-ignore-branch-isa
550ede78133SchristosIgnore branch checks for invalid transitions between ISA modes.
551ede78133Schristos
552ede78133SchristosThe semantics of branches does not provide for an ISA mode switch, so in
553ede78133Schristosmost cases the ISA mode a branch has been encoded for has to be the same
554ede78133Schristosas the ISA mode of the branch's target label.  If the ISA modes do not
555ede78133Schristosmatch, then such a branch, if taken, will cause the ISA mode to remain
556ede78133Schristosunchanged and instructions that follow will be executed in the wrong ISA
557ede78133Schristosmode causing the program to misbehave or crash.
558ede78133Schristos
559ede78133SchristosIn the case of the @code{BAL} instruction it may be possible to relax
560ede78133Schristosit to an equivalent @code{JALX} instruction so that the ISA mode is
561ede78133Schristosswitched at the run time as required.  For other branches no relaxation
562ede78133Schristosis possible and therefore GAS has checks implemented that verify in
563ede78133Schristosbranch assembly that the two ISA modes match, and report an error
564ede78133Schristosotherwise so that the problem with code can be diagnosed at the assembly
565ede78133Schristostime rather than at the run time.
566ede78133Schristos
567ede78133SchristosHowever some assembly code, including generated code produced by some
568ede78133Schristosversions of GCC, may incorrectly include branches to data labels, which
569ede78133Schristosappear to require a mode switch but are either dead or immediately
570ede78133Schristosfollowed by valid instructions encoded for the same ISA the branch has
571ede78133Schristosbeen encoded for.  While not strictly correct at the source level such
572ede78133Schristoscode will execute as intended, so to help with these cases
573ede78133Schristos@samp{-mignore-branch-isa} is supported which disables ISA mode checks
574ede78133Schristosfor branches.
575ede78133Schristos
576ede78133SchristosBy default @samp{-mno-ignore-branch-isa} is selected, causing any invalid
577ede78133Schristosbranch requiring a transition between ISA modes to produce an error.
578ede78133Schristos
579012573ebSchristos@cindex @option{-mnan=} command-line option, MIPS
58016dce513Schristos@item -mnan=@var{encoding}
58116dce513SchristosThis option indicates whether the source code uses the IEEE 2008
58216dce513SchristosNaN encoding (@option{-mnan=2008}) or the original MIPS encoding
58316dce513Schristos(@option{-mnan=legacy}).  It is equivalent to adding a @code{.nan}
58416dce513Schristosdirective to the beginning of the source file.  @xref{MIPS NaN Encodings}.
58516dce513Schristos
58616dce513Schristos@option{-mnan=legacy} is the default if no @option{-mnan} option or
58716dce513Schristos@code{.nan} directive is used.
58816dce513Schristos
58916dce513Schristos@item --trap
59016dce513Schristos@itemx --no-break
59116dce513Schristos@c FIXME!  (1) reflect these options (next item too) in option summaries;
59216dce513Schristos@c         (2) stop teasing, say _which_ instructions expanded _how_.
59316dce513Schristos@code{@value{AS}} automatically macro expands certain division and
59416dce513Schristosmultiplication instructions to check for overflow and division by zero.  This
59516dce513Schristosoption causes @code{@value{AS}} to generate code to take a trap exception
59616dce513Schristosrather than a break exception when an error is detected.  The trap instructions
59716dce513Schristosare only supported at Instruction Set Architecture level 2 and higher.
59816dce513Schristos
59916dce513Schristos@item --break
60016dce513Schristos@itemx --no-trap
60116dce513SchristosGenerate code to take a break exception rather than a trap exception when an
60216dce513Schristoserror is detected.  This is the default.
60316dce513Schristos
60416dce513Schristos@item -mpdr
60516dce513Schristos@itemx -mno-pdr
60616dce513SchristosControl generation of @code{.pdr} sections.  Off by default on IRIX, on
60716dce513Schristoselsewhere.
60816dce513Schristos
60916dce513Schristos@item -mshared
61016dce513Schristos@itemx -mno-shared
61116dce513SchristosWhen generating code using the Unix calling conventions (selected by
61216dce513Schristos@samp{-KPIC} or @samp{-mcall_shared}), gas will normally generate code
61316dce513Schristoswhich can go into a shared library.  The @samp{-mno-shared} option
61416dce513Schristostells gas to generate code which uses the calling convention, but can
61516dce513Schristosnot go into a shared library.  The resulting code is slightly more
61616dce513Schristosefficient.  This option only affects the handling of the
61716dce513Schristos@samp{.cpload} and @samp{.cpsetup} pseudo-ops.
61816dce513Schristos@end table
61916dce513Schristos
62016dce513Schristos@node MIPS Macros
62116dce513Schristos@section High-level assembly macros
62216dce513Schristos
62316dce513SchristosMIPS assemblers have traditionally provided a wider range of
62416dce513Schristosinstructions than the MIPS architecture itself.  These extra
62516dce513Schristosinstructions are usually referred to as ``macro'' instructions
62616dce513Schristos@footnote{The term ``macro'' is somewhat overloaded here, since
62716dce513Schristosthese macros have no relation to those defined by @code{.macro},
62816dce513Schristos@pxref{Macro,, @code{.macro}}.}.
62916dce513Schristos
63016dce513SchristosSome MIPS macro instructions extend an underlying architectural instruction
63116dce513Schristoswhile others are entirely new.  An example of the former type is @code{and},
63216dce513Schristoswhich allows the third operand to be either a register or an arbitrary
63316dce513Schristosimmediate value.  Examples of the latter type include @code{bgt}, which
63416dce513Schristosbranches to the third operand when the first operand is greater than
63516dce513Schristosthe second operand, and @code{ulh}, which implements an unaligned
63616dce513Schristos2-byte load.
63716dce513Schristos
63816dce513SchristosOne of the most common extensions provided by macros is to expand
63916dce513Schristosmemory offsets to the full address range (32 or 64 bits) and to allow
64016dce513Schristossymbolic offsets such as @samp{my_data + 4} to be used in place of
64116dce513Schristosinteger constants.  For example, the architectural instruction
64216dce513Schristos@code{lbu} allows only a signed 16-bit offset, whereas the macro
64316dce513Schristos@code{lbu} allows code such as @samp{lbu $4,array+32769($5)}.
64416dce513SchristosThe implementation of these symbolic offsets depends on several factors,
64516dce513Schristossuch as whether the assembler is generating SVR4-style PIC (selected by
64616dce513Schristos@option{-KPIC}, @pxref{MIPS Options,, Assembler options}), the size of symbols
64716dce513Schristos(@pxref{MIPS Symbol Sizes,, Directives to override the size of symbols}),
64816dce513Schristosand the small data limit (@pxref{MIPS Small Data,, Controlling the use
64916dce513Schristosof small data accesses}).
65016dce513Schristos
65116dce513Schristos@kindex @code{.set macro}
65216dce513Schristos@kindex @code{.set nomacro}
65316dce513SchristosSometimes it is undesirable to have one assembly instruction expand
65416dce513Schristosto several machine instructions.  The directive @code{.set nomacro}
65516dce513Schristostells the assembler to warn when this happens.  @code{.set macro}
65616dce513Schristosrestores the default behavior.
65716dce513Schristos
65816dce513Schristos@cindex @code{at} register, MIPS
65916dce513Schristos@kindex @code{.set at=@var{reg}}
66016dce513SchristosSome macro instructions need a temporary register to store intermediate
66116dce513Schristosresults.  This register is usually @code{$1}, also known as @code{$at},
66216dce513Schristosbut it can be changed to any core register @var{reg} using
66316dce513Schristos@code{.set at=@var{reg}}.  Note that @code{$at} always refers
66416dce513Schristosto @code{$1} regardless of which register is being used as the
66516dce513Schristostemporary register.
66616dce513Schristos
66716dce513Schristos@kindex @code{.set at}
66816dce513Schristos@kindex @code{.set noat}
66916dce513SchristosImplicit uses of the temporary register in macros could interfere with
67016dce513Schristosexplicit uses in the assembly code.  The assembler therefore warns
67116dce513Schristoswhenever it sees an explicit use of the temporary register.  The directive
67216dce513Schristos@code{.set noat} silences this warning while @code{.set at} restores
67316dce513Schristosthe default behavior.  It is safe to use @code{.set noat} while
67416dce513Schristos@code{.set nomacro} is in effect since single-instruction macros
67516dce513Schristosnever need a temporary register.
67616dce513Schristos
67716dce513SchristosNote that while the @sc{gnu} assembler provides these macros for compatibility,
67816dce513Schristosit does not make any attempt to optimize them with the surrounding code.
67916dce513Schristos
68016dce513Schristos@node MIPS Symbol Sizes
68116dce513Schristos@section Directives to override the size of symbols
68216dce513Schristos
68316dce513Schristos@kindex @code{.set sym32}
68416dce513Schristos@kindex @code{.set nosym32}
68516dce513SchristosThe n64 ABI allows symbols to have any 64-bit value.  Although this
68616dce513Schristosprovides a great deal of flexibility, it means that some macros have
68716dce513Schristosmuch longer expansions than their 32-bit counterparts.  For example,
68816dce513Schristosthe non-PIC expansion of @samp{dla $4,sym} is usually:
68916dce513Schristos
69016dce513Schristos@smallexample
69116dce513Schristoslui     $4,%highest(sym)
69216dce513Schristoslui     $1,%hi(sym)
69316dce513Schristosdaddiu  $4,$4,%higher(sym)
69416dce513Schristosdaddiu  $1,$1,%lo(sym)
69516dce513Schristosdsll32  $4,$4,0
69616dce513Schristosdaddu   $4,$4,$1
69716dce513Schristos@end smallexample
69816dce513Schristos
69916dce513Schristoswhereas the 32-bit expansion is simply:
70016dce513Schristos
70116dce513Schristos@smallexample
70216dce513Schristoslui     $4,%hi(sym)
70316dce513Schristosdaddiu  $4,$4,%lo(sym)
70416dce513Schristos@end smallexample
70516dce513Schristos
70616dce513Schristosn64 code is sometimes constructed in such a way that all symbolic
70716dce513Schristosconstants are known to have 32-bit values, and in such cases, it's
70816dce513Schristospreferable to use the 32-bit expansion instead of the 64-bit
70916dce513Schristosexpansion.
71016dce513Schristos
71116dce513SchristosYou can use the @code{.set sym32} directive to tell the assembler
71216dce513Schristosthat, from this point on, all expressions of the form
71316dce513Schristos@samp{@var{symbol}} or @samp{@var{symbol} + @var{offset}}
71416dce513Schristoshave 32-bit values.  For example:
71516dce513Schristos
71616dce513Schristos@smallexample
71716dce513Schristos.set sym32
71816dce513Schristosdla     $4,sym
71916dce513Schristoslw      $4,sym+16
72016dce513Schristossw      $4,sym+0x8000($4)
72116dce513Schristos@end smallexample
72216dce513Schristos
72316dce513Schristoswill cause the assembler to treat @samp{sym}, @code{sym+16} and
72416dce513Schristos@code{sym+0x8000} as 32-bit values.  The handling of non-symbolic
72516dce513Schristosaddresses is not affected.
72616dce513Schristos
72716dce513SchristosThe directive @code{.set nosym32} ends a @code{.set sym32} block and
72816dce513Schristosreverts to the normal behavior.  It is also possible to change the
72916dce513Schristossymbol size using the command-line options @option{-msym32} and
73016dce513Schristos@option{-mno-sym32}.
73116dce513Schristos
73216dce513SchristosThese options and directives are always accepted, but at present,
73316dce513Schristosthey have no effect for anything other than n64.
73416dce513Schristos
73516dce513Schristos@node MIPS Small Data
73616dce513Schristos@section Controlling the use of small data accesses
73716dce513Schristos
73816dce513Schristos@c This section deliberately glosses over the possibility of using -G
73916dce513Schristos@c in SVR4-style PIC, as could be done on IRIX.  We don't support that.
74016dce513Schristos@cindex small data, MIPS
74116dce513Schristos@cindex @code{gp} register, MIPS
74216dce513SchristosIt often takes several instructions to load the address of a symbol.
74316dce513SchristosFor example, when @samp{addr} is a 32-bit symbol, the non-PIC expansion
74416dce513Schristosof @samp{dla $4,addr} is usually:
74516dce513Schristos
74616dce513Schristos@smallexample
74716dce513Schristoslui     $4,%hi(addr)
74816dce513Schristosdaddiu  $4,$4,%lo(addr)
74916dce513Schristos@end smallexample
75016dce513Schristos
75116dce513SchristosThe sequence is much longer when @samp{addr} is a 64-bit symbol.
75216dce513Schristos@xref{MIPS Symbol Sizes,, Directives to override the size of symbols}.
75316dce513Schristos
75416dce513SchristosIn order to cut down on this overhead, most embedded MIPS systems
75516dce513Schristosset aside a 64-kilobyte ``small data'' area and guarantee that all
75616dce513Schristosdata of size @var{n} and smaller will be placed in that area.
75716dce513SchristosThe limit @var{n} is passed to both the assembler and the linker
75816dce513Schristosusing the command-line option @option{-G @var{n}}, @pxref{MIPS Options,,
75916dce513SchristosAssembler options}.  Note that the same value of @var{n} must be used
76016dce513Schristoswhen linking and when assembling all input files to the link; any
76116dce513Schristosinconsistency could cause a relocation overflow error.
76216dce513Schristos
76316dce513SchristosThe size of an object in the @code{.bss} section is set by the
76416dce513Schristos@code{.comm} or @code{.lcomm} directive that defines it.  The size of
76516dce513Schristosan external object may be set with the @code{.extern} directive.  For
76616dce513Schristosexample, @samp{.extern sym,4} declares that the object at @code{sym}
76716dce513Schristosis 4 bytes in length, while leaving @code{sym} otherwise undefined.
76816dce513Schristos
76916dce513SchristosWhen no @option{-G} option is given, the default limit is 8 bytes.
77016dce513SchristosThe option @option{-G 0} prevents any data from being automatically
77116dce513Schristosclassified as small.
77216dce513Schristos
77316dce513SchristosIt is also possible to mark specific objects as small by putting them
77416dce513Schristosin the special sections @code{.sdata} and @code{.sbss}, which are
77516dce513Schristos``small'' counterparts of @code{.data} and @code{.bss} respectively.
77616dce513SchristosThe toolchain will treat such data as small regardless of the
77716dce513Schristos@option{-G} setting.
77816dce513Schristos
77916dce513SchristosOn startup, systems that support a small data area are expected to
78016dce513Schristosinitialize register @code{$28}, also known as @code{$gp}, in such a
78116dce513Schristosway that small data can be accessed using a 16-bit offset from that
78216dce513Schristosregister.  For example, when @samp{addr} is small data,
78316dce513Schristosthe @samp{dla $4,addr} instruction above is equivalent to:
78416dce513Schristos
78516dce513Schristos@smallexample
78616dce513Schristosdaddiu  $4,$28,%gp_rel(addr)
78716dce513Schristos@end smallexample
78816dce513Schristos
78916dce513SchristosSmall data is not supported for SVR4-style PIC.
79016dce513Schristos
79116dce513Schristos@node MIPS ISA
79216dce513Schristos@section Directives to override the ISA level
79316dce513Schristos
79416dce513Schristos@cindex MIPS ISA override
79516dce513Schristos@kindex @code{.set mips@var{n}}
79616dce513Schristos@sc{gnu} @code{@value{AS}} supports an additional directive to change
79716dce513Schristosthe MIPS Instruction Set Architecture level on the fly: @code{.set
79816dce513Schristosmips@var{n}}.  @var{n} should be a number from 0 to 5, or 32, 32r2, 32r3,
79916dce513Schristos32r5, 32r6, 64, 64r2, 64r3, 64r5 or 64r6.
80016dce513SchristosThe values other than 0 make the assembler accept instructions
80116dce513Schristosfor the corresponding ISA level, from that point on in the
80216dce513Schristosassembly.  @code{.set mips@var{n}} affects not only which instructions
80316dce513Schristosare permitted, but also how certain macros are expanded.  @code{.set
80416dce513Schristosmips0} restores the ISA level to its original level: either the
805012573ebSchristoslevel you selected with command-line options, or the default for your
80616dce513Schristosconfiguration.  You can use this feature to permit specific MIPS III
80716dce513Schristosinstructions while assembling in 32 bit mode.  Use this directive with
80816dce513Schristoscare!
80916dce513Schristos
81016dce513Schristos@cindex MIPS CPU override
81116dce513Schristos@kindex @code{.set arch=@var{cpu}}
81216dce513SchristosThe @code{.set arch=@var{cpu}} directive provides even finer control.
81316dce513SchristosIt changes the effective CPU target and allows the assembler to use
81416dce513Schristosinstructions specific to a particular CPU.  All CPUs supported by the
815012573ebSchristos@samp{-march} command-line option are also selectable by this directive.
81616dce513SchristosThe original value is restored by @code{.set arch=default}.
81716dce513Schristos
81816dce513SchristosThe directive @code{.set mips16} puts the assembler into MIPS 16 mode,
81916dce513Schristosin which it will assemble instructions for the MIPS 16 processor.  Use
82016dce513Schristos@code{.set nomips16} to return to normal 32 bit mode.
82116dce513Schristos
82216dce513SchristosTraditional MIPS assemblers do not support this directive.
82316dce513Schristos
82416dce513SchristosThe directive @code{.set micromips} puts the assembler into microMIPS mode,
82516dce513Schristosin which it will assemble instructions for the microMIPS processor.  Use
82616dce513Schristos@code{.set nomicromips} to return to normal 32 bit mode.
82716dce513Schristos
82816dce513SchristosTraditional MIPS assemblers do not support this directive.
82916dce513Schristos
83016dce513Schristos@node MIPS assembly options
83116dce513Schristos@section Directives to control code generation
83216dce513Schristos
833012573ebSchristos@cindex MIPS directives to override command-line options
83416dce513Schristos@kindex @code{.module}
835012573ebSchristosThe @code{.module} directive allows command-line options to be set directly
83616dce513Schristosfrom assembly.  The format of the directive matches the @code{.set}
83716dce513Schristosdirective but only those options which are relevant to a whole module are
83816dce513Schristossupported.  The effect of a @code{.module} directive is the same as the
839012573ebSchristoscorresponding command-line option.  Where @code{.set} directives support
84016dce513Schristosreturning to a default then the @code{.module} directives do not as they
84116dce513Schristosdefine the defaults.
84216dce513Schristos
84316dce513SchristosThese module-level directives must appear first in assembly.
84416dce513Schristos
84516dce513SchristosTraditional MIPS assemblers do not support this directive.
84616dce513Schristos
84716dce513Schristos@cindex MIPS 32-bit microMIPS instruction generation override
84816dce513Schristos@kindex @code{.set insn32}
84916dce513Schristos@kindex @code{.set noinsn32}
85016dce513SchristosThe directive @code{.set insn32} makes the assembler only use 32-bit
85116dce513Schristosinstruction encodings when generating code for the microMIPS processor.
85216dce513SchristosThis directive inhibits the use of any 16-bit instructions from that
85316dce513Schristospoint on in the assembly.  The @code{.set noinsn32} directive allows
85416dce513Schristos16-bit instructions to be accepted.
85516dce513Schristos
85616dce513SchristosTraditional MIPS assemblers do not support this directive.
85716dce513Schristos
85816dce513Schristos@node MIPS autoextend
85916dce513Schristos@section Directives for extending MIPS 16 bit instructions
86016dce513Schristos
86116dce513Schristos@kindex @code{.set autoextend}
86216dce513Schristos@kindex @code{.set noautoextend}
86316dce513SchristosBy default, MIPS 16 instructions are automatically extended to 32 bits
86416dce513Schristoswhen necessary.  The directive @code{.set noautoextend} will turn this
86516dce513Schristosoff.  When @code{.set noautoextend} is in effect, any 32 bit instruction
86616dce513Schristosmust be explicitly extended with the @code{.e} modifier (e.g.,
86716dce513Schristos@code{li.e $4,1000}).  The directive @code{.set autoextend} may be used
86816dce513Schristosto once again automatically extend instructions when necessary.
86916dce513Schristos
87016dce513SchristosThis directive is only meaningful when in MIPS 16 mode.  Traditional
87116dce513SchristosMIPS assemblers do not support this directive.
87216dce513Schristos
87316dce513Schristos@node MIPS insn
87416dce513Schristos@section Directive to mark data as an instruction
87516dce513Schristos
87616dce513Schristos@kindex @code{.insn}
87716dce513SchristosThe @code{.insn} directive tells @code{@value{AS}} that the following
87816dce513Schristosdata is actually instructions.  This makes a difference in MIPS 16 and
87916dce513SchristosmicroMIPS modes: when loading the address of a label which precedes
88016dce513Schristosinstructions, @code{@value{AS}} automatically adds 1 to the value, so
88116dce513Schristosthat jumping to the loaded address will do the right thing.
88216dce513Schristos
88316dce513Schristos@kindex @code{.global}
88416dce513SchristosThe @code{.global} and @code{.globl} directives supported by
88516dce513Schristos@code{@value{AS}} will by default mark the symbol as pointing to a
88616dce513Schristosregion of data not code.  This means that, for example, any
88716dce513Schristosinstructions following such a symbol will not be disassembled by
88816dce513Schristos@code{objdump} as it will regard them as data.  To change this
88916dce513Schristosbehavior an optional section name can be placed after the symbol name
89016dce513Schristosin the @code{.global} directive.  If this section exists and is known
89116dce513Schristosto be a code section, then the symbol will be marked as pointing at
89216dce513Schristoscode not data.  Ie the syntax for the directive is:
89316dce513Schristos
89416dce513Schristos  @code{.global @var{symbol}[ @var{section}][, @var{symbol}[ @var{section}]] ...},
89516dce513Schristos
89616dce513SchristosHere is a short example:
89716dce513Schristos
89816dce513Schristos@example
89916dce513Schristos        .global foo .text, bar, baz .data
90016dce513Schristosfoo:
90116dce513Schristos        nop
90216dce513Schristosbar:
90316dce513Schristos        .word 0x0
90416dce513Schristosbaz:
90516dce513Schristos        .word 0x1
90616dce513Schristos
90716dce513Schristos@end example
90816dce513Schristos
90916dce513Schristos@node MIPS FP ABIs
91016dce513Schristos@section Directives to control the FP ABI
91116dce513Schristos@menu
91216dce513Schristos* MIPS FP ABI History::                History of FP ABIs
91316dce513Schristos* MIPS FP ABI Variants::               Supported FP ABIs
91416dce513Schristos* MIPS FP ABI Selection::              Automatic selection of FP ABI
91516dce513Schristos* MIPS FP ABI Compatibility::          Linking different FP ABI variants
91616dce513Schristos@end menu
91716dce513Schristos
91816dce513Schristos@node MIPS FP ABI History
91916dce513Schristos@subsection History of FP ABIs
92016dce513Schristos@cindex @code{.gnu_attribute 4, @var{n}} directive, MIPS
92116dce513Schristos@cindex @code{.gnu_attribute Tag_GNU_MIPS_ABI_FP, @var{n}} directive, MIPS
92216dce513SchristosThe MIPS ABIs support a variety of different floating-point extensions
92316dce513Schristoswhere calling-convention and register sizes vary for floating-point data.
92416dce513SchristosThe extensions exist to support a wide variety of optional architecture
92516dce513Schristosfeatures.  The resulting ABI variants are generally incompatible with each
92616dce513Schristosother and must be tracked carefully.
92716dce513Schristos
92816dce513SchristosTraditionally the use of an explicit @code{.gnu_attribute 4, @var{n}}
92916dce513Schristosdirective is used to indicate which ABI is in use by a specific module.
930012573ebSchristosIt was then left to the user to ensure that command-line options and the
93116dce513Schristosselected ABI were compatible with some potential for inconsistencies.
93216dce513Schristos
93316dce513Schristos@node MIPS FP ABI Variants
93416dce513Schristos@subsection Supported FP ABIs
93516dce513SchristosThe supported floating-point ABI variants are:
93616dce513Schristos
93716dce513Schristos@table @code
93816dce513Schristos@item 0 - No floating-point
93916dce513SchristosThis variant is used to indicate that floating-point is not used within
94016dce513Schristosthe module at all and therefore has no impact on the ABI.  This is the
94116dce513Schristosdefault.
94216dce513Schristos
94316dce513Schristos@item 1 - Double-precision
94416dce513SchristosThis variant indicates that double-precision support is used.  For 64-bit
94516dce513SchristosABIs this means that 64-bit wide floating-point registers are required.
94616dce513SchristosFor 32-bit ABIs this means that 32-bit wide floating-point registers are
94716dce513Schristosrequired and double-precision operations use pairs of registers.
94816dce513Schristos
94916dce513Schristos@item 2 - Single-precision
95016dce513SchristosThis variant indicates that single-precision support is used.  Double
95116dce513Schristosprecision operations will be supported via soft-float routines.
95216dce513Schristos
95316dce513Schristos@item 3 - Soft-float
95416dce513SchristosThis variant indicates that although floating-point support is used all
95516dce513Schristosoperations are emulated in software.  This means the ABI is modified to
95616dce513Schristospass all floating-point data in general-purpose registers.
95716dce513Schristos
95816dce513Schristos@item 4 - Deprecated
95916dce513SchristosThis variant existed as an initial attempt at supporting 64-bit wide
96016dce513Schristosfloating-point registers for O32 ABI on a MIPS32r2 CPU.  This has been
96116dce513Schristossuperseded by 5, 6 and 7.
96216dce513Schristos
96316dce513Schristos@item 5 - Double-precision 32-bit CPU, 32-bit or 64-bit FPU
96416dce513SchristosThis variant is used by 32-bit ABIs to indicate that the floating-point
96516dce513Schristoscode in the module has been designed to operate correctly with either
96616dce513Schristos32-bit wide or 64-bit wide floating-point registers.  Double-precision
96716dce513Schristossupport is used.  Only O32 currently supports this variant and requires
96816dce513Schristosa minimum architecture of MIPS II.
96916dce513Schristos
97016dce513Schristos@item 6 - Double-precision 32-bit FPU, 64-bit FPU
97116dce513SchristosThis variant is used by 32-bit ABIs to indicate that the floating-point
97216dce513Schristoscode in the module requires 64-bit wide floating-point registers.
97316dce513SchristosDouble-precision support is used.  Only O32 currently supports this
97416dce513Schristosvariant and requires a minimum architecture of MIPS32r2.
97516dce513Schristos
97616dce513Schristos@item 7 - Double-precision compat 32-bit FPU, 64-bit FPU
97716dce513SchristosThis variant is used by 32-bit ABIs to indicate that the floating-point
97816dce513Schristoscode in the module requires 64-bit wide floating-point registers.
97916dce513SchristosDouble-precision support is used.  This differs from the previous ABI
98016dce513Schristosas it restricts use of odd-numbered single-precision registers.  Only
98116dce513SchristosO32 currently supports this variant and requires a minimum architecture
98216dce513Schristosof MIPS32r2.
98316dce513Schristos@end table
98416dce513Schristos
98516dce513Schristos@node MIPS FP ABI Selection
98616dce513Schristos@subsection Automatic selection of FP ABI
98716dce513Schristos@cindex @code{.module fp=@var{nn}} directive, MIPS
98816dce513SchristosIn order to simplify and add safety to the process of selecting the
98916dce513Schristoscorrect floating-point ABI, the assembler will automatically infer the
990012573ebSchristoscorrect @code{.gnu_attribute 4, @var{n}} directive based on command-line
99116dce513Schristosoptions and @code{.module} overrides.  Where an explicit
99216dce513Schristos@code{.gnu_attribute 4, @var{n}} directive has been seen then a warning
99316dce513Schristoswill be raised if it does not match an inferred setting.
99416dce513Schristos
99516dce513SchristosThe floating-point ABI is inferred as follows.  If @samp{-msoft-float}
99616dce513Schristoshas been used the module will be marked as soft-float.  If
99716dce513Schristos@samp{-msingle-float} has been used then the module will be marked as
99816dce513Schristossingle-precision.  The remaining ABIs are then selected based
99916dce513Schristoson the FP register width.  Double-precision is selected if the width
100016dce513Schristosof GP and FP registers match and the special double-precision variants
100116dce513Schristosfor 32-bit ABIs are then selected depending on @samp{-mfpxx},
100216dce513Schristos@samp{-mfp64} and @samp{-mno-odd-spreg}.
100316dce513Schristos
100416dce513Schristos@node MIPS FP ABI Compatibility
100516dce513Schristos@subsection Linking different FP ABI variants
100616dce513SchristosModules using the default FP ABI (no floating-point) can be linked with
100716dce513Schristosany other (singular) FP ABI variant.
100816dce513Schristos
100916dce513SchristosSpecial compatibility support exists for O32 with the four
101016dce513Schristosdouble-precision FP ABI variants.  The @samp{-mfpxx} FP ABI is specifically
101116dce513Schristosdesigned to be compatible with the standard double-precision ABI and the
101216dce513Schristos@samp{-mfp64} FP ABIs.  This makes it desirable for O32 modules to be
101316dce513Schristosbuilt as @samp{-mfpxx} to ensure the maximum compatibility with other
101416dce513Schristosmodules produced for more specific needs.  The only FP ABIs which cannot
101516dce513Schristosbe linked together are the standard double-precision ABI and the full
101616dce513Schristos@samp{-mfp64} ABI with @samp{-modd-spreg}.
101716dce513Schristos
101816dce513Schristos@node MIPS NaN Encodings
101916dce513Schristos@section Directives to record which NaN encoding is being used
102016dce513Schristos
102116dce513Schristos@cindex MIPS IEEE 754 NaN data encoding selection
102216dce513Schristos@cindex @code{.nan} directive, MIPS
102316dce513SchristosThe IEEE 754 floating-point standard defines two types of not-a-number
102416dce513Schristos(NaN) data: ``signalling'' NaNs and ``quiet'' NaNs.  The original version
102516dce513Schristosof the standard did not specify how these two types should be
102616dce513Schristosdistinguished.  Most implementations followed the i387 model, in which
102716dce513Schristosthe first bit of the significand is set for quiet NaNs and clear for
102816dce513Schristossignalling NaNs.  However, the original MIPS implementation assigned the
102916dce513Schristosopposite meaning to the bit, so that it was set for signalling NaNs and
103016dce513Schristosclear for quiet NaNs.
103116dce513Schristos
103216dce513SchristosThe 2008 revision of the standard formally suggested the i387 choice
103316dce513Schristosand as from Sep 2012 the current release of the MIPS architecture
103416dce513Schristostherefore optionally supports that form.  Code that uses one NaN encoding
103516dce513Schristoswould usually be incompatible with code that uses the other NaN encoding,
103616dce513Schristosso MIPS ELF objects have a flag (@code{EF_MIPS_NAN2008}) to record which
103716dce513Schristosencoding is being used.
103816dce513Schristos
103916dce513SchristosAssembly files can use the @code{.nan} directive to select between the
104016dce513Schristostwo encodings.  @samp{.nan 2008} says that the assembly file uses the
104116dce513SchristosIEEE 754-2008 encoding while @samp{.nan legacy} says that the file uses
104216dce513Schristosthe original MIPS encoding.  If several @code{.nan} directives are given,
104316dce513Schristosthe final setting is the one that is used.
104416dce513Schristos
104516dce513SchristosThe command-line options @option{-mnan=legacy} and @option{-mnan=2008}
104616dce513Schristoscan be used instead of @samp{.nan legacy} and @samp{.nan 2008}
104716dce513Schristosrespectively.  However, any @code{.nan} directive overrides the
104816dce513Schristoscommand-line setting.
104916dce513Schristos
105016dce513Schristos@samp{.nan legacy} is the default if no @code{.nan} directive or
105116dce513Schristos@option{-mnan} option is given.
105216dce513Schristos
105316dce513SchristosNote that @sc{gnu} @code{@value{AS}} does not produce NaNs itself and
105416dce513Schristostherefore these directives do not affect code generation.  They simply
105516dce513Schristoscontrol the setting of the @code{EF_MIPS_NAN2008} flag.
105616dce513Schristos
105716dce513SchristosTraditional MIPS assemblers do not support these directives.
105816dce513Schristos
105916dce513Schristos@node MIPS Option Stack
106016dce513Schristos@section Directives to save and restore options
106116dce513Schristos
106216dce513Schristos@cindex MIPS option stack
106316dce513Schristos@kindex @code{.set push}
106416dce513Schristos@kindex @code{.set pop}
106516dce513SchristosThe directives @code{.set push} and @code{.set pop} may be used to save
106616dce513Schristosand restore the current settings for all the options which are
106716dce513Schristoscontrolled by @code{.set}.  The @code{.set push} directive saves the
106816dce513Schristoscurrent settings on a stack.  The @code{.set pop} directive pops the
106916dce513Schristosstack and restores the settings.
107016dce513Schristos
107116dce513SchristosThese directives can be useful inside an macro which must change an
107216dce513Schristosoption such as the ISA level or instruction reordering but does not want
107316dce513Schristosto change the state of the code which invoked the macro.
107416dce513Schristos
107516dce513SchristosTraditional MIPS assemblers do not support these directives.
107616dce513Schristos
107716dce513Schristos@node MIPS ASE Instruction Generation Overrides
107816dce513Schristos@section Directives to control generation of MIPS ASE instructions
107916dce513Schristos
108016dce513Schristos@cindex MIPS MIPS-3D instruction generation override
108116dce513Schristos@kindex @code{.set mips3d}
108216dce513Schristos@kindex @code{.set nomips3d}
108316dce513SchristosThe directive @code{.set mips3d} makes the assembler accept instructions
108416dce513Schristosfrom the MIPS-3D Application Specific Extension from that point on
108516dce513Schristosin the assembly.  The @code{.set nomips3d} directive prevents MIPS-3D
108616dce513Schristosinstructions from being accepted.
108716dce513Schristos
108816dce513Schristos@cindex SmartMIPS instruction generation override
108916dce513Schristos@kindex @code{.set smartmips}
109016dce513Schristos@kindex @code{.set nosmartmips}
109116dce513SchristosThe directive @code{.set smartmips} makes the assembler accept
109216dce513Schristosinstructions from the SmartMIPS Application Specific Extension to the
109316dce513SchristosMIPS32 ISA from that point on in the assembly.  The
109416dce513Schristos@code{.set nosmartmips} directive prevents SmartMIPS instructions from
109516dce513Schristosbeing accepted.
109616dce513Schristos
109716dce513Schristos@cindex MIPS MDMX instruction generation override
109816dce513Schristos@kindex @code{.set mdmx}
109916dce513Schristos@kindex @code{.set nomdmx}
110016dce513SchristosThe directive @code{.set mdmx} makes the assembler accept instructions
110116dce513Schristosfrom the MDMX Application Specific Extension from that point on
110216dce513Schristosin the assembly.  The @code{.set nomdmx} directive prevents MDMX
110316dce513Schristosinstructions from being accepted.
110416dce513Schristos
110516dce513Schristos@cindex MIPS DSP Release 1 instruction generation override
110616dce513Schristos@kindex @code{.set dsp}
110716dce513Schristos@kindex @code{.set nodsp}
110816dce513SchristosThe directive @code{.set dsp} makes the assembler accept instructions
110916dce513Schristosfrom the DSP Release 1 Application Specific Extension from that point
111016dce513Schristoson in the assembly.  The @code{.set nodsp} directive prevents DSP
111116dce513SchristosRelease 1 instructions from being accepted.
111216dce513Schristos
111316dce513Schristos@cindex MIPS DSP Release 2 instruction generation override
111416dce513Schristos@kindex @code{.set dspr2}
111516dce513Schristos@kindex @code{.set nodspr2}
111616dce513SchristosThe directive @code{.set dspr2} makes the assembler accept instructions
111716dce513Schristosfrom the DSP Release 2 Application Specific Extension from that point
111816dce513Schristoson in the assembly.  This directive implies @code{.set dsp}.  The
111916dce513Schristos@code{.set nodspr2} directive prevents DSP Release 2 instructions from
112016dce513Schristosbeing accepted.
112116dce513Schristos
112216dce513Schristos@cindex MIPS DSP Release 3 instruction generation override
112316dce513Schristos@kindex @code{.set dspr3}
112416dce513Schristos@kindex @code{.set nodspr3}
112516dce513SchristosThe directive @code{.set dspr3} makes the assembler accept instructions
112616dce513Schristosfrom the DSP Release 3 Application Specific Extension from that point
112716dce513Schristoson in the assembly.  This directive implies @code{.set dsp} and
112816dce513Schristos@code{.set dspr2}.  The @code{.set nodspr3} directive prevents DSP
112916dce513SchristosRelease 3 instructions from being accepted.
113016dce513Schristos
113116dce513Schristos@cindex MIPS MT instruction generation override
113216dce513Schristos@kindex @code{.set mt}
113316dce513Schristos@kindex @code{.set nomt}
113416dce513SchristosThe directive @code{.set mt} makes the assembler accept instructions
113516dce513Schristosfrom the MT Application Specific Extension from that point on
113616dce513Schristosin the assembly.  The @code{.set nomt} directive prevents MT
113716dce513Schristosinstructions from being accepted.
113816dce513Schristos
113916dce513Schristos@cindex MIPS MCU instruction generation override
114016dce513Schristos@kindex @code{.set mcu}
114116dce513Schristos@kindex @code{.set nomcu}
114216dce513SchristosThe directive @code{.set mcu} makes the assembler accept instructions
114316dce513Schristosfrom the MCU Application Specific Extension from that point on
114416dce513Schristosin the assembly.  The @code{.set nomcu} directive prevents MCU
114516dce513Schristosinstructions from being accepted.
114616dce513Schristos
114716dce513Schristos@cindex MIPS SIMD Architecture instruction generation override
114816dce513Schristos@kindex @code{.set msa}
114916dce513Schristos@kindex @code{.set nomsa}
115016dce513SchristosThe directive @code{.set msa} makes the assembler accept instructions
115116dce513Schristosfrom the MIPS SIMD Architecture Extension from that point on
115216dce513Schristosin the assembly.  The @code{.set nomsa} directive prevents MSA
115316dce513Schristosinstructions from being accepted.
115416dce513Schristos
115516dce513Schristos@cindex Virtualization instruction generation override
115616dce513Schristos@kindex @code{.set virt}
115716dce513Schristos@kindex @code{.set novirt}
115816dce513SchristosThe directive @code{.set virt} makes the assembler accept instructions
115916dce513Schristosfrom the Virtualization Application Specific Extension from that point
116016dce513Schristoson in the assembly.  The @code{.set novirt} directive prevents Virtualization
116116dce513Schristosinstructions from being accepted.
116216dce513Schristos
116316dce513Schristos@cindex MIPS eXtended Physical Address (XPA) instruction generation override
116416dce513Schristos@kindex @code{.set xpa}
116516dce513Schristos@kindex @code{.set noxpa}
116616dce513SchristosThe directive @code{.set xpa} makes the assembler accept instructions
116716dce513Schristosfrom the XPA Extension from that point on in the assembly.  The
116816dce513Schristos@code{.set noxpa} directive prevents XPA instructions from being accepted.
116916dce513Schristos
1170ede78133Schristos@cindex MIPS16e2 instruction generation override
1171ede78133Schristos@kindex @code{.set mips16e2}
1172ede78133Schristos@kindex @code{.set nomips16e2}
1173ede78133SchristosThe directive @code{.set mips16e2} makes the assembler accept instructions
1174ede78133Schristosfrom the MIPS16e2 Application Specific Extension from that point on in the
1175ede78133Schristosassembly, whenever in MIPS16 mode.  The @code{.set nomips16e2} directive
1176ede78133Schristosprevents MIPS16e2 instructions from being accepted, in MIPS16 mode.  Neither
1177ede78133Schristosdirective affects the state of MIPS16 mode being active itself which has
1178ede78133Schristosseparate controls.
1179ede78133Schristos
1180ede78133Schristos@cindex MIPS cyclic redundancy check (CRC) instruction generation override
1181ede78133Schristos@kindex @code{.set crc}
1182ede78133Schristos@kindex @code{.set nocrc}
1183ede78133SchristosThe directive @code{.set crc} makes the assembler accept instructions
1184ede78133Schristosfrom the CRC Extension from that point on in the assembly.  The
1185ede78133Schristos@code{.set nocrc} directive prevents CRC instructions from being accepted.
1186ede78133Schristos
1187ede78133Schristos@cindex MIPS Global INValidate (GINV) instruction generation override
1188ede78133Schristos@kindex @code{.set ginv}
1189ede78133Schristos@kindex @code{.set noginv}
1190ede78133SchristosThe directive @code{.set ginv} makes the assembler accept instructions
1191ede78133Schristosfrom the GINV Extension from that point on in the assembly.  The
1192ede78133Schristos@code{.set noginv} directive prevents GINV instructions from being accepted.
1193ede78133Schristos
1194012573ebSchristos@cindex Loongson MultiMedia extensions Instructions (MMI) generation override
1195012573ebSchristos@kindex @code{.set loongson-mmi}
1196012573ebSchristos@kindex @code{.set noloongson-mmi}
1197012573ebSchristosThe directive @code{.set loongson-mmi} makes the assembler accept
1198012573ebSchristosinstructions from the MMI Extension from that point on in the assembly.
1199012573ebSchristosThe @code{.set noloongson-mmi} directive prevents MMI instructions from
1200012573ebSchristosbeing accepted.
1201012573ebSchristos
1202012573ebSchristos@cindex Loongson Content Address Memory (CAM) generation override
1203012573ebSchristos@kindex @code{.set loongson-cam}
1204012573ebSchristos@kindex @code{.set noloongson-cam}
1205012573ebSchristosThe directive @code{.set loongson-cam} makes the assembler accept
1206012573ebSchristosinstructions from the Loongson CAM from that point on in the assembly.
1207012573ebSchristosThe @code{.set noloongson-cam} directive prevents Loongson CAM instructions
1208012573ebSchristosfrom being accepted.
1209012573ebSchristos
1210012573ebSchristos@cindex Loongson EXTensions (EXT) instructions generation override
1211012573ebSchristos@kindex @code{.set loongson-ext}
1212012573ebSchristos@kindex @code{.set noloongson-ext}
1213012573ebSchristosThe directive @code{.set loongson-ext} makes the assembler accept
1214012573ebSchristosinstructions from the Loongson EXT from that point on in the assembly.
1215012573ebSchristosThe @code{.set noloongson-ext} directive prevents Loongson EXT instructions
1216012573ebSchristosfrom being accepted.
1217012573ebSchristos
1218012573ebSchristos@cindex Loongson EXTensions R2 (EXT2) instructions generation override
1219012573ebSchristos@kindex @code{.set loongson-ext2}
1220012573ebSchristos@kindex @code{.set noloongson-ext2}
1221012573ebSchristosThe directive @code{.set loongson-ext2} makes the assembler accept
1222012573ebSchristosinstructions from the Loongson EXT2 from that point on in the assembly.
1223012573ebSchristosThis directive implies @code{.set loognson-ext}.
1224012573ebSchristosThe @code{.set noloongson-ext2} directive prevents Loongson EXT2 instructions
1225012573ebSchristosfrom being accepted.
1226012573ebSchristos
122716dce513SchristosTraditional MIPS assemblers do not support these directives.
122816dce513Schristos
122916dce513Schristos@node MIPS Floating-Point
123016dce513Schristos@section Directives to override floating-point options
123116dce513Schristos
123216dce513Schristos@cindex Disable floating-point instructions
123316dce513Schristos@kindex @code{.set softfloat}
123416dce513Schristos@kindex @code{.set hardfloat}
123516dce513SchristosThe directives @code{.set softfloat} and @code{.set hardfloat} provide
123616dce513Schristosfiner control of disabling and enabling float-point instructions.
123716dce513SchristosThese directives always override the default (that hard-float
123816dce513Schristosinstructions are accepted) or the command-line options
123916dce513Schristos(@samp{-msoft-float} and @samp{-mhard-float}).
124016dce513Schristos
124116dce513Schristos@cindex Disable single-precision floating-point operations
124216dce513Schristos@kindex @code{.set singlefloat}
124316dce513Schristos@kindex @code{.set doublefloat}
124416dce513SchristosThe directives @code{.set singlefloat} and @code{.set doublefloat}
124516dce513Schristosprovide finer control of disabling and enabling double-precision
124616dce513Schristosfloat-point operations.  These directives always override the default
124716dce513Schristos(that double-precision operations are accepted) or the command-line
124816dce513Schristosoptions (@samp{-msingle-float} and @samp{-mdouble-float}).
124916dce513Schristos
125016dce513SchristosTraditional MIPS assemblers do not support these directives.
125116dce513Schristos
125216dce513Schristos@node MIPS Syntax
125316dce513Schristos@section Syntactical considerations for the MIPS assembler
125416dce513Schristos@menu
125516dce513Schristos* MIPS-Chars::                Special Characters
125616dce513Schristos@end menu
125716dce513Schristos
125816dce513Schristos@node MIPS-Chars
125916dce513Schristos@subsection Special Characters
126016dce513Schristos
126116dce513Schristos@cindex line comment character, MIPS
126216dce513Schristos@cindex MIPS line comment character
126316dce513SchristosThe presence of a @samp{#} on a line indicates the start of a comment
126416dce513Schristosthat extends to the end of the current line.
126516dce513Schristos
126616dce513SchristosIf a @samp{#} appears as the first character of a line, the whole line
126716dce513Schristosis treated as a comment, but in this case the line can also be a
126816dce513Schristoslogical line number directive (@pxref{Comments}) or a
126916dce513Schristospreprocessor control command (@pxref{Preprocessing}).
127016dce513Schristos
127116dce513Schristos@cindex line separator, MIPS
127216dce513Schristos@cindex statement separator, MIPS
127316dce513Schristos@cindex MIPS line separator
127416dce513SchristosThe @samp{;} character can be used to separate statements on the same
127516dce513Schristosline.
1276