# Syntax: # : a field occupying so many bits. # T: a field occupying one bit. # Undefined bits end up as 0. # # This is intended to be compatible with MIPS release 5, integer instructions # only. It's based on the MIPS32 Instruction Set v5.04 manual (available from # https://www.mips.com/products/architectures/mips32-2/). # Useful pseudoops. # or RD, RS, zero 0000000000000000100101 "mov" RD=gpr ',' RS=gpr # Condition code tokens; these have to be defined here because .f overlaps with # a format code. %token .f %token .un %token .eq %token .ueq %token .olt %token .ult %token .ole %token .ule %token .sf %token .ngle %token .seq %token .ngl %token .lt %token .nge %token .le %token .ngt # Core ALU instructions. 00000000000100000 "add" RD=gpr ',' RS=gpr ',' RT=gpr 001000 "addi" RT=gpr ',' RS=gpr ',' IMM=e16 001001 "addiu" RT=gpr ',' RS=gpr ',' IMM=e16 00000000000100001 "addu" RD=gpr ',' RS=gpr ',' RT=gpr 00000000000100100 "and" RD=gpr ',' RS=gpr ',' RT=gpr 001100 "andi" RT=gpr ',' RS=gpr ',' IMM=e16 0001000000000000 "b" OFF=offset16 0000010000010001 "bal" OFF=offset16 000100 "beq" RS=gpr ',' RT=gpr ',' OFF=offset16 010100 "beql" RS=gpr ',' RT=gpr ',' OFF=offset16 00000100001 "bgez" RS=gpr ',' OFF=offset16 00000110001 "bgezal" RS=gpr ',' OFF=offset16 00000110011 "bgezall" RS=gpr ',' OFF=offset16 00000100011 "bgezl" RS=gpr ',' OFF=offset16 00011100000 "bgtz" RS=gpr ',' OFF=offset16 01011100000 "bgtzl" RS=gpr ',' OFF=offset16 00011000000 "blez" RS=gpr ',' OFF=offset16 01011000000 "blezl" RS=gpr ',' OFF=offset16 00000100000 "bltz" RS=gpr ',' OFF=offset16 00000110000 "bltzal" RS=gpr ',' OFF=offset16 00000110010 "bltzall" RS=gpr ',' OFF=offset16 00000100010 "bltzl" RS=gpr ',' OFF=offset16 000101 "bne" RS=gpr ',' RT=gpr ',' OFF=offset16 010101 "bnel" RS=gpr ',' RT=gpr ',' OFF=offset16 101111 "cache" OP=u5 ',' OFF=e16 '(' RS=gpr ')' 0111110011011 "cachee" OP=u5 ',' OFF=e9 '(' RS=gpr ')' 01110000000100001 "clo" RD=RT=gpr ',' RS=gpr 01110000000100000 "clz" RD=RT=gpr ',' RS=gpr 01000010000000000000000000011111 "deret" 010000010110110000000000000 "di" RT=gpr 01000001011000000110000000000000 "di" 0000000000000000011010 "div" RS=gpr ',' RT=gpr 0000000000000000011011 "divu" RS=gpr ',' RT=gpr 00000000000000000000000011000000 "ehb" 010000010110110000000100000 "ei" RT=gpr 01000001011000000110000000100000 "ei" 011111000000 "ext" RT=gpr ',' RS=gpr ',' extmsblsb 011111000100 "ins" RT=gpr ',' RS=gpr ',' insmsblsb 000010 "j" ABS=abs26 000011 "jal" ABS=abs26 0000000000000000001001 "jalr" RD=gpr ',' RS=gpr 000000000001111100000001001 "jalr" RS=gpr 0000000000010000001001 "jalr.hb" RD=gpr ',' RS=gpr 000000000001111110000001001 "jalr.hb" RS=gpr 011101 "jalx" ABS=abs26 000000000000000000000001000 "jr" RS=gpr 000000000000000010000001000 "jr.hb" RS=gpr 100000 "lb" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110101100 "lbe" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 100100 "lbu" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110101000 "lbue" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 100001 "lh" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110101101 "lhe" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 100101 "lhu" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110101001 "lhue" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 110000 "ll" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110101110 "lle" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 00111100000 "lui" RT=gpr ',' IMM=e16 100011 "lw" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110101111 "lwe" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 100010 "lwl" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110011001 "lwle" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 100110 "lwr" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110011010 "lwre" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 0111000000000000000000 "madd" RS=gpr ',' RT=gpr 0111000000000000000001 "maddu" RS=gpr ',' RT=gpr 000000000000000000000010000 "mfhi" RD=gpr 000000000000000000000010010 "mflo" RD=gpr 00000000000001011 "movn" RD=gpr ',' RS=gpr ',' RT=gpr 00000000000001010 "movz" RD=gpr ',' RS=gpr ',' RT=gpr 0111000000000000000100 "msub" RS=gpr ',' RT=gpr 0111000000000000000101 "msubu" RS=gpr ',' RT=gpr 000000000000000000000010001 "mthi" RS=gpr 000000000000000000000010011 "mtlo" RS=gpr 01110000000000010 "mul" RD=gpr ',' RS=gpr ',' RT=gpr 0000000000000000011000 "mult" RS=gpr ',' RT=gpr 0000000000000000000001 "multu" RS=gpr ',' RT=gpr 00000000000000000000000000000000 "nop" 00000000000100111 "nor" RD=gpr ',' RS=gpr ',' RT=gpr 00000000000100101 "or" RD=gpr ',' RS=gpr ',' RT=gpr 001101 "ori" RT=gpr ',' RS=gpr ',' IMM=e16 00000000000000000000000101000000 "pause" 110011 "pref" H=u5 ',' IMM=e16 '(' RS=gpr ')' 0111110100011 "prefe" H=u5 ',' IMM=e9 '(' RS=gpr ')' 01001100000001111 "prefx" H=u5 ',' RT=gpr '(' RS=gpr ')' 0111110000000000111011 "rdhwr" RT=gpr ',' RD=gpr 0100000101000000000000 "rdpgpr" RD=gpr ',' RT=gpr 00000000001000010 "rotr" RD=gpr ',' RT=gpr ',' SA=u5 00000000001000110 "rotrv" RD=gpr ',' RT=gpr ',' RS=gpr 101000 "sb" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110011100 "sbe" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 111000 "sc" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110011110 "sce" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 011100111111 "sdbbp" CODE=u20 0111110000010000100000 "seb" RD=gpr ',' RT=gpr 0111110000011000100000 "seh" RD=gpr ',' RT=gpr 101001 "sh" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110011101 "she" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 00000000000000000 "sll" RD=gpr ',' RT=gpr ',' SA=u5 00000000000000100 "sllv" RD=gpr ',' RT=gpr ',' RS=gpr 00000000000101010 "slt" RD=gpr ',' RS=gpr ',' RT=gpr 001010 "slti" RT=gpr ',' RS=gpr ',' IMM=e16 001011 "sltiu" RT=gpr ',' RS=gpr ',' IMM=e16 00000000000101011 "sltu" RD=gpr ',' RS=gpr ',' RT=gpr 00000000000000011 "sra" RD=gpr ',' RT=gpr ',' SA=u5 00000000000000111 "srav" RD=gpr ',' RT=gpr ',' RS=gpr 00000000000000010 "srl" RD=gpr ',' RT=gpr ',' SA=u5 00000000000000110 "srlv" RD=gpr ',' RT=gpr ',' RS=gpr 00000000000000000000000001000000 "ssnop" 00000000000100010 "sub" RD=gpr ',' RS=gpr ',' RT=gpr 00000000000100011 "subu" RD=gpr ',' RS=gpr ',' RT=gpr 101011 "sw" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110011111 "swe" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 101010 "swl" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110010001 "swle" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 101110 "swr" RT=gpr ',' IMM=e16 '(' RS=gpr ')' 0111110100010 "swre" RT=gpr ',' IMM=e9 '(' RS=gpr ')' 00000111111 "synci" IMM=e16 '(' RS=gpr ')' 000000001100 "syscall" CODE=u20 0000000000000000110100 "teq" RS=gpr ',' RT=gpr 00000101100 "teqi" RS=gpr ',' IMM=e16 0000000000000000110000 "tge" RS=gpr ',' RT=gpr 00000101000 "tgei" RS=gpr ',' IMM=e16 00000101001 "tgeiu" RS=gpr ',' IMM=e16 0000000000000000110001 "tgeu" RS=gpr ',' RT=gpr 01000010000000000000000000000011 "tlbinv" 01000010000000000000000000000100 "tlbinvf" 01000010000000000000000000001000 "tlbp" 01000010000000000000000000000001 "tlbr" 01000010000000000000000000000010 "tlbwi" 01000010000000000000000000000110 "tlbwr" 0000000000000000110010 "tlt" RS=gpr ',' RT=gpr 00000101010 "tlti" RS=gpr ',' IMM=e16 00000101011 "tltiu" RS=gpr ',' IMM=e16 0000000000000000110011 "tltu" RS=gpr ',' RT=gpr 0000000000000000110110 "tne" RS=gpr ',' RT=gpr 00000101110 "tnei" RS=gpr ',' IMM=e16 01000010000000000000000000100000 "wait" 0100000111000000000000 "wrpgpr" RD=gpr ',' RT=gpr 0111110000000010100000 "wsbh" RD=gpr ',' RT=gpr 00000000000100110 "xor" RD=gpr ',' RS=gpr ',' RT=gpr 001110 "xori" RT=gpr ',' RS=gpr ',' IMM=e16 # FPU instructions. 01000100000000101 "abs" F=fmt FD=fpr ',' FS=fpr 010001000000 "add" F=fmt FD=fpr ',' FS=fpr ',' FT=fpr 010011011110 "alnv" ".ps" FD=fpr ',' FS=fpr ',' FT=fpr ',' RS=gpr 0100010011 "c" CO=fcond F=fmt C=u3 ',' FS=fpr ',' FT=fpr 01000100000001010 "ceil" ".l" F=fmt FD=fpr ',' FS=fpr 01000100000001110 "ceil" ".w" F=fmt FD=fpr ',' FS=fpr 0100010001000000000000 "cfc1" RT=gpr ',' FS=fpr 0100010011000000000000 "ctc1" RT=gpr ',' FS=fpr 01000100000100001 "cvt" ".d" F=fmt FD=fpr ',' FS=fpr 01000100000100101 "cvt" ".l" F=fmt FD=fpr ',' FS=fpr 01000110000100110 "cvt" ".ps" ".s" FD=fpr ',' FS=fpr ',' FT=fpr 01000100000100000 "cvt" ".s" F=fmt FD=fpr ',' FS=fpr 0100011011000000101000 "cvt" ".s" ".pl" FS=fpr ',' FD=fpr 0100011011000000100000 "cvt" ".s" ".pu" FS=fpr ',' FD=fpr 01000100000100100 "cvt" ".w" F=fmt FD=fpr ',' FS=fpr 010001000011 "div" F=fmt FD=fpr ',' FS=fpr ',' FT=fpr 01000100000001011 "floor" ".l" F=fmt FD=fpr ',' FS=fpr 01000100000001111 "floor" ".w" F=fmt FD=fpr ',' FS=fpr 110101 "ldc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')' 01001100000000001 "ldxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' 01001100000000101 "luxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' 110001 "lwc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')' 01001100000000000 "lwxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' 010011100 "madd" F=fmt3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr 0100010000000000000000 "mfc1" RT=gpr ',' FS=fpr 0100010001100000000000 "mfhc1" RT=gpr ',' FS=fpr 01000100000000110 "mov" F=fmt FD=fpr ',' FS=fpr 0000000000000000001 "movf" RD=gpr ',' RS=gpr ',' C=u3 01000100010001 "movf" F=fmt FD=fpr ',' FS=fpr ',' C=u3 010001010011 "movn" F=fmt FD=fpr ',' FS=fpr ',' RT=gpr 0000000100000000001 "movt" RD=gpr ',' RS=gpr ',' C=u3 01000101010001 "movt" F=fmt FD=fpr ',' FS=fpr ',' C=u3 010001010010 "movz" F=fmt FD=fpr ',' FS=fpr ',' RT=gpr 010011101 "msub" F=fmt3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr 0100010010000000000000 "mtc1" RT=gpr ',' FS=fpr 0100010011100000000000 "mthc1" RT=gpr ',' FS=fpr 010001000010 "mul" F=fmt FD=fpr ',' FS=fpr ',' FT=fpr 01000100000000111 "neg" F=fmt FD=fpr ',' FS=fpr 010011110 "nmadd" F=fmt3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr 010011111 "nmsub" F=fmt3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr 01000110110101100 "pll" ".ps" FD=fpr ',' FS=fpr ',' FT=fpr 01000110110101101 "plu" ".ps" FD=fpr ',' FS=fpr ',' FT=fpr 01000110110101110 "pul" ".ps" FD=fpr ',' FS=fpr ',' FT=fpr 01000110110101111 "puu" ".ps" FD=fpr ',' FS=fpr ',' FT=fpr 01000100000010101 "recip." F=fmt FD=fpr ',' FS=fpr 01000100000001000 "round" ".l" F=fmt FD=fpr ',' FS=fpr 01000100000001100 "round" ".w" F=fmt FD=fpr ',' FS=fpr 01000100000010110 "rsqrt" F=fmt FD=fpr ',' FS=fpr 111101 "sdc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')' 01001100000001001 "sdxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' 01000100000000100 "sqrt" F=fmt FD=fpr ',' FS=fpr 010001000001 "sub" F=fmt FD=fpr ',' FS=fpr ',' FT=fpr 01001100000001101 "suxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' 111001 "swc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')' 01001100000001000 "swxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' 01000100000001001 "trunc" ".l" F=fmt FD=fpr ',' FS=fpr 01000100000001101 "trunc" ".w" F=fmt FD=fpr ',' FS=fpr # Generic coprocessor instructions. 0100010100000 "bc1f" C=u3 ',' OFF=offset16 0100010100000000 "bc1f" OFF=offset16 0100010100010 "bc1fl" C=u3 ',' OFF=offset16 0100010100000010 "bc1fl" OFF=offset16 0100010100001 "bc1t" C=u3 ',' OFF=offset16 0100010100000001 "bc1t" OFF=offset16 0100010100011 "bc1tl" C=u3 ',' OFF=offset16 0100010100000011 "bc1tl" OFF=offset16 0100100100000 "bc2f" C=u3 ',' OFF=offset16 0100100100000000 "bc2f" OFF=offset16 0100100100010 "bc2fl" C=u3 ',' OFF=offset16 0100100100000010 "bc2fl" OFF=offset16 0100100100001 "bc2t" C=u3 ',' OFF=offset16 0100100100000001 "bc2t" OFF=offset16 0100100100011 "bc2tl" C=u3 ',' OFF=offset16 0100100100000011 "bc2tl" OFF=offset16 01001000010 "cfc2" RT=gpr ',' IMM=u16 01001000110 "ctc2" RT=gpr ',' IMM=u16 0100101 "cop2" FUN=u25 110110 "ldc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')' 110010 "lwc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')' 0100000000000000000 "mfc0" RT=gpr ',' RD=u5 ',' S=u3 01001000000 "mfc2" RT=gpr ',' IMM=u16 0100000001000000000 "mfhc0" RT=gpr ',' RD=u5 ',' S=u3 01001000011 "mfhc2" RT=gpr ',' IMM=u16 0100000010000000000 "mtc0" RT=gpr ',' RD=u5 ',' S=u3 01001000100 "mtc2" RT=gpr ',' IMM=u16 0100000011000000000 "mthc0" RT=gpr ',' RD=u5 ',' S=u3 01001000111 "mthc2" RT=gpr ',' IMM=u16 111110 "sdc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')' 111010 "swc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')'