MIPS® Architecture For Programmers
Volume II-A: The MIPS32® Instruction
Set
Document Number: MD00086
Revision 5.03
Sept. 9, 2013
MIPS Technologies, Inc.
955 East Arques Avenue
Sunnyvale, CA 94085-4521
Copyright © 2001-2003,2005,2008-2013 MIPS Technologies Inc. All rights reserved.
MIPS
Verified™
Unpublished rights (if any) reserved under the copyright laws of the United States of America and other countries.
This document contains information that is proprietary to MIPS Technologies, Inc. ("MIPS Technologies") one of the Imagination Technologies Group plc
companies. Any copying, reproducing, modifying or use of this information (in whole or in part) that is not expressly permitted in writing by MIPS Technologies
or an authorized third party is strictly prohibited. At a minimum, this information is protected under unfair competition and copyright laws. Violations thereof
may result in criminal penalties and fines.
Any document provided in source format (i.e., in a modifiable form such as in FrameMaker or Microsoft Word format) is subject to use and distribution
restrictions that are independent of and supplemental to any and all confidentiality restrictions. UNDER NO CIRCUMSTANCES MAY A DOCUMENT
PROVIDED IN SOURCE FORMAT BE DISTRIBUTED TO A THIRD PARTY IN SOURCE FORMAT WITHOUT THE EXPRESS WRITTEN
PERMISSION OF MIPS TECHNOLOGIES, INC.
MIPS Technologies reserves the right to change the information contained in this document to improve function, design or otherwise. MIPS Technologies does
not assume any liability arising out of the application or use of this information, or of any error or omission in such information. Any warranties, whether
express, statutory, implied or otherwise, including but not limited to the implied warranties of merchantability or fitness for a particular purpose, are excluded.
Except as expressly provided in any written license agreement from MIPS Technologies or an authorized third party, the furnishing of this document does not
give recipient any license to any intellectual property rights, including any patent rights, that cover the information in this document.
The information contained in this document shall not be exported, re-exported, transferred, or released, directly or indirectly, in violation of the law of any
country or international law, regulation, treaty, Executive Order, statute, amendments or supplements thereto. Should a conflict arise regarding the export, re-
export, transfer, or release of the information contained in this document, the laws of the United States of America shall be the governing law.
The information contained in this document constitutes one or more of the following: commercial computer software, commercial computer software
documentation, or other commercial items. If the user of this information, or any related documentation of any kind, including related technical data or manuals,
is an agency, department, or other entity of the United States government ("Government"), the use, duplication, reproduction, release, modification, disclosure,
or transfer of this information, or any related documentation of any kind, is restricted in accordance with Federal Acquisition Regulation 12.212 for civilian
agencies and Defense Federal Acquisition Regulation Supplement 227.7202 for military agencies. The use of this information by the Government is further
restricted in accordance with the terms of the license agreement(s) and/or applicable contract terms and conditions covering this information from MIPS
Technologies or an authorized third party.
MIPS, MIPS I, MIPS II, MIPS III, MIPS IV, MIPS V, MIPSr3, MIPS32, MIPS64, microMIPS32, microMIPS64, MIPS-3D, MIPS16, MIPS16e, MIPS-Based,
MIPSsim, MIPSpro, MIPS-VERIFIED, Aptiv logo, microAptiv logo, interAptiv logo, microMIPS logo, MIPS Technologies logo, MIPS-VERIFIED logo,
proAptiv logo, 4K, 4Kc, 4Km, 4Kp, 4KE, 4KEc, 4KEm, 4KEp, 4KS, 4KSc, 4KSd, M4K, M14K, 5K, 5Kc, 5Kf, 24K, 24Kc, 24Kf, 24KE, 24KEc, 24KEf, 34K,
34Kc, 34Kf, 74K, 74Kc, 74Kf, 1004K, 1004Kc, 1004Kf, 1074K, 1074Kc, 1074Kf, R3000, R4000, R5000, Aptiv, ASMACRO, Atlas, "At the core of the user
experience.", BusBridge, Bus Navigator, CLAM, CorExtend, CoreFPGA, CoreLV, EC, FPGA View, FS2, FS2 FIRST SILICON SOLUTIONS logo, FS2
NAVIGATOR, HyperDebug, HyperJTAG, IASim, iFlowtrace, interAptiv, JALGO, Logic Navigator, Malta, MDMX, MED, MGB, microAptiv, microMIPS,
Navigator, OCI, PDtrace, the Pipeline, proAptiv, Pro Series, SEAD-3, SmartMIPS, SOC-it, and YAMON are trademarks or registered trademarks of MIPS
Technologies, Inc. in the United States and other countries.
All other trademarks referred to herein are the property of their respective owners.
Template: nB1.03, Built with tags: 2B ARCH FPU_PS FPU_PSandARCH MIPS32
MIPS® Architecture For Programmers Volume II-A: The MIPS32® Instruction Set, Revision 5.03
Copyright © 2001-2003,2005,2008-2013 MIPS Technologies Inc. All rights reserved.
3
MIPS® Architecture For Programmers Volume II-A: The MIPS32® Instruction Set, Revision 5.03
Copyright © 2001-2003,2005,2008-2013 MIPS Technologies Inc. All rights reserved.
Contents
Chapter 1: About This Book ................................................................................................................ 14
1.1: Typographical Conventions ....................................................................................................................... 14
1.1.1: Italic Text.......................................................................................................................................... 15
1.1.2: Bold Text .......................................................................................................................................... 15
1.1.3: Courier Text ..................................................................................................................................... 15
1.2: UNPREDICTABLE and UNDEFINED ....................................................................................................... 15
1.2.1: UNPREDICTABLE ........................................................................................................................... 15
1.2.2: UNDEFINED .................................................................................................................................... 16
1.2.3: UNSTABLE ...................................................................................................................................... 16
1.3: Special Symbols in Pseudocode Notation................................................................................................. 16
1.4: For More Information ................................................................................................................................. 19
Chapter 2: Guide to the Instruction Set.............................................................................................. 20
2.1: Understanding the Instruction Fields ......................................................................................................... 20
2.1.1: Instruction Fields .............................................................................................................................. 21
2.1.2: Instruction Descriptive Name and Mnemonic................................................................................... 22
2.1.3: Format Field ..................................................................................................................................... 22
2.1.4: Purpose Field ................................................................................................................................... 23
2.1.5: Description Field .............................................................................................................................. 23
2.1.6: Restrictions Field.............................................................................................................................. 23
2.1.7: Operation Field................................................................................................................................. 24
2.1.8: Exceptions Field............................................................................................................................... 24
2.1.9: Programming Notes and Implementation Notes Fields.................................................................... 25
2.2: Operation Section Notation and Functions................................................................................................ 25
2.2.1: Instruction Execution Ordering......................................................................................................... 25
2.2.2: Pseudocode Functions..................................................................................................................... 25
2.3: Op and Function Subfield Notation............................................................................................................ 34
2.4: FPU Instructions ........................................................................................................................................ 34
Chapter 3: The MIPS32® Instruction Set ............................................................................................ 36
3.1: Compliance and Subsetting....................................................................................................................... 36
3.2: Alphabetical List of Instructions ................................................................................................................. 37
ABS.fmt ............................................................................................................................................................ 46
ADD .................................................................................................................................................................. 47
ADD.fmt ............................................................................................................................................................ 48
ADDI ................................................................................................................................................................. 49
ADDIU .............................................................................................................................................................. 50
ADDU ............................................................................................................................................................... 51
ALNV.PS .......................................................................................................................................................... 52
AND .................................................................................................................................................................. 54
ANDI ................................................................................................................................................................. 55
B ....................................................................................................................................................................... 56
BAL................................................................................................................................................................... 57
BC1F ................................................................................................................................................................ 58
BC1FL .............................................................................................................................................................. 60
BC1T ................................................................................................................................................................ 62
BC1TL .............................................................................................................................................................. 64
MIPS® Architecture For Programmers Volume II-A: The MIPS32® Instruction Set, Revision 5.03
4
Copyright © 2001-2003,2005,2008-2013 MIPS Technologies Inc. All rights reserved.
BC2F ................................................................................................................................................................ 66
BC2FL .............................................................................................................................................................. 67
BC2T ................................................................................................................................................................ 68
BC2TL .............................................................................................................................................................. 69
BEQ .................................................................................................................................................................. 70
BEQL ................................................................................................................................................................ 71
BGEZ................................................................................................................................................................ 72
BGEZAL ........................................................................................................................................................... 73
BGEZALL ......................................................................................................................................................... 74
BGEZL.............................................................................................................................................................. 76
BGTZ ................................................................................................................................................................ 77
BGTZL .............................................................................................................................................................. 78
BLEZ................................................................................................................................................................. 79
BLEZL............................................................................................................................................................... 80
BLTZ................................................................................................................................................................. 81
BLTZAL ............................................................................................................................................................ 82
BLTZALL .......................................................................................................................................................... 83
BLTZL............................................................................................................................................................... 85
BNE .................................................................................................................................................................. 86
BNEL ................................................................................................................................................................ 87
BREAK ............................................................................................................................................................. 88
C.cond.fmt ........................................................................................................................................................ 89
CACHE ............................................................................................................................................................. 94
CACHEE......................................................................................................................................................... 100
CEIL.L.fmt....................................................................................................................................................... 107
CEIL.W.fmt ..................................................................................................................................................... 108
CFC1 .............................................................................................................................................................. 109
CFC2 .............................................................................................................................................................. 111
CLO ................................................................................................................................................................ 112
CLZ................................................................................................................................................................. 113
COP2.............................................................................................................................................................. 114
CTC1 .............................................................................................................................................................. 115
CTC2 .............................................................................................................................................................. 117
CVT.D.fmt....................................................................................................................................................... 118
CVT.L.fmt ....................................................................................................................................................... 119
CVT.PS.S ....................................................................................................................................................... 120
CVT.S.fmt ....................................................................................................................................................... 121
CVT.S.PL........................................................................................................................................................ 122
CVT.S.PU ....................................................................................................................................................... 123
CVT.W.fmt ...................................................................................................................................................... 124
DERET ........................................................................................................................................................... 125
DI .................................................................................................................................................................... 126
DIV.................................................................................................................................................................. 127
DIV.fmt............................................................................................................................................................ 129
DIVU ............................................................................................................................................................... 130
EHB ................................................................................................................................................................ 131
EI .................................................................................................................................................................... 132
ERET .............................................................................................................................................................. 133
EXT................................................................................................................................................................. 134
FLOOR.L.fmt .................................................................................................................................................. 136
FLOOR.W.fmt................................................................................................................................................. 137
INS.................................................................................................................................................................. 138
J...................................................................................................................................................................... 140
5
MIPS® Architecture For Programmers Volume II-A: The MIPS32® Instruction Set, Revision 5.03
Copyright © 2001-2003,2005,2008-2013 MIPS Technologies Inc. All rights reserved.
JAL ................................................................................................................................................................. 141
JALR............................................................................................................................................................... 142
JALR.HB......................................................................................................................................................... 144
JALX ............................................................................................................................................................... 148
JR ................................................................................................................................................................... 149
JR.HB ............................................................................................................................................................. 151
LB ................................................................................................................................................................... 153
LBE................................................................................................................................................................. 154
LBU................................................................................................................................................................. 155
LBUE .............................................................................................................................................................. 156
LDC1 .............................................................................................................................................................. 157
LDC2 .............................................................................................................................................................. 158
LDXC1 ............................................................................................................................................................ 159
LH ................................................................................................................................................................... 160
LHE................................................................................................................................................................. 162
LHU ................................................................................................................................................................ 163
LHUE .............................................................................................................................................................. 164
LL.................................................................................................................................................................... 165
LLE ................................................................................................................................................................. 166
LUI .................................................................................................................................................................. 168
LUXC1 ............................................................................................................................................................ 169
LW .................................................................................................................................................................. 170
LWC1.............................................................................................................................................................. 171
LWC2.............................................................................................................................................................. 172
LWE................................................................................................................................................................ 174
LWL ................................................................................................................................................................ 175
LWLE.............................................................................................................................................................. 178
LWR................................................................................................................................................................ 180
LWRE ............................................................................................................................................................. 182
LWXC1 ........................................................................................................................................................... 184
MADD ............................................................................................................................................................. 185
MADD.fmt ....................................................................................................................................................... 186
MADDU .......................................................................................................................................................... 187
MFC0.............................................................................................................................................................. 188
MFC1.............................................................................................................................................................. 189
MFC2.............................................................................................................................................................. 190
MFHC1 ........................................................................................................................................................... 191
MFHC2 ........................................................................................................................................................... 192
MFHI............................................................................................................................................................... 193
MFLO.............................................................................................................................................................. 194
MOV.fmt ......................................................................................................................................................... 195
MOVF ............................................................................................................................................................. 196
MOVF.fmt ....................................................................................................................................................... 197
MOVN............................................................................................................................................................. 198
MOVN.fmt....................................................................................................................................................... 199
MOVT ............................................................................................................................................................. 200
MOVT.fmt ....................................................................................................................................................... 201
MOVZ ............................................................................................................................................................. 202
MOVZ.fmt ....................................................................................................................................................... 203
MSUB ............................................................................................................................................................. 204
MSUB.fmt ....................................................................................................................................................... 205
MSUBU........................................................................................................................................................... 206
MTC0.............................................................................................................................................................. 207
MIPS® Architecture For Programmers Volume II-A: The MIPS32® Instruction Set, Revision 5.03
6
Copyright © 2001-2003,2005,2008-2013 MIPS Technologies Inc. All rights reserved.
MTC1.............................................................................................................................................................. 208
MTC2.............................................................................................................................................................. 209
MTHC1 ........................................................................................................................................................... 210
MTHC2 ........................................................................................................................................................... 211
MTHI............................................................................................................................................................... 212
MTLO.............................................................................................................................................................. 213
MUL ................................................................................................................................................................ 214
MUL.fmt .......................................................................................................................................................... 215
MULT.............................................................................................................................................................. 216
MULTU ........................................................................................................................................................... 217
NEG.fmt.......................................................................................................................................................... 218
NMADD.fmt .................................................................................................................................................... 219
NMSUB.fmt..................................................................................................................................................... 220
NOP................................................................................................................................................................ 222
NOR................................................................................................................................................................ 223
OR .................................................................................................................................................................. 224
ORI ................................................................................................................................................................. 225
PAUSE ........................................................................................................................................................... 226
PLL.PS ........................................................................................................................................................... 228
PLU.PS........................................................................................................................................................... 229
PREF .............................................................................................................................................................. 230
PREFE............................................................................................................................................................ 234
PREFX............................................................................................................................................................ 237
PUL.PS........................................................................................................................................................... 238
PUU.PS .......................................................................................................................................................... 239
RDHWR.......................................................................................................................................................... 240
RDPGPR ........................................................................................................................................................ 242
RECIP.fmt....................................................................................................................................................... 243
ROTR ............................................................................................................................................................. 244
ROTRV ........................................................................................................................................................... 245
ROUND.L.fmt ................................................................................................................................................. 246
ROUND.W.fmt ................................................................................................................................................ 247
RSQRT.fmt ..................................................................................................................................................... 248
SB................................................................................................................................................................... 249
SBE ................................................................................................................................................................ 250
SC................................................................................................................................................................... 251
SCE ................................................................................................................................................................ 254
SDBBP ........................................................................................................................................................... 257
SDC1 .............................................................................................................................................................. 258
SDC2 .............................................................................................................................................................. 259
SDXC1............................................................................................................................................................ 260
SEB ................................................................................................................................................................ 261
SEH ................................................................................................................................................................ 262
SH................................................................................................................................................................... 263
SHE ................................................................................................................................................................ 264
SLL ................................................................................................................................................................. 265
SLLV............................................................................................................................................................... 266
SLT ................................................................................................................................................................. 267
SLTI ................................................................................................................................................................ 268
SLTIU ............................................................................................................................................................. 269
SLTU .............................................................................................................................................................. 270
SQRT.fmt........................................................................................................................................................ 271
SRA ................................................................................................................................................................ 272
7
MIPS® Architecture For Programmers Volume II-A: The MIPS32® Instruction Set, Revision 5.03
Copyright © 2001-2003,2005,2008-2013 MIPS Technologies Inc. All rights reserved.
SRAV.............................................................................................................................................................. 273
SRL................................................................................................................................................................. 274
SRLV .............................................................................................................................................................. 275
SSNOP ........................................................................................................................................................... 276
SUB ................................................................................................................................................................ 277
SUB.fmt .......................................................................................................................................................... 278
SUBU.............................................................................................................................................................. 279
SUXC1............................................................................................................................................................ 280
SW.................................................................................................................................................................. 281
SWC1 ............................................................................................................................................................. 282
SWC2 ............................................................................................................................................................. 283
SWE ............................................................................................................................................................... 284
SWL................................................................................................................................................................ 285
SWLE ............................................................................................................................................................. 288
SWR ............................................................................................................................................................... 290
SWRE............................................................................................................................................................. 292
SWXC1........................................................................................................................................................... 294
SYNC.............................................................................................................................................................. 295
SYNCI............................................................................................................................................................. 300
SYSCALL ....................................................................................................................................................... 302
TEQ ................................................................................................................................................................ 303
TEQI ............................................................................................................................................................... 304
TGE ................................................................................................................................................................ 305
TGEI ............................................................................................................................................................... 306
TGEIU............................................................................................................................................................. 307
TGEU.............................................................................................................................................................. 308
TLBINV ........................................................................................................................................................... 310
TLBINVF......................................................................................................................................................... 312
TLBP............................................................................................................................................................... 314
TLBR .............................................................................................................................................................. 315
TLBWI............................................................................................................................................................. 317
TLBWR ........................................................................................................................................................... 319
TLT ................................................................................................................................................................. 321
TLTI ................................................................................................................................................................ 322
TLTIU.............................................................................................................................................................. 323
TLTU............................................................................................................................................................... 324
TNE ................................................................................................................................................................ 325
TNEI ............................................................................................................................................................... 326
TRUNC.L.fmt .................................................................................................................................................. 327
TRUNC.W.fmt................................................................................................................................................. 328
WAIT............................................................................................................................................................... 329
WRPGPR ....................................................................................................................................................... 330
WSBH............................................................................................................................................................. 331
XOR................................................................................................................................................................ 332
XORI............................................................................................................................................................... 333
Appendix A: Instruction Bit Encodings............................................................................................ 334
A.1: Instruction Encodings and Instruction Classes ....................................................................................... 334
A.2: Instruction Bit Encoding Tables............................................................................................................... 334
A.3: Floating Point Unit Instruction Format Encodings ................................................................................... 342
Appendix B: Misaligned Memory Accesses..................................................................................... 345
B.1: Terminology ............................................................................................................................................ 345
MIPS® Architecture For Programmers Volume II-A: The MIPS32® Instruction Set, Revision 5.03
8
Copyright © 2001-2003,2005,2008-2013 MIPS Technologies Inc. All rights reserved.