c-mips.texi 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  1. @c Copyright (C) 1991-2022 Free Software Foundation, Inc.
  2. @c This is part of the GAS manual.
  3. @c For copying conditions, see the file as.texinfo.
  4. @ifset GENERIC
  5. @page
  6. @node MIPS-Dependent
  7. @chapter MIPS Dependent Features
  8. @end ifset
  9. @ifclear GENERIC
  10. @node Machine Dependencies
  11. @chapter MIPS Dependent Features
  12. @end ifclear
  13. @cindex MIPS processor
  14. @sc{gnu} @code{@value{AS}} for MIPS architectures supports several
  15. different MIPS processors, and MIPS ISA levels I through V, MIPS32,
  16. and MIPS64. For information about the MIPS instruction set, see
  17. @cite{MIPS RISC Architecture}, by Kane and Heindrich (Prentice-Hall).
  18. For an overview of MIPS assembly conventions, see ``Appendix D:
  19. Assembly Language Programming'' in the same work.
  20. @menu
  21. * MIPS Options:: Assembler options
  22. * MIPS Macros:: High-level assembly macros
  23. * MIPS Symbol Sizes:: Directives to override the size of symbols
  24. * MIPS Small Data:: Controlling the use of small data accesses
  25. * MIPS ISA:: Directives to override the ISA level
  26. * MIPS assembly options:: Directives to control code generation
  27. * MIPS autoextend:: Directives for extending MIPS 16 bit instructions
  28. * MIPS insn:: Directive to mark data as an instruction
  29. * MIPS FP ABIs:: Marking which FP ABI is in use
  30. * MIPS NaN Encodings:: Directives to record which NaN encoding is being used
  31. * MIPS Option Stack:: Directives to save and restore options
  32. * MIPS ASE Instruction Generation Overrides:: Directives to control
  33. generation of MIPS ASE instructions
  34. * MIPS Floating-Point:: Directives to override floating-point options
  35. * MIPS Syntax:: MIPS specific syntactical considerations
  36. @end menu
  37. @node MIPS Options
  38. @section Assembler options
  39. The MIPS configurations of @sc{gnu} @code{@value{AS}} support these
  40. special options:
  41. @table @code
  42. @cindex @code{-G} option (MIPS)
  43. @item -G @var{num}
  44. Set the ``small data'' limit to @var{n} bytes. The default limit is 8 bytes.
  45. @xref{MIPS Small Data,, Controlling the use of small data accesses}.
  46. @cindex @code{-EB} option (MIPS)
  47. @cindex @code{-EL} option (MIPS)
  48. @cindex MIPS big-endian output
  49. @cindex MIPS little-endian output
  50. @cindex big-endian output, MIPS
  51. @cindex little-endian output, MIPS
  52. @item -EB
  53. @itemx -EL
  54. Any MIPS configuration of @code{@value{AS}} can select big-endian or
  55. little-endian output at run time (unlike the other @sc{gnu} development
  56. tools, which must be configured for one or the other). Use @samp{-EB}
  57. to select big-endian output, and @samp{-EL} for little-endian.
  58. @item -KPIC
  59. @cindex PIC selection, MIPS
  60. @cindex @option{-KPIC} option, MIPS
  61. Generate SVR4-style PIC. This option tells the assembler to generate
  62. SVR4-style position-independent macro expansions. It also tells the
  63. assembler to mark the output file as PIC.
  64. @item -mvxworks-pic
  65. @cindex @option{-mvxworks-pic} option, MIPS
  66. Generate VxWorks PIC. This option tells the assembler to generate
  67. VxWorks-style position-independent macro expansions.
  68. @cindex MIPS architecture options
  69. @item -mips1
  70. @itemx -mips2
  71. @itemx -mips3
  72. @itemx -mips4
  73. @itemx -mips5
  74. @itemx -mips32
  75. @itemx -mips32r2
  76. @itemx -mips32r3
  77. @itemx -mips32r5
  78. @itemx -mips32r6
  79. @itemx -mips64
  80. @itemx -mips64r2
  81. @itemx -mips64r3
  82. @itemx -mips64r5
  83. @itemx -mips64r6
  84. Generate code for a particular MIPS Instruction Set Architecture level.
  85. @samp{-mips1} corresponds to the R2000 and R3000 processors,
  86. @samp{-mips2} to the R6000 processor, @samp{-mips3} to the
  87. R4000 processor, and @samp{-mips4} to the R8000 and R10000 processors.
  88. @samp{-mips5}, @samp{-mips32}, @samp{-mips32r2}, @samp{-mips32r3},
  89. @samp{-mips32r5}, @samp{-mips32r6}, @samp{-mips64}, @samp{-mips64r2},
  90. @samp{-mips64r3}, @samp{-mips64r5}, and @samp{-mips64r6} correspond to
  91. generic MIPS V, MIPS32, MIPS32 Release 2, MIPS32 Release 3, MIPS32
  92. Release 5, MIPS32 Release 6, MIPS64, and MIPS64 Release 2, MIPS64
  93. Release 3, MIPS64 Release 5, and MIPS64 Release 6 ISA processors,
  94. respectively. You can also switch instruction sets during the assembly;
  95. see @ref{MIPS ISA, Directives to override the ISA level}.
  96. @item -mgp32
  97. @itemx -mfp32
  98. Some macros have different expansions for 32-bit and 64-bit registers.
  99. The register sizes are normally inferred from the ISA and ABI, but these
  100. flags force a certain group of registers to be treated as 32 bits wide at
  101. all times. @samp{-mgp32} controls the size of general-purpose registers
  102. and @samp{-mfp32} controls the size of floating-point registers.
  103. The @code{.set gp=32} and @code{.set fp=32} directives allow the size
  104. of registers to be changed for parts of an object. The default value is
  105. restored by @code{.set gp=default} and @code{.set fp=default}.
  106. On some MIPS variants there is a 32-bit mode flag; when this flag is
  107. set, 64-bit instructions generate a trap. Also, some 32-bit OSes only
  108. save the 32-bit registers on a context switch, so it is essential never
  109. to use the 64-bit registers.
  110. @item -mgp64
  111. @itemx -mfp64
  112. Assume that 64-bit registers are available. This is provided in the
  113. interests of symmetry with @samp{-mgp32} and @samp{-mfp32}.
  114. The @code{.set gp=64} and @code{.set fp=64} directives allow the size
  115. of registers to be changed for parts of an object. The default value is
  116. restored by @code{.set gp=default} and @code{.set fp=default}.
  117. @item -mfpxx
  118. Make no assumptions about whether 32-bit or 64-bit floating-point
  119. registers are available. This is provided to support having modules
  120. compatible with either @samp{-mfp32} or @samp{-mfp64}. This option can
  121. only be used with MIPS II and above.
  122. The @code{.set fp=xx} directive allows a part of an object to be marked
  123. as not making assumptions about 32-bit or 64-bit FP registers. The
  124. default value is restored by @code{.set fp=default}.
  125. @item -modd-spreg
  126. @itemx -mno-odd-spreg
  127. Enable use of floating-point operations on odd-numbered single-precision
  128. registers when supported by the ISA. @samp{-mfpxx} implies
  129. @samp{-mno-odd-spreg}, otherwise the default is @samp{-modd-spreg}
  130. @item -mips16
  131. @itemx -no-mips16
  132. Generate code for the MIPS 16 processor. This is equivalent to putting
  133. @code{.module mips16} at the start of the assembly file. @samp{-no-mips16}
  134. turns off this option.
  135. @item -mmips16e2
  136. @itemx -mno-mips16e2
  137. Enable the use of MIPS16e2 instructions in MIPS16 mode. This is equivalent
  138. to putting @code{.module mips16e2} at the start of the assembly file.
  139. @samp{-mno-mips16e2} turns off this option.
  140. @item -mmicromips
  141. @itemx -mno-micromips
  142. Generate code for the microMIPS processor. This is equivalent to putting
  143. @code{.module micromips} at the start of the assembly file.
  144. @samp{-mno-micromips} turns off this option. This is equivalent to putting
  145. @code{.module nomicromips} at the start of the assembly file.
  146. @item -msmartmips
  147. @itemx -mno-smartmips
  148. Enables the SmartMIPS extensions to the MIPS32 instruction set, which
  149. provides a number of new instructions which target smartcard and
  150. cryptographic applications. This is equivalent to putting
  151. @code{.module smartmips} at the start of the assembly file.
  152. @samp{-mno-smartmips} turns off this option.
  153. @item -mips3d
  154. @itemx -no-mips3d
  155. Generate code for the MIPS-3D Application Specific Extension.
  156. This tells the assembler to accept MIPS-3D instructions.
  157. @samp{-no-mips3d} turns off this option.
  158. @item -mdmx
  159. @itemx -no-mdmx
  160. Generate code for the MDMX Application Specific Extension.
  161. This tells the assembler to accept MDMX instructions.
  162. @samp{-no-mdmx} turns off this option.
  163. @item -mdsp
  164. @itemx -mno-dsp
  165. Generate code for the DSP Release 1 Application Specific Extension.
  166. This tells the assembler to accept DSP Release 1 instructions.
  167. @samp{-mno-dsp} turns off this option.
  168. @item -mdspr2
  169. @itemx -mno-dspr2
  170. Generate code for the DSP Release 2 Application Specific Extension.
  171. This option implies @samp{-mdsp}.
  172. This tells the assembler to accept DSP Release 2 instructions.
  173. @samp{-mno-dspr2} turns off this option.
  174. @item -mdspr3
  175. @itemx -mno-dspr3
  176. Generate code for the DSP Release 3 Application Specific Extension.
  177. This option implies @samp{-mdsp} and @samp{-mdspr2}.
  178. This tells the assembler to accept DSP Release 3 instructions.
  179. @samp{-mno-dspr3} turns off this option.
  180. @item -mmt
  181. @itemx -mno-mt
  182. Generate code for the MT Application Specific Extension.
  183. This tells the assembler to accept MT instructions.
  184. @samp{-mno-mt} turns off this option.
  185. @item -mmcu
  186. @itemx -mno-mcu
  187. Generate code for the MCU Application Specific Extension.
  188. This tells the assembler to accept MCU instructions.
  189. @samp{-mno-mcu} turns off this option.
  190. @item -mmsa
  191. @itemx -mno-msa
  192. Generate code for the MIPS SIMD Architecture Extension.
  193. This tells the assembler to accept MSA instructions.
  194. @samp{-mno-msa} turns off this option.
  195. @item -mxpa
  196. @itemx -mno-xpa
  197. Generate code for the MIPS eXtended Physical Address (XPA) Extension.
  198. This tells the assembler to accept XPA instructions.
  199. @samp{-mno-xpa} turns off this option.
  200. @item -mvirt
  201. @itemx -mno-virt
  202. Generate code for the Virtualization Application Specific Extension.
  203. This tells the assembler to accept Virtualization instructions.
  204. @samp{-mno-virt} turns off this option.
  205. @item -mcrc
  206. @itemx -mno-crc
  207. Generate code for the cyclic redundancy check (CRC) Application Specific
  208. Extension. This tells the assembler to accept CRC instructions.
  209. @samp{-mno-crc} turns off this option.
  210. @item -mginv
  211. @itemx -mno-ginv
  212. Generate code for the Global INValidate (GINV) Application Specific
  213. Extension. This tells the assembler to accept GINV instructions.
  214. @samp{-mno-ginv} turns off this option.
  215. @item -mloongson-mmi
  216. @itemx -mno-loongson-mmi
  217. Generate code for the Loongson MultiMedia extensions Instructions (MMI)
  218. Application Specific Extension. This tells the assembler to accept MMI
  219. instructions.
  220. @samp{-mno-loongson-mmi} turns off this option.
  221. @item -mloongson-cam
  222. @itemx -mno-loongson-cam
  223. Generate code for the Loongson Content Address Memory (CAM)
  224. Application Specific Extension. This tells the assembler to accept CAM
  225. instructions.
  226. @samp{-mno-loongson-cam} turns off this option.
  227. @item -mloongson-ext
  228. @itemx -mno-loongson-ext
  229. Generate code for the Loongson EXTensions (EXT) instructions
  230. Application Specific Extension. This tells the assembler to accept EXT
  231. instructions.
  232. @samp{-mno-loongson-ext} turns off this option.
  233. @item -mloongson-ext2
  234. @itemx -mno-loongson-ext2
  235. Generate code for the Loongson EXTensions R2 (EXT2) instructions
  236. Application Specific Extension. This tells the assembler to accept EXT2
  237. instructions.
  238. @samp{-mno-loongson-ext2} turns off this option.
  239. @item -minsn32
  240. @itemx -mno-insn32
  241. Only use 32-bit instruction encodings when generating code for the
  242. microMIPS processor. This option inhibits the use of any 16-bit
  243. instructions. This is equivalent to putting @code{.set insn32} at
  244. the start of the assembly file. @samp{-mno-insn32} turns off this
  245. option. This is equivalent to putting @code{.set noinsn32} at the
  246. start of the assembly file. By default @samp{-mno-insn32} is
  247. selected, allowing all instructions to be used.
  248. @item -mfix7000
  249. @itemx -mno-fix7000
  250. Cause nops to be inserted if the read of the destination register
  251. of an mfhi or mflo instruction occurs in the following two instructions.
  252. @item -mfix-rm7000
  253. @itemx -mno-fix-rm7000
  254. Cause nops to be inserted if a dmult or dmultu instruction is
  255. followed by a load instruction.
  256. @item -mfix-loongson2f-jump
  257. @itemx -mno-fix-loongson2f-jump
  258. Eliminate instruction fetch from outside 256M region to work around the
  259. Loongson2F @samp{jump} instructions. Without it, under extreme cases,
  260. the kernel may crash. The issue has been solved in latest processor
  261. batches, but this fix has no side effect to them.
  262. @item -mfix-loongson2f-nop
  263. @itemx -mno-fix-loongson2f-nop
  264. Replace nops by @code{or at,at,zero} to work around the Loongson2F
  265. @samp{nop} errata. Without it, under extreme cases, the CPU might
  266. deadlock. The issue has been solved in later Loongson2F batches, but
  267. this fix has no side effect to them.
  268. @item -mfix-loongson3-llsc
  269. @itemx -mno-fix-loongson3-llsc
  270. Insert @samp{sync} before @samp{ll} and @samp{lld} to work around
  271. Loongson3 LLSC errata. Without it, under extrame cases, the CPU might
  272. deadlock. The default can be controlled by the
  273. @option{--enable-mips-fix-loongson3-llsc=[yes|no]} configure option.
  274. @item -mfix-vr4120
  275. @itemx -mno-fix-vr4120
  276. Insert nops to work around certain VR4120 errata. This option is
  277. intended to be used on GCC-generated code: it is not designed to catch
  278. all problems in hand-written assembler code.
  279. @item -mfix-vr4130
  280. @itemx -mno-fix-vr4130
  281. Insert nops to work around the VR4130 @samp{mflo}/@samp{mfhi} errata.
  282. @item -mfix-24k
  283. @itemx -mno-fix-24k
  284. Insert nops to work around the 24K @samp{eret}/@samp{deret} errata.
  285. @item -mfix-cn63xxp1
  286. @itemx -mno-fix-cn63xxp1
  287. Replace @code{pref} hints 0 - 4 and 6 - 24 with hint 28 to work around
  288. certain CN63XXP1 errata.
  289. @item -mfix-r5900
  290. @itemx -mno-fix-r5900
  291. Do not attempt to schedule the preceding instruction into the delay slot
  292. of a branch instruction placed at the end of a short loop of six
  293. instructions or fewer and always schedule a @code{nop} instruction there
  294. instead. The short loop bug under certain conditions causes loops to
  295. execute only once or twice, due to a hardware bug in the R5900 chip.
  296. @item -m4010
  297. @itemx -no-m4010
  298. Generate code for the LSI R4010 chip. This tells the assembler to
  299. accept the R4010-specific instructions (@samp{addciu}, @samp{ffc},
  300. etc.), and to not schedule @samp{nop} instructions around accesses to
  301. the @samp{HI} and @samp{LO} registers. @samp{-no-m4010} turns off this
  302. option.
  303. @item -m4650
  304. @itemx -no-m4650
  305. Generate code for the MIPS R4650 chip. This tells the assembler to accept
  306. the @samp{mad} and @samp{madu} instruction, and to not schedule @samp{nop}
  307. instructions around accesses to the @samp{HI} and @samp{LO} registers.
  308. @samp{-no-m4650} turns off this option.
  309. @item -m3900
  310. @itemx -no-m3900
  311. @itemx -m4100
  312. @itemx -no-m4100
  313. For each option @samp{-m@var{nnnn}}, generate code for the MIPS
  314. R@var{nnnn} chip. This tells the assembler to accept instructions
  315. specific to that chip, and to schedule for that chip's hazards.
  316. @item -march=@var{cpu}
  317. Generate code for a particular MIPS CPU. It is exactly equivalent to
  318. @samp{-m@var{cpu}}, except that there are more value of @var{cpu}
  319. understood. Valid @var{cpu} value are:
  320. @quotation
  321. 2000,
  322. 3000,
  323. 3900,
  324. 4000,
  325. 4010,
  326. 4100,
  327. 4111,
  328. vr4120,
  329. vr4130,
  330. vr4181,
  331. 4300,
  332. 4400,
  333. 4600,
  334. 4650,
  335. 5000,
  336. rm5200,
  337. rm5230,
  338. rm5231,
  339. rm5261,
  340. rm5721,
  341. vr5400,
  342. vr5500,
  343. 6000,
  344. rm7000,
  345. 8000,
  346. rm9000,
  347. 10000,
  348. 12000,
  349. 14000,
  350. 16000,
  351. 4kc,
  352. 4km,
  353. 4kp,
  354. 4ksc,
  355. 4kec,
  356. 4kem,
  357. 4kep,
  358. 4ksd,
  359. m4k,
  360. m4kp,
  361. m14k,
  362. m14kc,
  363. m14ke,
  364. m14kec,
  365. 24kc,
  366. 24kf2_1,
  367. 24kf,
  368. 24kf1_1,
  369. 24kec,
  370. 24kef2_1,
  371. 24kef,
  372. 24kef1_1,
  373. 34kc,
  374. 34kf2_1,
  375. 34kf,
  376. 34kf1_1,
  377. 34kn,
  378. 74kc,
  379. 74kf2_1,
  380. 74kf,
  381. 74kf1_1,
  382. 74kf3_2,
  383. 1004kc,
  384. 1004kf2_1,
  385. 1004kf,
  386. 1004kf1_1,
  387. interaptiv,
  388. interaptiv-mr2,
  389. m5100,
  390. m5101,
  391. p5600,
  392. 5kc,
  393. 5kf,
  394. 20kc,
  395. 25kf,
  396. sb1,
  397. sb1a,
  398. i6400,
  399. i6500,
  400. p6600,
  401. loongson2e,
  402. loongson2f,
  403. gs464,
  404. gs464e,
  405. gs264e,
  406. octeon,
  407. octeon+,
  408. octeon2,
  409. octeon3,
  410. xlr,
  411. xlp
  412. @end quotation
  413. For compatibility reasons, @samp{@var{n}x} and @samp{@var{b}fx} are
  414. accepted as synonyms for @samp{@var{n}f1_1}. These values are
  415. deprecated.
  416. @item -mtune=@var{cpu}
  417. Schedule and tune for a particular MIPS CPU. Valid @var{cpu} values are
  418. identical to @samp{-march=@var{cpu}}.
  419. @item -mabi=@var{abi}
  420. Record which ABI the source code uses. The recognized arguments
  421. are: @samp{32}, @samp{n32}, @samp{o64}, @samp{64} and @samp{eabi}.
  422. @item -msym32
  423. @itemx -mno-sym32
  424. @cindex -msym32
  425. @cindex -mno-sym32
  426. Equivalent to adding @code{.set sym32} or @code{.set nosym32} to
  427. the beginning of the assembler input. @xref{MIPS Symbol Sizes}.
  428. @cindex @code{-nocpp} ignored (MIPS)
  429. @item -nocpp
  430. This option is ignored. It is accepted for command-line compatibility with
  431. other assemblers, which use it to turn off C style preprocessing. With
  432. @sc{gnu} @code{@value{AS}}, there is no need for @samp{-nocpp}, because the
  433. @sc{gnu} assembler itself never runs the C preprocessor.
  434. @item -msoft-float
  435. @itemx -mhard-float
  436. Disable or enable floating-point instructions. Note that by default
  437. floating-point instructions are always allowed even with CPU targets
  438. that don't have support for these instructions.
  439. @item -msingle-float
  440. @itemx -mdouble-float
  441. Disable or enable double-precision floating-point operations. Note
  442. that by default double-precision floating-point operations are always
  443. allowed even with CPU targets that don't have support for these
  444. operations.
  445. @item --construct-floats
  446. @itemx --no-construct-floats
  447. The @code{--no-construct-floats} option disables the construction of
  448. double width floating point constants by loading the two halves of the
  449. value into the two single width floating point registers that make up
  450. the double width register. This feature is useful if the processor
  451. support the FR bit in its status register, and this bit is known (by
  452. the programmer) to be set. This bit prevents the aliasing of the double
  453. width register by the single width registers.
  454. By default @code{--construct-floats} is selected, allowing construction
  455. of these floating point constants.
  456. @item --relax-branch
  457. @itemx --no-relax-branch
  458. The @samp{--relax-branch} option enables the relaxation of out-of-range
  459. branches. Any branches whose target cannot be reached directly are
  460. converted to a small instruction sequence including an inverse-condition
  461. branch to the physically next instruction, and a jump to the original
  462. target is inserted between the two instructions. In PIC code the jump
  463. will involve further instructions for address calculation.
  464. The @code{BC1ANY2F}, @code{BC1ANY2T}, @code{BC1ANY4F}, @code{BC1ANY4T},
  465. @code{BPOSGE32} and @code{BPOSGE64} instructions are excluded from
  466. relaxation, because they have no complementing counterparts. They could
  467. be relaxed with the use of a longer sequence involving another branch,
  468. however this has not been implemented and if their target turns out of
  469. reach, they produce an error even if branch relaxation is enabled.
  470. Also no MIPS16 branches are ever relaxed.
  471. By default @samp{--no-relax-branch} is selected, causing any out-of-range
  472. branches to produce an error.
  473. @item -mignore-branch-isa
  474. @itemx -mno-ignore-branch-isa
  475. Ignore branch checks for invalid transitions between ISA modes.
  476. The semantics of branches does not provide for an ISA mode switch, so in
  477. most cases the ISA mode a branch has been encoded for has to be the same
  478. as the ISA mode of the branch's target label. If the ISA modes do not
  479. match, then such a branch, if taken, will cause the ISA mode to remain
  480. unchanged and instructions that follow will be executed in the wrong ISA
  481. mode causing the program to misbehave or crash.
  482. In the case of the @code{BAL} instruction it may be possible to relax
  483. it to an equivalent @code{JALX} instruction so that the ISA mode is
  484. switched at the run time as required. For other branches no relaxation
  485. is possible and therefore GAS has checks implemented that verify in
  486. branch assembly that the two ISA modes match, and report an error
  487. otherwise so that the problem with code can be diagnosed at the assembly
  488. time rather than at the run time.
  489. However some assembly code, including generated code produced by some
  490. versions of GCC, may incorrectly include branches to data labels, which
  491. appear to require a mode switch but are either dead or immediately
  492. followed by valid instructions encoded for the same ISA the branch has
  493. been encoded for. While not strictly correct at the source level such
  494. code will execute as intended, so to help with these cases
  495. @samp{-mignore-branch-isa} is supported which disables ISA mode checks
  496. for branches.
  497. By default @samp{-mno-ignore-branch-isa} is selected, causing any invalid
  498. branch requiring a transition between ISA modes to produce an error.
  499. @cindex @option{-mnan=} command-line option, MIPS
  500. @item -mnan=@var{encoding}
  501. This option indicates whether the source code uses the IEEE 2008
  502. NaN encoding (@option{-mnan=2008}) or the original MIPS encoding
  503. (@option{-mnan=legacy}). It is equivalent to adding a @code{.nan}
  504. directive to the beginning of the source file. @xref{MIPS NaN Encodings}.
  505. @option{-mnan=legacy} is the default if no @option{-mnan} option or
  506. @code{.nan} directive is used.
  507. @item --trap
  508. @itemx --no-break
  509. @c FIXME! (1) reflect these options (next item too) in option summaries;
  510. @c (2) stop teasing, say _which_ instructions expanded _how_.
  511. @code{@value{AS}} automatically macro expands certain division and
  512. multiplication instructions to check for overflow and division by zero. This
  513. option causes @code{@value{AS}} to generate code to take a trap exception
  514. rather than a break exception when an error is detected. The trap instructions
  515. are only supported at Instruction Set Architecture level 2 and higher.
  516. @item --break
  517. @itemx --no-trap
  518. Generate code to take a break exception rather than a trap exception when an
  519. error is detected. This is the default.
  520. @item -mpdr
  521. @itemx -mno-pdr
  522. Control generation of @code{.pdr} sections. Off by default on IRIX, on
  523. elsewhere.
  524. @item -mshared
  525. @itemx -mno-shared
  526. When generating code using the Unix calling conventions (selected by
  527. @samp{-KPIC} or @samp{-mcall_shared}), gas will normally generate code
  528. which can go into a shared library. The @samp{-mno-shared} option
  529. tells gas to generate code which uses the calling convention, but can
  530. not go into a shared library. The resulting code is slightly more
  531. efficient. This option only affects the handling of the
  532. @samp{.cpload} and @samp{.cpsetup} pseudo-ops.
  533. @end table
  534. @node MIPS Macros
  535. @section High-level assembly macros
  536. MIPS assemblers have traditionally provided a wider range of
  537. instructions than the MIPS architecture itself. These extra
  538. instructions are usually referred to as ``macro'' instructions
  539. @footnote{The term ``macro'' is somewhat overloaded here, since
  540. these macros have no relation to those defined by @code{.macro},
  541. @pxref{Macro,, @code{.macro}}.}.
  542. Some MIPS macro instructions extend an underlying architectural instruction
  543. while others are entirely new. An example of the former type is @code{and},
  544. which allows the third operand to be either a register or an arbitrary
  545. immediate value. Examples of the latter type include @code{bgt}, which
  546. branches to the third operand when the first operand is greater than
  547. the second operand, and @code{ulh}, which implements an unaligned
  548. 2-byte load.
  549. One of the most common extensions provided by macros is to expand
  550. memory offsets to the full address range (32 or 64 bits) and to allow
  551. symbolic offsets such as @samp{my_data + 4} to be used in place of
  552. integer constants. For example, the architectural instruction
  553. @code{lbu} allows only a signed 16-bit offset, whereas the macro
  554. @code{lbu} allows code such as @samp{lbu $4,array+32769($5)}.
  555. The implementation of these symbolic offsets depends on several factors,
  556. such as whether the assembler is generating SVR4-style PIC (selected by
  557. @option{-KPIC}, @pxref{MIPS Options,, Assembler options}), the size of symbols
  558. (@pxref{MIPS Symbol Sizes,, Directives to override the size of symbols}),
  559. and the small data limit (@pxref{MIPS Small Data,, Controlling the use
  560. of small data accesses}).
  561. @kindex @code{.set macro}
  562. @kindex @code{.set nomacro}
  563. Sometimes it is undesirable to have one assembly instruction expand
  564. to several machine instructions. The directive @code{.set nomacro}
  565. tells the assembler to warn when this happens. @code{.set macro}
  566. restores the default behavior.
  567. @cindex @code{at} register, MIPS
  568. @kindex @code{.set at=@var{reg}}
  569. Some macro instructions need a temporary register to store intermediate
  570. results. This register is usually @code{$1}, also known as @code{$at},
  571. but it can be changed to any core register @var{reg} using
  572. @code{.set at=@var{reg}}. Note that @code{$at} always refers
  573. to @code{$1} regardless of which register is being used as the
  574. temporary register.
  575. @kindex @code{.set at}
  576. @kindex @code{.set noat}
  577. Implicit uses of the temporary register in macros could interfere with
  578. explicit uses in the assembly code. The assembler therefore warns
  579. whenever it sees an explicit use of the temporary register. The directive
  580. @code{.set noat} silences this warning while @code{.set at} restores
  581. the default behavior. It is safe to use @code{.set noat} while
  582. @code{.set nomacro} is in effect since single-instruction macros
  583. never need a temporary register.
  584. Note that while the @sc{gnu} assembler provides these macros for compatibility,
  585. it does not make any attempt to optimize them with the surrounding code.
  586. @node MIPS Symbol Sizes
  587. @section Directives to override the size of symbols
  588. @kindex @code{.set sym32}
  589. @kindex @code{.set nosym32}
  590. The n64 ABI allows symbols to have any 64-bit value. Although this
  591. provides a great deal of flexibility, it means that some macros have
  592. much longer expansions than their 32-bit counterparts. For example,
  593. the non-PIC expansion of @samp{dla $4,sym} is usually:
  594. @smallexample
  595. lui $4,%highest(sym)
  596. lui $1,%hi(sym)
  597. daddiu $4,$4,%higher(sym)
  598. daddiu $1,$1,%lo(sym)
  599. dsll32 $4,$4,0
  600. daddu $4,$4,$1
  601. @end smallexample
  602. whereas the 32-bit expansion is simply:
  603. @smallexample
  604. lui $4,%hi(sym)
  605. daddiu $4,$4,%lo(sym)
  606. @end smallexample
  607. n64 code is sometimes constructed in such a way that all symbolic
  608. constants are known to have 32-bit values, and in such cases, it's
  609. preferable to use the 32-bit expansion instead of the 64-bit
  610. expansion.
  611. You can use the @code{.set sym32} directive to tell the assembler
  612. that, from this point on, all expressions of the form
  613. @samp{@var{symbol}} or @samp{@var{symbol} + @var{offset}}
  614. have 32-bit values. For example:
  615. @smallexample
  616. .set sym32
  617. dla $4,sym
  618. lw $4,sym+16
  619. sw $4,sym+0x8000($4)
  620. @end smallexample
  621. will cause the assembler to treat @samp{sym}, @code{sym+16} and
  622. @code{sym+0x8000} as 32-bit values. The handling of non-symbolic
  623. addresses is not affected.
  624. The directive @code{.set nosym32} ends a @code{.set sym32} block and
  625. reverts to the normal behavior. It is also possible to change the
  626. symbol size using the command-line options @option{-msym32} and
  627. @option{-mno-sym32}.
  628. These options and directives are always accepted, but at present,
  629. they have no effect for anything other than n64.
  630. @node MIPS Small Data
  631. @section Controlling the use of small data accesses
  632. @c This section deliberately glosses over the possibility of using -G
  633. @c in SVR4-style PIC, as could be done on IRIX. We don't support that.
  634. @cindex small data, MIPS
  635. @cindex @code{gp} register, MIPS
  636. It often takes several instructions to load the address of a symbol.
  637. For example, when @samp{addr} is a 32-bit symbol, the non-PIC expansion
  638. of @samp{dla $4,addr} is usually:
  639. @smallexample
  640. lui $4,%hi(addr)
  641. daddiu $4,$4,%lo(addr)
  642. @end smallexample
  643. The sequence is much longer when @samp{addr} is a 64-bit symbol.
  644. @xref{MIPS Symbol Sizes,, Directives to override the size of symbols}.
  645. In order to cut down on this overhead, most embedded MIPS systems
  646. set aside a 64-kilobyte ``small data'' area and guarantee that all
  647. data of size @var{n} and smaller will be placed in that area.
  648. The limit @var{n} is passed to both the assembler and the linker
  649. using the command-line option @option{-G @var{n}}, @pxref{MIPS Options,,
  650. Assembler options}. Note that the same value of @var{n} must be used
  651. when linking and when assembling all input files to the link; any
  652. inconsistency could cause a relocation overflow error.
  653. The size of an object in the @code{.bss} section is set by the
  654. @code{.comm} or @code{.lcomm} directive that defines it. The size of
  655. an external object may be set with the @code{.extern} directive. For
  656. example, @samp{.extern sym,4} declares that the object at @code{sym}
  657. is 4 bytes in length, while leaving @code{sym} otherwise undefined.
  658. When no @option{-G} option is given, the default limit is 8 bytes.
  659. The option @option{-G 0} prevents any data from being automatically
  660. classified as small.
  661. It is also possible to mark specific objects as small by putting them
  662. in the special sections @code{.sdata} and @code{.sbss}, which are
  663. ``small'' counterparts of @code{.data} and @code{.bss} respectively.
  664. The toolchain will treat such data as small regardless of the
  665. @option{-G} setting.
  666. On startup, systems that support a small data area are expected to
  667. initialize register @code{$28}, also known as @code{$gp}, in such a
  668. way that small data can be accessed using a 16-bit offset from that
  669. register. For example, when @samp{addr} is small data,
  670. the @samp{dla $4,addr} instruction above is equivalent to:
  671. @smallexample
  672. daddiu $4,$28,%gp_rel(addr)
  673. @end smallexample
  674. Small data is not supported for SVR4-style PIC.
  675. @node MIPS ISA
  676. @section Directives to override the ISA level
  677. @cindex MIPS ISA override
  678. @kindex @code{.set mips@var{n}}
  679. @sc{gnu} @code{@value{AS}} supports an additional directive to change
  680. the MIPS Instruction Set Architecture level on the fly: @code{.set
  681. mips@var{n}}. @var{n} should be a number from 0 to 5, or 32, 32r2, 32r3,
  682. 32r5, 32r6, 64, 64r2, 64r3, 64r5 or 64r6.
  683. The values other than 0 make the assembler accept instructions
  684. for the corresponding ISA level, from that point on in the
  685. assembly. @code{.set mips@var{n}} affects not only which instructions
  686. are permitted, but also how certain macros are expanded. @code{.set
  687. mips0} restores the ISA level to its original level: either the
  688. level you selected with command-line options, or the default for your
  689. configuration. You can use this feature to permit specific MIPS III
  690. instructions while assembling in 32 bit mode. Use this directive with
  691. care!
  692. @cindex MIPS CPU override
  693. @kindex @code{.set arch=@var{cpu}}
  694. The @code{.set arch=@var{cpu}} directive provides even finer control.
  695. It changes the effective CPU target and allows the assembler to use
  696. instructions specific to a particular CPU. All CPUs supported by the
  697. @samp{-march} command-line option are also selectable by this directive.
  698. The original value is restored by @code{.set arch=default}.
  699. The directive @code{.set mips16} puts the assembler into MIPS 16 mode,
  700. in which it will assemble instructions for the MIPS 16 processor. Use
  701. @code{.set nomips16} to return to normal 32 bit mode.
  702. Traditional MIPS assemblers do not support this directive.
  703. The directive @code{.set micromips} puts the assembler into microMIPS mode,
  704. in which it will assemble instructions for the microMIPS processor. Use
  705. @code{.set nomicromips} to return to normal 32 bit mode.
  706. Traditional MIPS assemblers do not support this directive.
  707. @node MIPS assembly options
  708. @section Directives to control code generation
  709. @cindex MIPS directives to override command-line options
  710. @kindex @code{.module}
  711. The @code{.module} directive allows command-line options to be set directly
  712. from assembly. The format of the directive matches the @code{.set}
  713. directive but only those options which are relevant to a whole module are
  714. supported. The effect of a @code{.module} directive is the same as the
  715. corresponding command-line option. Where @code{.set} directives support
  716. returning to a default then the @code{.module} directives do not as they
  717. define the defaults.
  718. These module-level directives must appear first in assembly.
  719. Traditional MIPS assemblers do not support this directive.
  720. @cindex MIPS 32-bit microMIPS instruction generation override
  721. @kindex @code{.set insn32}
  722. @kindex @code{.set noinsn32}
  723. The directive @code{.set insn32} makes the assembler only use 32-bit
  724. instruction encodings when generating code for the microMIPS processor.
  725. This directive inhibits the use of any 16-bit instructions from that
  726. point on in the assembly. The @code{.set noinsn32} directive allows
  727. 16-bit instructions to be accepted.
  728. Traditional MIPS assemblers do not support this directive.
  729. @node MIPS autoextend
  730. @section Directives for extending MIPS 16 bit instructions
  731. @kindex @code{.set autoextend}
  732. @kindex @code{.set noautoextend}
  733. By default, MIPS 16 instructions are automatically extended to 32 bits
  734. when necessary. The directive @code{.set noautoextend} will turn this
  735. off. When @code{.set noautoextend} is in effect, any 32 bit instruction
  736. must be explicitly extended with the @code{.e} modifier (e.g.,
  737. @code{li.e $4,1000}). The directive @code{.set autoextend} may be used
  738. to once again automatically extend instructions when necessary.
  739. This directive is only meaningful when in MIPS 16 mode. Traditional
  740. MIPS assemblers do not support this directive.
  741. @node MIPS insn
  742. @section Directive to mark data as an instruction
  743. @kindex @code{.insn}
  744. The @code{.insn} directive tells @code{@value{AS}} that the following
  745. data is actually instructions. This makes a difference in MIPS 16 and
  746. microMIPS modes: when loading the address of a label which precedes
  747. instructions, @code{@value{AS}} automatically adds 1 to the value, so
  748. that jumping to the loaded address will do the right thing.
  749. @kindex @code{.global}
  750. The @code{.global} and @code{.globl} directives supported by
  751. @code{@value{AS}} will by default mark the symbol as pointing to a
  752. region of data not code. This means that, for example, any
  753. instructions following such a symbol will not be disassembled by
  754. @code{objdump} as it will regard them as data. To change this
  755. behavior an optional section name can be placed after the symbol name
  756. in the @code{.global} directive. If this section exists and is known
  757. to be a code section, then the symbol will be marked as pointing at
  758. code not data. Ie the syntax for the directive is:
  759. @code{.global @var{symbol}[ @var{section}][, @var{symbol}[ @var{section}]] ...},
  760. Here is a short example:
  761. @example
  762. .global foo .text, bar, baz .data
  763. foo:
  764. nop
  765. bar:
  766. .word 0x0
  767. baz:
  768. .word 0x1
  769. @end example
  770. @node MIPS FP ABIs
  771. @section Directives to control the FP ABI
  772. @menu
  773. * MIPS FP ABI History:: History of FP ABIs
  774. * MIPS FP ABI Variants:: Supported FP ABIs
  775. * MIPS FP ABI Selection:: Automatic selection of FP ABI
  776. * MIPS FP ABI Compatibility:: Linking different FP ABI variants
  777. @end menu
  778. @node MIPS FP ABI History
  779. @subsection History of FP ABIs
  780. @cindex @code{.gnu_attribute 4, @var{n}} directive, MIPS
  781. @cindex @code{.gnu_attribute Tag_GNU_MIPS_ABI_FP, @var{n}} directive, MIPS
  782. The MIPS ABIs support a variety of different floating-point extensions
  783. where calling-convention and register sizes vary for floating-point data.
  784. The extensions exist to support a wide variety of optional architecture
  785. features. The resulting ABI variants are generally incompatible with each
  786. other and must be tracked carefully.
  787. Traditionally the use of an explicit @code{.gnu_attribute 4, @var{n}}
  788. directive is used to indicate which ABI is in use by a specific module.
  789. It was then left to the user to ensure that command-line options and the
  790. selected ABI were compatible with some potential for inconsistencies.
  791. @node MIPS FP ABI Variants
  792. @subsection Supported FP ABIs
  793. The supported floating-point ABI variants are:
  794. @table @code
  795. @item 0 - No floating-point
  796. This variant is used to indicate that floating-point is not used within
  797. the module at all and therefore has no impact on the ABI. This is the
  798. default.
  799. @item 1 - Double-precision
  800. This variant indicates that double-precision support is used. For 64-bit
  801. ABIs this means that 64-bit wide floating-point registers are required.
  802. For 32-bit ABIs this means that 32-bit wide floating-point registers are
  803. required and double-precision operations use pairs of registers.
  804. @item 2 - Single-precision
  805. This variant indicates that single-precision support is used. Double
  806. precision operations will be supported via soft-float routines.
  807. @item 3 - Soft-float
  808. This variant indicates that although floating-point support is used all
  809. operations are emulated in software. This means the ABI is modified to
  810. pass all floating-point data in general-purpose registers.
  811. @item 4 - Deprecated
  812. This variant existed as an initial attempt at supporting 64-bit wide
  813. floating-point registers for O32 ABI on a MIPS32r2 CPU. This has been
  814. superseded by 5, 6 and 7.
  815. @item 5 - Double-precision 32-bit CPU, 32-bit or 64-bit FPU
  816. This variant is used by 32-bit ABIs to indicate that the floating-point
  817. code in the module has been designed to operate correctly with either
  818. 32-bit wide or 64-bit wide floating-point registers. Double-precision
  819. support is used. Only O32 currently supports this variant and requires
  820. a minimum architecture of MIPS II.
  821. @item 6 - Double-precision 32-bit FPU, 64-bit FPU
  822. This variant is used by 32-bit ABIs to indicate that the floating-point
  823. code in the module requires 64-bit wide floating-point registers.
  824. Double-precision support is used. Only O32 currently supports this
  825. variant and requires a minimum architecture of MIPS32r2.
  826. @item 7 - Double-precision compat 32-bit FPU, 64-bit FPU
  827. This variant is used by 32-bit ABIs to indicate that the floating-point
  828. code in the module requires 64-bit wide floating-point registers.
  829. Double-precision support is used. This differs from the previous ABI
  830. as it restricts use of odd-numbered single-precision registers. Only
  831. O32 currently supports this variant and requires a minimum architecture
  832. of MIPS32r2.
  833. @end table
  834. @node MIPS FP ABI Selection
  835. @subsection Automatic selection of FP ABI
  836. @cindex @code{.module fp=@var{nn}} directive, MIPS
  837. In order to simplify and add safety to the process of selecting the
  838. correct floating-point ABI, the assembler will automatically infer the
  839. correct @code{.gnu_attribute 4, @var{n}} directive based on command-line
  840. options and @code{.module} overrides. Where an explicit
  841. @code{.gnu_attribute 4, @var{n}} directive has been seen then a warning
  842. will be raised if it does not match an inferred setting.
  843. The floating-point ABI is inferred as follows. If @samp{-msoft-float}
  844. has been used the module will be marked as soft-float. If
  845. @samp{-msingle-float} has been used then the module will be marked as
  846. single-precision. The remaining ABIs are then selected based
  847. on the FP register width. Double-precision is selected if the width
  848. of GP and FP registers match and the special double-precision variants
  849. for 32-bit ABIs are then selected depending on @samp{-mfpxx},
  850. @samp{-mfp64} and @samp{-mno-odd-spreg}.
  851. @node MIPS FP ABI Compatibility
  852. @subsection Linking different FP ABI variants
  853. Modules using the default FP ABI (no floating-point) can be linked with
  854. any other (singular) FP ABI variant.
  855. Special compatibility support exists for O32 with the four
  856. double-precision FP ABI variants. The @samp{-mfpxx} FP ABI is specifically
  857. designed to be compatible with the standard double-precision ABI and the
  858. @samp{-mfp64} FP ABIs. This makes it desirable for O32 modules to be
  859. built as @samp{-mfpxx} to ensure the maximum compatibility with other
  860. modules produced for more specific needs. The only FP ABIs which cannot
  861. be linked together are the standard double-precision ABI and the full
  862. @samp{-mfp64} ABI with @samp{-modd-spreg}.
  863. @node MIPS NaN Encodings
  864. @section Directives to record which NaN encoding is being used
  865. @cindex MIPS IEEE 754 NaN data encoding selection
  866. @cindex @code{.nan} directive, MIPS
  867. The IEEE 754 floating-point standard defines two types of not-a-number
  868. (NaN) data: ``signalling'' NaNs and ``quiet'' NaNs. The original version
  869. of the standard did not specify how these two types should be
  870. distinguished. Most implementations followed the i387 model, in which
  871. the first bit of the significand is set for quiet NaNs and clear for
  872. signalling NaNs. However, the original MIPS implementation assigned the
  873. opposite meaning to the bit, so that it was set for signalling NaNs and
  874. clear for quiet NaNs.
  875. The 2008 revision of the standard formally suggested the i387 choice
  876. and as from Sep 2012 the current release of the MIPS architecture
  877. therefore optionally supports that form. Code that uses one NaN encoding
  878. would usually be incompatible with code that uses the other NaN encoding,
  879. so MIPS ELF objects have a flag (@code{EF_MIPS_NAN2008}) to record which
  880. encoding is being used.
  881. Assembly files can use the @code{.nan} directive to select between the
  882. two encodings. @samp{.nan 2008} says that the assembly file uses the
  883. IEEE 754-2008 encoding while @samp{.nan legacy} says that the file uses
  884. the original MIPS encoding. If several @code{.nan} directives are given,
  885. the final setting is the one that is used.
  886. The command-line options @option{-mnan=legacy} and @option{-mnan=2008}
  887. can be used instead of @samp{.nan legacy} and @samp{.nan 2008}
  888. respectively. However, any @code{.nan} directive overrides the
  889. command-line setting.
  890. @samp{.nan legacy} is the default if no @code{.nan} directive or
  891. @option{-mnan} option is given.
  892. Note that @sc{gnu} @code{@value{AS}} does not produce NaNs itself and
  893. therefore these directives do not affect code generation. They simply
  894. control the setting of the @code{EF_MIPS_NAN2008} flag.
  895. Traditional MIPS assemblers do not support these directives.
  896. @node MIPS Option Stack
  897. @section Directives to save and restore options
  898. @cindex MIPS option stack
  899. @kindex @code{.set push}
  900. @kindex @code{.set pop}
  901. The directives @code{.set push} and @code{.set pop} may be used to save
  902. and restore the current settings for all the options which are
  903. controlled by @code{.set}. The @code{.set push} directive saves the
  904. current settings on a stack. The @code{.set pop} directive pops the
  905. stack and restores the settings.
  906. These directives can be useful inside an macro which must change an
  907. option such as the ISA level or instruction reordering but does not want
  908. to change the state of the code which invoked the macro.
  909. Traditional MIPS assemblers do not support these directives.
  910. @node MIPS ASE Instruction Generation Overrides
  911. @section Directives to control generation of MIPS ASE instructions
  912. @cindex MIPS MIPS-3D instruction generation override
  913. @kindex @code{.set mips3d}
  914. @kindex @code{.set nomips3d}
  915. The directive @code{.set mips3d} makes the assembler accept instructions
  916. from the MIPS-3D Application Specific Extension from that point on
  917. in the assembly. The @code{.set nomips3d} directive prevents MIPS-3D
  918. instructions from being accepted.
  919. @cindex SmartMIPS instruction generation override
  920. @kindex @code{.set smartmips}
  921. @kindex @code{.set nosmartmips}
  922. The directive @code{.set smartmips} makes the assembler accept
  923. instructions from the SmartMIPS Application Specific Extension to the
  924. MIPS32 ISA from that point on in the assembly. The
  925. @code{.set nosmartmips} directive prevents SmartMIPS instructions from
  926. being accepted.
  927. @cindex MIPS MDMX instruction generation override
  928. @kindex @code{.set mdmx}
  929. @kindex @code{.set nomdmx}
  930. The directive @code{.set mdmx} makes the assembler accept instructions
  931. from the MDMX Application Specific Extension from that point on
  932. in the assembly. The @code{.set nomdmx} directive prevents MDMX
  933. instructions from being accepted.
  934. @cindex MIPS DSP Release 1 instruction generation override
  935. @kindex @code{.set dsp}
  936. @kindex @code{.set nodsp}
  937. The directive @code{.set dsp} makes the assembler accept instructions
  938. from the DSP Release 1 Application Specific Extension from that point
  939. on in the assembly. The @code{.set nodsp} directive prevents DSP
  940. Release 1 instructions from being accepted.
  941. @cindex MIPS DSP Release 2 instruction generation override
  942. @kindex @code{.set dspr2}
  943. @kindex @code{.set nodspr2}
  944. The directive @code{.set dspr2} makes the assembler accept instructions
  945. from the DSP Release 2 Application Specific Extension from that point
  946. on in the assembly. This directive implies @code{.set dsp}. The
  947. @code{.set nodspr2} directive prevents DSP Release 2 instructions from
  948. being accepted.
  949. @cindex MIPS DSP Release 3 instruction generation override
  950. @kindex @code{.set dspr3}
  951. @kindex @code{.set nodspr3}
  952. The directive @code{.set dspr3} makes the assembler accept instructions
  953. from the DSP Release 3 Application Specific Extension from that point
  954. on in the assembly. This directive implies @code{.set dsp} and
  955. @code{.set dspr2}. The @code{.set nodspr3} directive prevents DSP
  956. Release 3 instructions from being accepted.
  957. @cindex MIPS MT instruction generation override
  958. @kindex @code{.set mt}
  959. @kindex @code{.set nomt}
  960. The directive @code{.set mt} makes the assembler accept instructions
  961. from the MT Application Specific Extension from that point on
  962. in the assembly. The @code{.set nomt} directive prevents MT
  963. instructions from being accepted.
  964. @cindex MIPS MCU instruction generation override
  965. @kindex @code{.set mcu}
  966. @kindex @code{.set nomcu}
  967. The directive @code{.set mcu} makes the assembler accept instructions
  968. from the MCU Application Specific Extension from that point on
  969. in the assembly. The @code{.set nomcu} directive prevents MCU
  970. instructions from being accepted.
  971. @cindex MIPS SIMD Architecture instruction generation override
  972. @kindex @code{.set msa}
  973. @kindex @code{.set nomsa}
  974. The directive @code{.set msa} makes the assembler accept instructions
  975. from the MIPS SIMD Architecture Extension from that point on
  976. in the assembly. The @code{.set nomsa} directive prevents MSA
  977. instructions from being accepted.
  978. @cindex Virtualization instruction generation override
  979. @kindex @code{.set virt}
  980. @kindex @code{.set novirt}
  981. The directive @code{.set virt} makes the assembler accept instructions
  982. from the Virtualization Application Specific Extension from that point
  983. on in the assembly. The @code{.set novirt} directive prevents Virtualization
  984. instructions from being accepted.
  985. @cindex MIPS eXtended Physical Address (XPA) instruction generation override
  986. @kindex @code{.set xpa}
  987. @kindex @code{.set noxpa}
  988. The directive @code{.set xpa} makes the assembler accept instructions
  989. from the XPA Extension from that point on in the assembly. The
  990. @code{.set noxpa} directive prevents XPA instructions from being accepted.
  991. @cindex MIPS16e2 instruction generation override
  992. @kindex @code{.set mips16e2}
  993. @kindex @code{.set nomips16e2}
  994. The directive @code{.set mips16e2} makes the assembler accept instructions
  995. from the MIPS16e2 Application Specific Extension from that point on in the
  996. assembly, whenever in MIPS16 mode. The @code{.set nomips16e2} directive
  997. prevents MIPS16e2 instructions from being accepted, in MIPS16 mode. Neither
  998. directive affects the state of MIPS16 mode being active itself which has
  999. separate controls.
  1000. @cindex MIPS cyclic redundancy check (CRC) instruction generation override
  1001. @kindex @code{.set crc}
  1002. @kindex @code{.set nocrc}
  1003. The directive @code{.set crc} makes the assembler accept instructions
  1004. from the CRC Extension from that point on in the assembly. The
  1005. @code{.set nocrc} directive prevents CRC instructions from being accepted.
  1006. @cindex MIPS Global INValidate (GINV) instruction generation override
  1007. @kindex @code{.set ginv}
  1008. @kindex @code{.set noginv}
  1009. The directive @code{.set ginv} makes the assembler accept instructions
  1010. from the GINV Extension from that point on in the assembly. The
  1011. @code{.set noginv} directive prevents GINV instructions from being accepted.
  1012. @cindex Loongson MultiMedia extensions Instructions (MMI) generation override
  1013. @kindex @code{.set loongson-mmi}
  1014. @kindex @code{.set noloongson-mmi}
  1015. The directive @code{.set loongson-mmi} makes the assembler accept
  1016. instructions from the MMI Extension from that point on in the assembly.
  1017. The @code{.set noloongson-mmi} directive prevents MMI instructions from
  1018. being accepted.
  1019. @cindex Loongson Content Address Memory (CAM) generation override
  1020. @kindex @code{.set loongson-cam}
  1021. @kindex @code{.set noloongson-cam}
  1022. The directive @code{.set loongson-cam} makes the assembler accept
  1023. instructions from the Loongson CAM from that point on in the assembly.
  1024. The @code{.set noloongson-cam} directive prevents Loongson CAM instructions
  1025. from being accepted.
  1026. @cindex Loongson EXTensions (EXT) instructions generation override
  1027. @kindex @code{.set loongson-ext}
  1028. @kindex @code{.set noloongson-ext}
  1029. The directive @code{.set loongson-ext} makes the assembler accept
  1030. instructions from the Loongson EXT from that point on in the assembly.
  1031. The @code{.set noloongson-ext} directive prevents Loongson EXT instructions
  1032. from being accepted.
  1033. @cindex Loongson EXTensions R2 (EXT2) instructions generation override
  1034. @kindex @code{.set loongson-ext2}
  1035. @kindex @code{.set noloongson-ext2}
  1036. The directive @code{.set loongson-ext2} makes the assembler accept
  1037. instructions from the Loongson EXT2 from that point on in the assembly.
  1038. This directive implies @code{.set loognson-ext}.
  1039. The @code{.set noloongson-ext2} directive prevents Loongson EXT2 instructions
  1040. from being accepted.
  1041. Traditional MIPS assemblers do not support these directives.
  1042. @node MIPS Floating-Point
  1043. @section Directives to override floating-point options
  1044. @cindex Disable floating-point instructions
  1045. @kindex @code{.set softfloat}
  1046. @kindex @code{.set hardfloat}
  1047. The directives @code{.set softfloat} and @code{.set hardfloat} provide
  1048. finer control of disabling and enabling float-point instructions.
  1049. These directives always override the default (that hard-float
  1050. instructions are accepted) or the command-line options
  1051. (@samp{-msoft-float} and @samp{-mhard-float}).
  1052. @cindex Disable single-precision floating-point operations
  1053. @kindex @code{.set singlefloat}
  1054. @kindex @code{.set doublefloat}
  1055. The directives @code{.set singlefloat} and @code{.set doublefloat}
  1056. provide finer control of disabling and enabling double-precision
  1057. float-point operations. These directives always override the default
  1058. (that double-precision operations are accepted) or the command-line
  1059. options (@samp{-msingle-float} and @samp{-mdouble-float}).
  1060. Traditional MIPS assemblers do not support these directives.
  1061. @node MIPS Syntax
  1062. @section Syntactical considerations for the MIPS assembler
  1063. @menu
  1064. * MIPS-Chars:: Special Characters
  1065. @end menu
  1066. @node MIPS-Chars
  1067. @subsection Special Characters
  1068. @cindex line comment character, MIPS
  1069. @cindex MIPS line comment character
  1070. The presence of a @samp{#} on a line indicates the start of a comment
  1071. that extends to the end of the current line.
  1072. If a @samp{#} appears as the first character of a line, the whole line
  1073. is treated as a comment, but in this case the line can also be a
  1074. logical line number directive (@pxref{Comments}) or a
  1075. preprocessor control command (@pxref{Preprocessing}).
  1076. @cindex line separator, MIPS
  1077. @cindex statement separator, MIPS
  1078. @cindex MIPS line separator
  1079. The @samp{;} character can be used to separate statements on the same
  1080. line.