MIPS64™ Architecture For Programmers
Volume II: The MIPS64™ Instruction Set
Document Number: MD00087
Revision 0.95
March 12, 2001
MIPS Technologies, Inc.
1225 Charleston Road
Mountain View, CA 94043-1353
Copyright © 2000-2001 MIPS Technologies, Inc. All rights reserved.
Unpublished rights reserved under the Copyright Laws of the United States of America.
This document contains information that is proprietary to MIPS Technologies, Inc. (“MIPS Technologies”). Any
copying, modifyingor use of this information (in whole or in part) which is not expressly permitted in writing by MIPS
Technologies or a contractually-authorized third party is strictly prohibited. At a minimum, this information is protected
under unfair competition laws and the expression of the information contained herein is protected under federal
copyright laws. Violations thereof may result in criminal penalties and fines.
MIPS Technologies or any contractually-authorized third party 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. Any license under patent rights or any other intellectual property rights owned
by MIPS Technologies or third parties shall be conveyed by MIPS Technologies or any contractually-authorized third
party in a separate license agreement between the parties.
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 any contractually-authorized third party.
MIPS, R3000, R4000, R5000, R8000 and R10000 are among the registered trademarks of MIPS Technologies, Inc., and
R4300, R20K, MIPS16, MIPS32, MIPS64, MIPS-3D, MIPS I, MIPS II, MIPS III, MIPS IV, MIPS V, MDMX,
SmartMIPS, 4K, 4Kc, 4Km, 4Kp, 5K, 5Kc, 20K, 20Kc, EC, MGB, SOC-it, SEAD, YAMON, ATLAS, JALGO, CoreLV
and MIPS-based are among the trademarks of MIPS Technologies, Inc.
All other trademarks referred to herein are the property of their respective owners.
MIPS64™ Architecture For Programmers Volume II, Revision 0.95
Table of Contents
Chapter 1 About This Book ........................................................................................................................................................ 1
1.1 Typographical Conventions ........................................................................................................................................... 1
1.1.1 Italic Text ............................................................................................................................................................. 1
1.1.2 Bold Text ............................................................................................................................................................. 1
1.1.3 Courier Text ......................................................................................................................................................... 1
1.2 UNPREDICTABLE and UNDEFINED ........................................................................................................................ 2
1.2.1 UNPREDICTABLE............................................................................................................................................. 2
1.2.2 UNDEFINED....................................................................................................................................................... 2
1.3 Special Symbols in Pseudocode Notation...................................................................................................................... 2
1.4 For More Information .................................................................................................................................................... 5
Chapter 2 Guide to the Instruction Set ........................................................................................................................................ 7
2.1 Understanding the Instruction Fields ............................................................................................................................. 7
2.1.1 Instruction Fields ................................................................................................................................................. 8
2.1.2 Instruction Descriptive Name and Mnemonic ..................................................................................................... 9
2.1.3 Format Field......................................................................................................................................................... 9
2.1.4 Purpose Field ..................................................................................................................................................... 10
2.1.5 Description Field................................................................................................................................................ 10
2.1.6 Restrictions Field ............................................................................................................................................... 10
2.1.7 Operation Field .................................................................................................................................................. 11
2.1.8 Exceptions Field................................................................................................................................................. 11
2.1.9 Programming Notes and Implementation Notes Fields ..................................................................................... 11
2.2 Operation Section Notation and Functions .................................................................................................................. 12
2.2.1 Instruction Execution Ordering.......................................................................................................................... 12
2.2.2 Pseudocode Functions........................................................................................................................................ 12
2.3 Op and Function Subfield Notation ............................................................................................................................. 21
2.4 FPU Instructions .......................................................................................................................................................... 21
Chapter 3 The MIPS64™ Instruction Set ................................................................................................................................. 23
3.1 Compliance and Subsetting.......................................................................................................................................... 23
3.2 Alphabetical List of Instructions.................................................................................................................................. 23
ABS.fmt ............................................................................................................................................................................................................................... 34
ADD..................................................................................................................................................................................................................................... 35
ADD.fmt .............................................................................................................................................................................................................................. 37
ADDI.................................................................................................................................................................................................................................... 38
ADDIU................................................................................................................................................................................................................................. 39
ADDU .................................................................................................................................................................................................................................. 40
ALNV.PS............................................................................................................................................................................................................................. 41
AND..................................................................................................................................................................................................................................... 44
ANDI.................................................................................................................................................................................................................................... 45
B........................................................................................................................................................................................................................................... 46
BAL...................................................................................................................................................................................................................................... 47
BC1F.................................................................................................................................................................................................................................... 48
BC1FL ................................................................................................................................................................................................................................. 50
BC1T.................................................................................................................................................................................................................................... 52
BC1TL ................................................................................................................................................................................................................................. 54
BC2F.................................................................................................................................................................................................................................... 56
BC2FL ................................................................................................................................................................................................................................. 57
BC2T.................................................................................................................................................................................................................................... 59
BC2TL ................................................................................................................................................................................................................................. 60
BEQ...................................................................................................................................................................................................................................... 62
BEQL ................................................................................................................................................................................................................................... 63
BGEZ ................................................................................................................................................................................................................................... 65
BGEZAL.............................................................................................................................................................................................................................. 66
BGEZALL ........................................................................................................................................................................................................................... 67
MIPS64™ Architecture For Programmers Volume II, Revision 0.95
i
BGEZL................................................................................................................................................................................................................................. 69
BGTZ ................................................................................................................................................................................................................................... 71
BGTZL................................................................................................................................................................................................................................. 72
BLEZ.................................................................................................................................................................................................................................... 74
BLEZL ................................................................................................................................................................................................................................. 75
BLTZ.................................................................................................................................................................................................................................... 77
BLTZAL .............................................................................................................................................................................................................................. 78
BLTZALL............................................................................................................................................................................................................................ 79
BLTZL ................................................................................................................................................................................................................................. 81
BNE...................................................................................................................................................................................................................................... 83
BNEL ................................................................................................................................................................................................................................... 84
BREAK................................................................................................................................................................................................................................ 86
C.cond.fmt............................................................................................................................................................................................................................ 87
CACHE................................................................................................................................................................................................................................ 92
CEIL.L.fmt........................................................................................................................................................................................................................... 98
CEIL.W.fmt ....................................................................................................................................................................................................................... 100
CFC1.................................................................................................................................................................................................................................. 101
CFC2.................................................................................................................................................................................................................................. 103
CLO.................................................................................................................................................................................................................................... 104
CLZ.................................................................................................................................................................................................................................... 105
COP2.................................................................................................................................................................................................................................. 107
CTC1.................................................................................................................................................................................................................................. 108
CTC2.................................................................................................................................................................................................................................. 111
CVT.D.fmt ......................................................................................................................................................................................................................... 112
CVT.L.fmt.......................................................................................................................................................................................................................... 113
CVT.PS.S........................................................................................................................................................................................................................... 114
CVT.S.fmt.......................................................................................................................................................................................................................... 116
CVT.S.PL........................................................................................................................................................................................................................... 117
CVT.S.PU .......................................................................................................................................................................................................................... 119
CVT.W.fmt ........................................................................................................................................................................................................................ 120
DADD ................................................................................................................................................................................................................................ 121
DADDI............................................................................................................................................................................................................................... 122
DADDIU............................................................................................................................................................................................................................ 123
DADDU ............................................................................................................................................................................................................................. 124
DCLO................................................................................................................................................................................................................................. 125
DCLZ ................................................................................................................................................................................................................................. 126
DDIV.................................................................................................................................................................................................................................. 127
DDIVU............................................................................................................................................................................................................................... 128
DERET............................................................................................................................................................................................................................... 129
DIV .................................................................................................................................................................................................................................... 131
DIV.fmt.............................................................................................................................................................................................................................. 133
DIVU.................................................................................................................................................................................................................................. 134
DMFC0 .............................................................................................................................................................................................................................. 135
DMFC1 .............................................................................................................................................................................................................................. 136
DMFC2 .............................................................................................................................................................................................................................. 137
DMTC0.............................................................................................................................................................................................................................. 138
DMTC1.............................................................................................................................................................................................................................. 139
DMTC2.............................................................................................................................................................................................................................. 140
DMULT ............................................................................................................................................................................................................................. 141
DMULTU .......................................................................................................................................................................................................................... 142
DSLL.................................................................................................................................................................................................................................. 143
DSLL32.............................................................................................................................................................................................................................. 144
DSLLV............................................................................................................................................................................................................................... 145
DSRA................................................................................................................................................................................................................................. 146
DSRA32............................................................................................................................................................................................................................. 147
DSRAV.............................................................................................................................................................................................................................. 148
DSRL ................................................................................................................................................................................................................................. 149
DSRL32 ............................................................................................................................................................................................................................. 150
DSRLV .............................................................................................................................................................................................................................. 151
DSUB................................................................................................................................................................................................................................. 152
DSUBU.............................................................................................................................................................................................................................. 153
ERET.................................................................................................................................................................................................................................. 154
FLOOR.L.fmt .................................................................................................................................................................................................................... 155
FLOOR.W.fmt ................................................................................................................................................................................................................... 157
J.......................................................................................................................................................................................................................................... 158
JAL..................................................................................................................................................................................................................................... 159
ii
MIPS64™ Architecture For Programmers Volume II, Revision 0.95
JALR.................................................................................................................................................................................................................................. 160
JR ....................................................................................................................................................................................................................................... 162
LB ...................................................................................................................................................................................................................................... 164
LBU.................................................................................................................................................................................................................................... 165
LD ...................................................................................................................................................................................................................................... 166
LDC1.................................................................................................................................................................................................................................. 167
LDC2.................................................................................................................................................................................................................................. 168
LDL.................................................................................................................................................................................................................................... 169
LDR.................................................................................................................................................................................................................................... 171
LDXC1............................................................................................................................................................................................................................... 174
LH ...................................................................................................................................................................................................................................... 175
LHU ................................................................................................................................................................................................................................... 176
LL....................................................................................................................................................................................................................................... 177
LLD.................................................................................................................................................................................................................................... 179
LUI..................................................................................................................................................................................................................................... 181
LUXC1............................................................................................................................................................................................................................... 182
LW ..................................................................................................................................................................................................................................... 183
LWC1................................................................................................................................................................................................................................. 184
LWC2................................................................................................................................................................................................................................. 185
LWL................................................................................................................................................................................................................................... 186
LWR................................................................................................................................................................................................................................... 189
LWU .................................................................................................................................................................................................................................. 193
LWXC1.............................................................................................................................................................................................................................. 194
MADD ............................................................................................................................................................................................................................... 195
MADD.fmt......................................................................................................................................................................................................................... 197
MADDU ............................................................................................................................................................................................................................ 199
MFC0 ................................................................................................................................................................................................................................. 200
MFC1 ................................................................................................................................................................................................................................. 201
MFC2 ................................................................................................................................................................................................................................. 202
MFHI.................................................................................................................................................................................................................................. 203
MFLO ................................................................................................................................................................................................................................ 204
MOV.fmt............................................................................................................................................................................................................................ 205
MOVF................................................................................................................................................................................................................................ 206
MOVF.fmt ......................................................................................................................................................................................................................... 207
MOVN ............................................................................................................................................................................................................................... 209
MOVN.fmt......................................................................................................................................................................................................................... 210
MOVT................................................................................................................................................................................................................................ 212
MOVT.fmt ......................................................................................................................................................................................................................... 213
MOVZ................................................................................................................................................................................................................................ 215
MOVZ.fmt ......................................................................................................................................................................................................................... 216
MSUB ................................................................................................................................................................................................................................ 218
MSUB.fmt.......................................................................................................................................................................................................................... 219
MSUBU ............................................................................................................................................................................................................................. 221
MTC0................................................................................................................................................................................................................................. 222
MTC1................................................................................................................................................................................................................................. 223
MTC2................................................................................................................................................................................................................................. 224
MTHI ................................................................................................................................................................................................................................. 225
MTLO ................................................................................................................................................................................................................................ 226
MUL................................................................................................................................................................................................................................... 227
MUL.fmt ............................................................................................................................................................................................................................ 228
MULT ................................................................................................................................................................................................................................ 229
MULTU ............................................................................................................................................................................................................................. 230
NEG.fmt............................................................................................................................................................................................................................. 231
NMADD.fmt...................................................................................................................................................................................................................... 232
NMSUB.fmt....................................................................................................................................................................................................................... 234
NOP.................................................................................................................................................................................................................................... 236
NOR ................................................................................................................................................................................................................................... 237
OR...................................................................................................................................................................................................................................... 238
ORI..................................................................................................................................................................................................................................... 239
PLL.PS............................................................................................................................................................................................................................... 240
PLU.PS .............................................................................................................................................................................................................................. 241
PREF.................................................................................................................................................................................................................................. 242
PREFX ............................................................................................................................................................................................................................... 246
PUL.PS .............................................................................................................................................................................................................................. 247
PUU.PS .............................................................................................................................................................................................................................. 248
RECIP.fmt.......................................................................................................................................................................................................................... 249
MIPS64™ Architecture For Programmers Volume II, Revision 0.95
iii
ROUND.L.fmt ................................................................................................................................................................................................................... 251
ROUND.W.fmt .................................................................................................................................................................................................................. 253
RSQRT.fmt ........................................................................................................................................................................................................................ 255
SB....................................................................................................................................................................................................................................... 257
SC....................................................................................................................................................................................................................................... 258
SCD.................................................................................................................................................................................................................................... 261
SDi ..................................................................................................................................................................................................................................... 264
SDBBP............................................................................................................................................................................................................................... 265
SDC1.................................................................................................................................................................................................................................. 266
SDC2.................................................................................................................................................................................................................................. 267
SDL.................................................................................................................................................................................................................................... 268
SDR.................................................................................................................................................................................................................................... 271
SDXC1............................................................................................................................................................................................................................... 274
SH ...................................................................................................................................................................................................................................... 275
SLL .................................................................................................................................................................................................................................... 276
SLLV.................................................................................................................................................................................................................................. 277
SLT .................................................................................................................................................................................................................................... 278
SLTI ................................................................................................................................................................................................................................... 279
SLTIU ................................................................................................................................................................................................................................ 280
SLTU.................................................................................................................................................................................................................................. 281
SQRT.fmt........................................................................................................................................................................................................................... 282
SRA.................................................................................................................................................................................................................................... 283
SRAV................................................................................................................................................................................................................................. 284
SRL .................................................................................................................................................................................................................................... 285
SRLV ................................................................................................................................................................................................................................. 286
SSNOP ............................................................................................................................................................................................................................... 287
SUB.................................................................................................................................................................................................................................... 288
SUB.fmt ............................................................................................................................................................................................................................. 289
SUBU................................................................................................................................................................................................................................. 290
SUXC1............................................................................................................................................................................................................................... 291
SW...................................................................................................................................................................................................................................... 292
SWC1................................................................................................................................................................................................................................. 293
SWC2................................................................................................................................................................................................................................. 294
SWL ................................................................................................................................................................................................................................... 295
SWR................................................................................................................................................................................................................................... 297
SWXC1.............................................................................................................................................................................................................................. 299
SYNC................................................................................................................................................................................................................................. 300
SYSCALL.......................................................................................................................................................................................................................... 304
TEQ.................................................................................................................................................................................................................................... 305
TEQI .................................................................................................................................................................................................................................. 306
TGE.................................................................................................................................................................................................................................... 307
TGEI .................................................................................................................................................................................................................................. 308
TGEIU................................................................................................................................................................................................................................ 309
TGEU................................................................................................................................................................................................................................. 310
TLBP.................................................................................................................................................................................................................................. 311
TLBR ................................................................................................................................................................................................................................. 312
TLBWI............................................................................................................................................................................................................................... 314
TLBWR.............................................................................................................................................................................................................................. 316
TLT .................................................................................................................................................................................................................................... 318
TLTI................................................................................................................................................................................................................................... 319
TLTIU ................................................................................................................................................................................................................................ 320
TLTU ................................................................................................................................................................................................................................. 321
TNE.................................................................................................................................................................................................................................... 322
TNEI .................................................................................................................................................................................................................................. 323
TRUNC.L.fmt.................................................................................................................................................................................................................... 325
TRUNC.W.fmt................................................................................................................................................................................................................... 327
WAIT ................................................................................................................................................................................................................................. 329
XOR ................................................................................................................................................................................................................................... 331
XORI.................................................................................................................................................................................................................................. 332
Appendix A Revision History ................................................................................................................................................. 333
iv
MIPS64™ Architecture For Programmers Volume II, Revision 0.95
List of Figures
Figure 2-1: Example of Instruction Description .......................................................................................................................... 8
Figure 2-2: Example of Instruction Fields ................................................................................................................................... 9
Figure 2-3: Example of Instruction Descriptive Name and Mnemonic ....................................................................................... 9
Figure 2-4: Example of Instruction Format.................................................................................................................................. 9
Figure 2-5: Example of Instruction Purpose .............................................................................................................................. 10
Figure 2-6: Example of Instruction Description ........................................................................................................................ 10
Figure 2-7: Example of Instruction Restrictions ........................................................................................................................ 11
Figure 2-8: Example of Instruction Operation ........................................................................................................................... 11
Figure 2-9: Example of Instruction Exception........................................................................................................................... 11
Figure 2-10: Example of Instruction Programming Notes......................................................................................................... 12
Figure 2-11: COP_LW Pseudocode Function............................................................................................................................ 13
Figure 2-12: COP_LD Pseudocode Function............................................................................................................................. 13
Figure 2-13: COP_SW Pseudocode Function............................................................................................................................ 13
Figure 2-14: COP_SD Pseudocode Function............................................................................................................................. 14
Figure 2-15: AddressTranslation Pseudocode Function ............................................................................................................ 14
Figure 2-16: LoadMemory Pseudocode Function...................................................................................................................... 15
Figure 2-17: StoreMemory Pseudocode Function ..................................................................................................................... 15
Figure 2-18: Prefetch Pseudocode Function .............................................................................................................................. 16
Figure 2-19: ValueFPR Pseudocode Function ........................................................................................................................... 17
Figure 2-20: StoreFPR Pseudocode Function ............................................................................................................................ 18
Figure 2-21: SyncOperation Pseudocode Function.................................................................................................................... 19
Figure 2-22: SignalException Pseudocode Function ................................................................................................................. 19
Figure 2-23: NullifyCurrentInstruction PseudoCode Function.................................................................................................. 19
Figure 2-24: CoprocessorOperation Pseudocode Function........................................................................................................ 19
Figure 2-25: JumpDelaySlot Pseudocode Function ................................................................................................................... 20
Figure 2-26: NotWordValue Pseudocode Function ................................................................................................................... 20
Figure 2-27: FPConditionCode Pseudocode Function............................................................................................................... 20
Figure 2-28: SetFPConditionCode Pseudocode Function.......................................................................................................... 21
Figure 3-1: Example of an ALNV.PS Operation ....................................................................................................................... 41
Figure 3-2: Usage of Address Fields to Select Index and Way ................................................................................................. 93
Figure 3-3: Unaligned Doubleword Load Using LDL and LDR ............................................................................................. 169
Figure 3-4: Bytes Loaded by LDL Instruction......................................................................................................................... 170
Figure 3-5: Unaligned Doubleword Load Using LDR and LDL ............................................................................................. 171
Figure 3-6: Bytes Loaded by LDR Instruction......................................................................................................................... 172
Figure 3-7: Unaligned Word Load Using LWL and LWR ...................................................................................................... 186
Figure 3-8: Bytes Loaded by LWL Instruction........................................................................................................................ 187
Figure 3-9: Unaligned Word Load Using LWL and LWR ...................................................................................................... 190
Figure 3-10: Bytes Loaded by LWL Instruction...................................................................................................................... 191
Figure 3-11: Unaligned Doubleword Store With SDL and SDR............................................................................................. 268
Figure 3-12: Bytes Stored by an SDL Instruction.................................................................................................................... 269
Figure 3-13: Unaligned Doubleword Store With SDR and SDL............................................................................................. 271
Figure 3-14: Bytes Stored by an SDR Instruction.................................................................................................................... 272
Figure 3-15: Unaligned Word Store Using SWL and SWR .................................................................................................... 295
Figure 3-16: Bytes Stored by an SWL Instruction................................................................................................................... 296
Figure 3-17: Unaligned Word Store Using SWR and SWL .................................................................................................... 297
Figure 3-18: Bytes Stored by SWR Instruction ....................................................................................................................... 298
MIPS64™ Architecture For Programmers Volume II, Revision 0.95
v
List of Tables
Table 1-1: Symbols Used in Instruction Operation Statements .................................................................................................. 3
Table 2-1: AccessLength Specifications for Loads/Stores ....................................................................................................... 16
Table 3-1: CPU Arithmetic Instructions ................................................................................................................................... 24
Table 3-2: CPU Branch and Jump Instructions......................................................................................................................... 25
Table 3-3: CPU Instruction Control Instructions ...................................................................................................................... 25
Table 3-4: CPU Load, Store, and Memory Control Instructions .............................................................................................. 26
Table 3-5: CPU Logical Instructions ........................................................................................................................................ 27
Table 3-6: CPU Move Instructions ........................................................................................................................................... 27
Table 3-7: CPU Shift Instructions............................................................................................................................................. 27
Table 3-8: CPU Trap Instructions ............................................................................................................................................. 28
Table 3-9: Obsolete CPU Branch Instructions.......................................................................................................................... 28
Table 3-10: FPU Arithmetic Instructions.................................................................................................................................. 29
Table 3-11: FPU Branch Instructions........................................................................................................................................ 29
Table 3-12: FPU Compare Instructions .................................................................................................................................... 29
Table 3-13: FPU Convert Instructions ...................................................................................................................................... 29
Table 3-14: FPU Load, Store, and Memory Control Instructions............................................................................................. 30
Table 3-15: FPU Move Instructions.......................................................................................................................................... 31
Table 3-16: Obsolete FPU Branch Instructions ........................................................................................................................ 31
Table 3-17: Coprocessor Branch Instructions........................................................................................................................... 31
Table 3-18: Coprocessor Execute Instructions.......................................................................................................................... 31
Table 3-19: Coprocessor Load and Store Instructions .............................................................................................................. 32
Table 3-20: Coprocessor Move Instructions ............................................................................................................................. 32
Table 3-21: Obsolete Coprocessor Branch Instructions............................................................................................................ 32
Table 3-22: Privileged Instructions ........................................................................................................................................... 32
Table 3-23: EJTAG Instructions ............................................................................................................................................... 33
Table 3-24: FPU Comparisons Without Special Operand Exceptions ..................................................................................... 88
Table 3-25: FPU Comparisons With Special Operand Exceptions for QNaNs........................................................................ 89
Table 3-26: Usage of Effective Address ................................................................................................................................... 92
Table 3-27: Encoding of Bits[17:16] of CACHE Instruction ................................................................................................... 93
Table 3-28: Encoding of Bits [20:18] of the CACHE Instruction ............................................................................................ 94
Table 3-29: Values of the hint Field for the PREF Instruction ............................................................................................... 243
vi
MIPS64™ Architecture For Programmers Volume II, Revision 0.95