RISC-V instructions (RV32)

Instruction reference: i386 · x64 · ARM32 (Thumb-2) · ARM64 (AArch64) · RISC-V (RV32)

143 instructions for .arch riscv32: name, operands, the bit encoding (32 bits, 16 bits for the compressed instructions) and a short description with the operation in pseudo code. Included is everything the RISC-V cores of the Raspberry Pi Pico 2 (Hazard3) run: the base set RV32I, multiplication and division (M), the atomic instructions (A), the control registers (Zicsr), fence.i (Zifencei), the bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb) and the compressed instructions (C, Zcb). The pseudo instructions of the assembler (li, mv, j, ret …) are listed with the instruction they become. The Hazard3 has no floating point.

How to read the table

A RISC-V instruction is a word of 32 bits; its two lowest bits are then 11. A compressed instruction (a name with c.) has 16 bits and ends in 00, 01 or 10. The encoding shows the bits from left (highest bit number) to right: fixed bits as digits (opcode, funct3, funct7), the names are fields. Hover a field to see its range of bits. rd, rs1, rs2 are registers of 5 bits (x0 to x31); rd', rs1', rs2' in the compressed instructions have 3 bits and mean x8 to x15. Below is the value of the fixed bits and the mask in hex: an instruction belongs to this form if (word & mask) == value.

Constants are spread over several fields in RISC-V, so that the sign is always in bit 31 and the registers stay in fixed places. imm[12|10-5] is a field that holds the bits 12 and 10 to 5 of the number, in this order. For jumps and branches bit 0 of the distance is always 0 and is not stored. There are no flags: branches compare two registers themselves, slt writes the result of a comparison as 0 or 1 into a register.

The atomic instructions have the bits aq and rl for the order of the memory accesses; the disassembler writes them as a suffix of the name (amoadd.w.aq, .rl, .aqrl). Every encoding in this table is checked against the decoder of Asmonite: with random values in the fields it gives this instruction (or its pseudo name) again. The pseudo code is written in English like source code; <s and <u compare signed and unsigned, [x]32 is the word in memory at address x.

InstructionOperandsEncodingDescription
addrd, rs1, rs20000000 rs2 rs1 000 rd 01100110x00000033 / mask 0xFE00707FAddition of two registersrd = rs1 + rs2Arithmetic
addird, rs1, imm12also shown as: li, mv, nopimm[11-0] rs1 000 rd 00100110x00000013 / mask 0x0000707FAddition of a constant (12 bit, signed)rd = rs1 + sext(imm12)Arithmetic
amoadd.wrd, rs2, (rs1)00000 aq rl rs2 rs1 010 rd 01011110x0000202F / mask 0xF800707FAtomic addition (A)rd = [rs1]; [rs1] = rd + rs2Atomic memory operations (A)
amoand.wrd, rs2, (rs1)01100 aq rl rs2 rs1 010 rd 01011110x6000202F / mask 0xF800707FAtomic AND (A)rd = [rs1]; [rs1] = rd & rs2Atomic memory operations (A)
amomax.wrd, rs2, (rs1)10100 aq rl rs2 rs1 010 rd 01011110xA000202F / mask 0xF800707FAtomic signed maximum (A)rd = [rs1]; [rs1] = max_s(rd, rs2)Atomic memory operations (A)
amomaxu.wrd, rs2, (rs1)11100 aq rl rs2 rs1 010 rd 01011110xE000202F / mask 0xF800707FAtomic unsigned maximum (A)rd = [rs1]; [rs1] = max_u(rd, rs2)Atomic memory operations (A)
amomin.wrd, rs2, (rs1)10000 aq rl rs2 rs1 010 rd 01011110x8000202F / mask 0xF800707FAtomic signed minimum (A)rd = [rs1]; [rs1] = min_s(rd, rs2)Atomic memory operations (A)
amominu.wrd, rs2, (rs1)11000 aq rl rs2 rs1 010 rd 01011110xC000202F / mask 0xF800707FAtomic unsigned minimum (A)rd = [rs1]; [rs1] = min_u(rd, rs2)Atomic memory operations (A)
amoor.wrd, rs2, (rs1)01000 aq rl rs2 rs1 010 rd 01011110x4000202F / mask 0xF800707FAtomic OR (A)rd = [rs1]; [rs1] = rd | rs2Atomic memory operations (A)
amoswap.wrd, rs2, (rs1)00001 aq rl rs2 rs1 010 rd 01011110x0800202F / mask 0xF800707FAtomic swap (A)rd = [rs1]; [rs1] = rs2Atomic memory operations (A)
amoxor.wrd, rs2, (rs1)00100 aq rl rs2 rs1 010 rd 01011110x2000202F / mask 0xF800707FAtomic exclusive OR (A)rd = [rs1]; [rs1] = rd ^ rs2Atomic memory operations (A)
andrd, rs1, rs20000000 rs2 rs1 111 rd 01100110x00007033 / mask 0xFE00707FANDrd = rs1 & rs2Logic and bits
andird, rs1, imm12imm[11-0] rs1 111 rd 00100110x00007013 / mask 0x0000707FAND with a constantrd = rs1 & sext(imm12)Logic and bits
andnrd, rs1, rs20100000 rs2 rs1 111 rd 01100110x40007033 / mask 0xFE00707FAND with an inverted operand (Zbb, Zbkb)rd = rs1 & ~rs2Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
auipcrd, imm20imm[31-12] rd 00101110x00000017 / mask 0x0000007FAddition of the upper 20 bits to the pc (address relative to the instruction)rd = pc + (imm20 << 12)Constants and addresses
bclrrd, rs1, rs20100100 rs2 rs1 001 rd 01100110x48001033 / mask 0xFE00707FClearing of one bit (Zbs)rd = rs1 & ~(1 << rs2[4:0])Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
bclrird, rs1, shamt0100100 shamt rs1 001 rd 00100110x48001013 / mask 0xFE00707FClearing of one bit, its number as a constant (Zbs)rd = rs1 & ~(1 << shamt)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
beqrs1, rs2, labelalso shown as: beqzimm[12|10-5] rs2 rs1 000 imm[4-1|11] 11000110x00000063 / mask 0x0000707FBranch if equalif rs1 == rs2 then pc = pc + sext(imm13)Branches and calls
bextrd, rs1, rs20100100 rs2 rs1 101 rd 01100110x48005033 / mask 0xFE00707FExtraction of one bit (Zbs)rd = (rs1 >> rs2[4:0]) & 1Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
bextird, rs1, shamt0100100 shamt rs1 101 rd 00100110x48005013 / mask 0xFE00707FExtraction of one bit, its number as a constant (Zbs)rd = (rs1 >> shamt) & 1Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
bgers1, rs2, labelalso shown as: bgez, blezimm[12|10-5] rs2 rs1 101 imm[4-1|11] 11000110x00005063 / mask 0x0000707FBranch if greater or equal (signed)if rs1 >=s rs2 then pc = pc + sext(imm13)Branches and calls
bgeurs1, rs2, labelimm[12|10-5] rs2 rs1 111 imm[4-1|11] 11000110x00007063 / mask 0x0000707FBranch if greater or equal (unsigned)if rs1 >=u rs2 then pc = pc + sext(imm13)Branches and calls
binvrd, rs1, rs20110100 rs2 rs1 001 rd 01100110x68001033 / mask 0xFE00707FInversion of one bit (Zbs)rd = rs1 ^ (1 << rs2[4:0])Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
binvird, rs1, shamt0110100 shamt rs1 001 rd 00100110x68001013 / mask 0xFE00707FInversion of one bit, its number as a constant (Zbs)rd = rs1 ^ (1 << shamt)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
bltrs1, rs2, labelalso shown as: bltz, bgtzimm[12|10-5] rs2 rs1 100 imm[4-1|11] 11000110x00004063 / mask 0x0000707FBranch if less (signed)if rs1 <s rs2 then pc = pc + sext(imm13)Branches and calls
blturs1, rs2, labelimm[12|10-5] rs2 rs1 110 imm[4-1|11] 11000110x00006063 / mask 0x0000707FBranch if less (unsigned)if rs1 <u rs2 then pc = pc + sext(imm13)Branches and calls
bners1, rs2, labelalso shown as: bnezimm[12|10-5] rs2 rs1 001 imm[4-1|11] 11000110x00001063 / mask 0x0000707FBranch if not equalif rs1 != rs2 then pc = pc + sext(imm13)Branches and calls
brev8rd, rs1011010000111 rs1 101 rd 00100110x68705013 / mask 0xFFF0707FReversal of the bits in every byte (Zbkb)for every byte: rd.byte = bit_reverse(rs1.byte)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
bsetrd, rs1, rs20010100 rs2 rs1 001 rd 01100110x28001033 / mask 0xFE00707FSetting of one bit (Zbs)rd = rs1 | (1 << rs2[4:0])Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
bsetird, rs1, shamt0010100 shamt rs1 001 rd 00100110x28001013 / mask 0xFE00707FSetting of one bit, its number as a constant (Zbs)rd = rs1 | (1 << shamt)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
c.addrd, rs2100 1 rd rs2 100x9002 / mask 0xF003Addition of two registersrd = rd + rs2 (rs2 != 0)Compressed instructions (C, Zcb)
c.addird, imm6also shown as: c.nop000 imm[5] rd imm[4-0] 010x0001 / mask 0xE003Addition of a constant (6 bit, signed)rd = rd + sext(imm6)Compressed instructions (C, Zcb)
c.addi16spsp, imm011 imm[9] 00010 imm[4|6|8-7|5] 010x6101 / mask 0xEF83Addition of a multiple of 16 to spsp = sp + sext(imm10) (imm != 0)Compressed instructions (C, Zcb)
c.addi4spnrd', sp, uimm000 uimm[5-4|9-6|2|3] rd' 000x0000 / mask 0xE003Addition of a constant to sp (an address on the stack)rd' = sp + zext(uimm) (uimm != 0)Compressed instructions (C, Zcb)
c.andrd', rs2'100 0 11 rd' 11 rs2' 010x8C61 / mask 0xFC63ANDrd' = rd' & rs2'Compressed instructions (C, Zcb)
c.andird', imm6100 imm[5] 10 rd' imm[4-0] 010x8801 / mask 0xEC03AND with a constant (6 bit, signed)rd' = rd' & sext(imm6)Compressed instructions (C, Zcb)
c.beqzrs1', label110 imm[8|4-3] rs1' imm[7-6|2-1|5] 010xC001 / mask 0xE003Branch if zeroif rs1' == 0 then pc = pc + sext(imm9)Compressed instructions (C, Zcb)
c.bnezrs1', label111 imm[8|4-3] rs1' imm[7-6|2-1|5] 010xE001 / mask 0xE003Branch if not zeroif rs1' != 0 then pc = pc + sext(imm9)Compressed instructions (C, Zcb)
c.ebreak100 1 00000 00000 100x9002 / mask 0xFFFFBreakpoint for the debuggerraise breakpoint exception (or enter debug mode)Compressed instructions (C, Zcb)
c.jlabel101 imm[11|4|9-8|10|6|7|3-1|5] 010xA001 / mask 0xE003Jump (±2 KB)pc = pc + sext(imm12)Compressed instructions (C, Zcb)
c.jallabel001 imm[11|4|9-8|10|6|7|3-1|5] 010x2001 / mask 0xE003Jump and link to ra (±2 KB)ra = pc + 2; pc = pc + sext(imm12)Compressed instructions (C, Zcb)
c.jalrrs1100 1 rs1 00000 100x9002 / mask 0xF07FJump to the address in a register, and link to rat = rs1; ra = pc + 2; pc = tCompressed instructions (C, Zcb)
c.jrrs1100 0 rs1 00000 100x8002 / mask 0xF07FJump to the address in a registerpc = rs1 (rs1 != 0)Compressed instructions (C, Zcb)
c.lburd', uimm(rs1')100 000 rs1' uimm[0|1] rd' 000x8000 / mask 0xFC03Load of a byte, unsigned (Zcb)rd' = zext([rs1' + uimm]8)Compressed instructions (C, Zcb)
c.lhrd', uimm(rs1')100 001 rs1' 1 uimm[1] rd' 000x8440 / mask 0xFC43Load of a half word, signed (Zcb)rd' = sext([rs1' + uimm]16)Compressed instructions (C, Zcb)
c.lhurd', uimm(rs1')100 001 rs1' 0 uimm[1] rd' 000x8400 / mask 0xFC43Load of a half word, unsigned (Zcb)rd' = zext([rs1' + uimm]16)Compressed instructions (C, Zcb)
c.lird, imm6010 imm[5] rd imm[4-0] 010x4001 / mask 0xE003Load of a constant (6 bit, signed)rd = sext(imm6)Compressed instructions (C, Zcb)
c.luird, imm6also shown as: c.addi16sp011 imm[17] rd imm[16-12] 010x6001 / mask 0xE003Load of the bits 17 to 12 of a constantrd = sext(imm6 << 12) (rd != 0, 2)Compressed instructions (C, Zcb)
c.lwrd', uimm(rs1')010 uimm[5-3] rs1' uimm[2|6] rd' 000x4000 / mask 0xE003Load of a wordrd' = [rs1' + zext(uimm)]32Compressed instructions (C, Zcb)
c.lwsprd, uimm(sp)010 uimm[5] rd uimm[4-2|7-6] 100x4002 / mask 0xE003Load of a word from the stackrd = [sp + zext(uimm)]32 (rd != 0)Compressed instructions (C, Zcb)
c.mulrd', rs2'100 1 11 rd' 10 rs2' 010x9C41 / mask 0xFC63Multiplication, low 32 bits (Zcb)rd' = (rd' * rs2')[31:0]Compressed instructions (C, Zcb)
c.mvrd, rs2100 0 rd rs2 100x8002 / mask 0xF003Copy of a registerrd = rs2 (rs2 != 0)Compressed instructions (C, Zcb)
c.notrd'100 1 11 rd' 11 101 010x9C75 / mask 0xFC7FBitwise inversion (Zcb)rd' = ~rd'Compressed instructions (C, Zcb)
c.orrd', rs2'100 0 11 rd' 10 rs2' 010x8C41 / mask 0xFC63ORrd' = rd' | rs2'Compressed instructions (C, Zcb)
c.sbrs2', uimm(rs1')100 010 rs1' uimm[0|1] rs2' 000x8800 / mask 0xFC03Store of a byte (Zcb)[rs1' + uimm]8 = rs2'[7:0]Compressed instructions (C, Zcb)
c.sext.brd'100 1 11 rd' 11 001 010x9C65 / mask 0xFC7FSign extension of a byte (Zcb)rd' = sext(rd'[7:0])Compressed instructions (C, Zcb)
c.sext.hrd'100 1 11 rd' 11 011 010x9C6D / mask 0xFC7FSign extension of a half word (Zcb)rd' = sext(rd'[15:0])Compressed instructions (C, Zcb)
c.shrs2', uimm(rs1')100 011 rs1' 0 uimm[1] rs2' 000x8C00 / mask 0xFC43Store of a half word (Zcb)[rs1' + uimm]16 = rs2'[15:0]Compressed instructions (C, Zcb)
c.sllird, shamt000 0 rd shamt 100x0002 / mask 0xF003Shift left by a constantrd = rd << shamtCompressed instructions (C, Zcb)
c.sraird', shamt100 0 01 rd' shamt 010x8401 / mask 0xFC03Shift right signed by a constantrd' = rd' >>s shamtCompressed instructions (C, Zcb)
c.srlird', shamt100 0 00 rd' shamt 010x8001 / mask 0xFC03Shift right unsigned by a constantrd' = rd' >>u shamtCompressed instructions (C, Zcb)
c.subrd', rs2'100 0 11 rd' 00 rs2' 010x8C01 / mask 0xFC63Subtractionrd' = rd' - rs2'Compressed instructions (C, Zcb)
c.swrs2', uimm(rs1')110 uimm[5-3] rs1' uimm[2|6] rs2' 000xC000 / mask 0xE003Store of a word[rs1' + zext(uimm)]32 = rs2'Compressed instructions (C, Zcb)
c.swsprs2, uimm(sp)110 uimm[5-2|7-6] rs2 100xC002 / mask 0xE003Store of a word on the stack[sp + zext(uimm)]32 = rs2Compressed instructions (C, Zcb)
c.xorrd', rs2'100 0 11 rd' 01 rs2' 010x8C21 / mask 0xFC63Exclusive ORrd' = rd' ^ rs2'Compressed instructions (C, Zcb)
c.zext.brd'100 1 11 rd' 11 000 010x9C61 / mask 0xFC7FZero extension of a byte (Zcb)rd' = zext(rd'[7:0])Compressed instructions (C, Zcb)
c.zext.hrd'100 1 11 rd' 11 010 010x9C69 / mask 0xFC7FZero extension of a half word (Zcb)rd' = zext(rd'[15:0])Compressed instructions (C, Zcb)
clmulrd, rs1, rs20000101 rs2 rs1 001 rd 01100110x0A001033 / mask 0xFE00707FCarry-less multiplication, low 32 bits (Zbc)rd = clmul(rs1, rs2)[31:0]Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
clmulhrd, rs1, rs20000101 rs2 rs1 011 rd 01100110x0A003033 / mask 0xFE00707FCarry-less multiplication, high 32 bits (Zbc)rd = clmul(rs1, rs2)[63:32]Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
clmulrrd, rs1, rs20000101 rs2 rs1 010 rd 01100110x0A002033 / mask 0xFE00707FCarry-less multiplication, bits 62 to 31 (Zbc)rd = clmul(rs1, rs2)[62:31]Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
clzrd, rs10110000 00000 rs1 001 rd 00100110x60001013 / mask 0xFFF0707FCount of the leading zero bits (Zbb)rd = number of 0 bits above the highest 1 bit (32 for 0)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
cpoprd, rs10110000 00010 rs1 001 rd 00100110x60201013 / mask 0xFFF0707FCount of the set bits (Zbb)rd = number of 1 bits in rs1Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
csrrcrd, csr, rs1also shown as: csrccsr rs1 011 rd 11100110x00003073 / mask 0x0000707FRead of a control register and clearing of bitst = csr; csr = t & ~rs1; rd = tControl and status registers (Zicsr)
csrrcird, csr, uimm5also shown as: csrcicsr uimm 111 rd 11100110x00007073 / mask 0x0000707FRead of a control register and clearing of the bits of a constantt = csr; csr = t & ~uimm5; rd = tControl and status registers (Zicsr)
csrrsrd, csr, rs1also shown as: csrr, csrscsr rs1 010 rd 11100110x00002073 / mask 0x0000707FRead of a control register and setting of bitst = csr; csr = t | rs1; rd = tControl and status registers (Zicsr)
csrrsird, csr, uimm5also shown as: csrsicsr uimm 110 rd 11100110x00006073 / mask 0x0000707FRead of a control register and setting of the bits of a constantt = csr; csr = t | uimm5; rd = tControl and status registers (Zicsr)
csrrwrd, csr, rs1also shown as: csrwcsr rs1 001 rd 11100110x00001073 / mask 0x0000707FExchange of a control register with a registert = csr; csr = rs1; rd = tControl and status registers (Zicsr)
csrrwird, csr, uimm5also shown as: csrwicsr uimm 101 rd 11100110x00005073 / mask 0x0000707FExchange of a control register with a constant (5 bit)rd = csr; csr = uimm5Control and status registers (Zicsr)
ctzrd, rs10110000 00001 rs1 001 rd 00100110x60101013 / mask 0xFFF0707FCount of the trailing zero bits (Zbb)rd = number of 0 bits below the lowest 1 bit (32 for 0)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
divrd, rs1, rs20000001 rs2 rs1 100 rd 01100110x02004033 / mask 0xFE00707FSigned division (M)rd = rs1 /s rs2 (by 0: -1)Arithmetic
divurd, rs1, rs20000001 rs2 rs1 101 rd 01100110x02005033 / mask 0xFE00707FUnsigned division (M)rd = rs1 /u rs2 (by 0: all ones)Arithmetic
ebreak000000000001 00000 000 00000 11100110x00100073 / mask 0xFFFFFFFFBreakpoint for the debuggerraise breakpoint exception (or enter debug mode)System and privileged
ecall000000000000 00000 000 00000 11100110x00000073 / mask 0xFFFFFFFFCall of the environment (exception)raise environment call exceptionSystem and privileged
fencepred, succ0000 pred succ 00000 000 00000 00011110x0000000F / mask 0xF00FFFFFMemory barrier: accesses of the kind pred before those of the kind succorder memory accesses (i, o, r, w)Barriers and others
fence.i000000000000 00000 001 00000 00011110x0000100F / mask 0xFFFFFFFFSynchronisation of the instruction stream with code written before (Zifencei)later instruction fetches see earlier storesBarriers and others
jalrd, labelalso shown as: jimm[20|10-1|11|19-12] rd 11011110x0000006F / mask 0x0000007FJump and link (±1 MB)rd = pc + 4; pc = pc + sext(imm21)Branches and calls
jalrrd, imm12(rs1)also shown as: jr, retimm[11-0] rs1 000 rd 11001110x00000067 / mask 0x0000707FJump to the address in a register, and linkt = rs1 + sext(imm12); rd = pc + 4; pc = t & ~1Branches and calls
lbrd, imm12(rs1)imm[11-0] rs1 000 rd 00000110x00000003 / mask 0x0000707FLoad of a byte, signedrd = sext([rs1 + sext(imm12)]8)Loads and stores
lburd, imm12(rs1)imm[11-0] rs1 100 rd 00000110x00004003 / mask 0x0000707FLoad of a byte, unsignedrd = zext([rs1 + sext(imm12)]8)Loads and stores
lhrd, imm12(rs1)imm[11-0] rs1 001 rd 00000110x00001003 / mask 0x0000707FLoad of a half word, signedrd = sext([rs1 + sext(imm12)]16)Loads and stores
lhurd, imm12(rs1)imm[11-0] rs1 101 rd 00000110x00005003 / mask 0x0000707FLoad of a half word, unsignedrd = zext([rs1 + sext(imm12)]16)Loads and stores
lr.wrd, (rs1)00010 aq rl 00000 rs1 010 rd 01011110x1000202F / mask 0xF9F0707FLoad reserved (A)rd = [rs1]32; reserve the addressAtomic memory operations (A)
luird, imm20imm[31-12] rd 01101110x00000037 / mask 0x0000007FLoad of the upper 20 bits of a constantrd = imm20 << 12Constants and addresses
lwrd, imm12(rs1)imm[11-0] rs1 010 rd 00000110x00002003 / mask 0x0000707FLoad of a word (32 bit)rd = [rs1 + sext(imm12)]32Loads and stores
maxrd, rs1, rs20000101 rs2 rs1 110 rd 01100110x0A006033 / mask 0xFE00707FSigned maximum (Zbb)rd = (rs1 >s rs2) ? rs1 : rs2Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
maxurd, rs1, rs20000101 rs2 rs1 111 rd 01100110x0A007033 / mask 0xFE00707FUnsigned maximum (Zbb)rd = (rs1 >u rs2) ? rs1 : rs2Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
minrd, rs1, rs20000101 rs2 rs1 100 rd 01100110x0A004033 / mask 0xFE00707FSigned minimum (Zbb)rd = (rs1 <s rs2) ? rs1 : rs2Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
minurd, rs1, rs20000101 rs2 rs1 101 rd 01100110x0A005033 / mask 0xFE00707FUnsigned minimum (Zbb)rd = (rs1 <u rs2) ? rs1 : rs2Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
mret0011000 00010 00000 000 00000 11100110x30200073 / mask 0xFFFFFFFFReturn from an exception in machine modepc = mepc; restore the mode from mstatusSystem and privileged
mulrd, rs1, rs20000001 rs2 rs1 000 rd 01100110x02000033 / mask 0xFE00707FMultiplication, low 32 bits (M)rd = (rs1 * rs2)[31:0]Arithmetic
mulhrd, rs1, rs20000001 rs2 rs1 001 rd 01100110x02001033 / mask 0xFE00707FSigned multiplication, high 32 bits (M)rd = (sext(rs1) * sext(rs2))[63:32]Arithmetic
mulhsurd, rs1, rs20000001 rs2 rs1 010 rd 01100110x02002033 / mask 0xFE00707FSigned by unsigned multiplication, high 32 bits (M)rd = (sext(rs1) * zext(rs2))[63:32]Arithmetic
mulhurd, rs1, rs20000001 rs2 rs1 011 rd 01100110x02003033 / mask 0xFE00707FUnsigned multiplication, high 32 bits (M)rd = (zext(rs1) * zext(rs2))[63:32]Arithmetic
orrd, rs1, rs20000000 rs2 rs1 110 rd 01100110x00006033 / mask 0xFE00707FORrd = rs1 | rs2Logic and bits
orc.brd, rs1001010000111 rs1 101 rd 00100110x28705013 / mask 0xFFF0707FSetting of every byte to 0x00 or 0xFF by whether one of its bits is set (Zbb)for every byte: rd.byte = (rs1.byte != 0) ? 0xFF : 0Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
orird, rs1, imm12imm[11-0] rs1 110 rd 00100110x00006013 / mask 0x0000707FOR with a constantrd = rs1 | sext(imm12)Logic and bits
ornrd, rs1, rs20100000 rs2 rs1 110 rd 01100110x40006033 / mask 0xFE00707FOR with an inverted operand (Zbb, Zbkb)rd = rs1 | ~rs2Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
packrd, rs1, rs2also shown as: zext.h0000100 rs2 rs1 100 rd 01100110x08004033 / mask 0xFE00707FPacking of the low half words of two registers (Zbkb)rd = (rs2[15:0] << 16) | rs1[15:0]Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
packhrd, rs1, rs20000100 rs2 rs1 111 rd 01100110x08007033 / mask 0xFE00707FPacking of the low bytes of two registers (Zbkb)rd = (rs2[7:0] << 8) | rs1[7:0]Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
remrd, rs1, rs20000001 rs2 rs1 110 rd 01100110x02006033 / mask 0xFE00707FRemainder of the signed division (M)rd = rs1 %s rs2 (by 0: rs1)Arithmetic
remurd, rs1, rs20000001 rs2 rs1 111 rd 01100110x02007033 / mask 0xFE00707FRemainder of the unsigned division (M)rd = rs1 %u rs2 (by 0: rs1)Arithmetic
rev8rd, rs1011010011000 rs1 101 rd 00100110x69805013 / mask 0xFFF0707FReversal of the order of the bytes (Zbb, Zbkb)rd = byte_reverse(rs1)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
rolrd, rs1, rs20110000 rs2 rs1 001 rd 01100110x60001033 / mask 0xFE00707FRotate left by a register (Zbb, Zbkb)rd = rotate_left(rs1, rs2[4:0])Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
rorrd, rs1, rs20110000 rs2 rs1 101 rd 01100110x60005033 / mask 0xFE00707FRotate right by a register (Zbb, Zbkb)rd = rotate_right(rs1, rs2[4:0])Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
rorird, rs1, shamt0110000 shamt rs1 101 rd 00100110x60005013 / mask 0xFE00707FRotate right by a constant (Zbb, Zbkb)rd = rotate_right(rs1, shamt)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
sbrs2, imm12(rs1)imm[11-5] rs2 rs1 000 imm[4-0] 01000110x00000023 / mask 0x0000707FStore of a byte[rs1 + sext(imm12)]8 = rs2[7:0]Loads and stores
sc.wrd, rs2, (rs1)00011 aq rl rs2 rs1 010 rd 01011110x1800202F / mask 0xF800707FStore conditional after lr.w (A)if reserved then [rs1]32 = rs2; rd = 0 else rd = 1Atomic memory operations (A)
sext.brd, rs10110000 00100 rs1 001 rd 00100110x60401013 / mask 0xFFF0707FSign extension of a byte (Zbb)rd = sext(rs1[7:0])Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
sext.hrd, rs10110000 00101 rs1 001 rd 00100110x60501013 / mask 0xFFF0707FSign extension of a half word (Zbb)rd = sext(rs1[15:0])Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
shrs2, imm12(rs1)imm[11-5] rs2 rs1 001 imm[4-0] 01000110x00001023 / mask 0x0000707FStore of a half word[rs1 + sext(imm12)]16 = rs2[15:0]Loads and stores
sh1addrd, rs1, rs20010000 rs2 rs1 010 rd 01100110x20002033 / mask 0xFE00707FAddition with a register shifted by 1 (Zba)rd = rs2 + (rs1 << 1)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
sh2addrd, rs1, rs20010000 rs2 rs1 100 rd 01100110x20004033 / mask 0xFE00707FAddition with a register shifted by 2 (Zba)rd = rs2 + (rs1 << 2)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
sh3addrd, rs1, rs20010000 rs2 rs1 110 rd 01100110x20006033 / mask 0xFE00707FAddition with a register shifted by 3 (Zba)rd = rs2 + (rs1 << 3)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
sllrd, rs1, rs20000000 rs2 rs1 001 rd 01100110x00001033 / mask 0xFE00707FShift left by a registerrd = rs1 << rs2[4:0]Shift and rotate
sllird, rs1, shamt0000000 shamt rs1 001 rd 00100110x00001013 / mask 0xFE00707FShift left by a constantrd = rs1 << shamtShift and rotate
sltrd, rs1, rs2also shown as: sltz, sgtz0000000 rs2 rs1 010 rd 01100110x00002033 / mask 0xFE00707FSigned comparison: 1 if lessrd = (rs1 <s rs2) ? 1 : 0Compare and exchange
sltird, rs1, imm12imm[11-0] rs1 010 rd 00100110x00002013 / mask 0x0000707FSigned comparison with a constant: 1 if lessrd = (rs1 <s sext(imm12)) ? 1 : 0Compare and exchange
sltiurd, rs1, imm12also shown as: seqzimm[11-0] rs1 011 rd 00100110x00003013 / mask 0x0000707FUnsigned comparison with a constant: 1 if lessrd = (rs1 <u sext(imm12)) ? 1 : 0Compare and exchange
slturd, rs1, rs2also shown as: snez0000000 rs2 rs1 011 rd 01100110x00003033 / mask 0xFE00707FUnsigned comparison: 1 if lessrd = (rs1 <u rs2) ? 1 : 0Compare and exchange
srard, rs1, rs20100000 rs2 rs1 101 rd 01100110x40005033 / mask 0xFE00707FShift right signed by a registerrd = rs1 >>s rs2[4:0]Shift and rotate
sraird, rs1, shamt0100000 shamt rs1 101 rd 00100110x40005013 / mask 0xFE00707FShift right signed by a constantrd = rs1 >>s shamtShift and rotate
sret0001000 00010 00000 000 00000 11100110x10200073 / mask 0xFFFFFFFFReturn from an exception in supervisor modepc = sepc; restore the mode from sstatusSystem and privileged
srlrd, rs1, rs20000000 rs2 rs1 101 rd 01100110x00005033 / mask 0xFE00707FShift right unsigned by a registerrd = rs1 >>u rs2[4:0]Shift and rotate
srlird, rs1, shamt0000000 shamt rs1 101 rd 00100110x00005013 / mask 0xFE00707FShift right unsigned by a constantrd = rs1 >>u shamtShift and rotate
subrd, rs1, rs2also shown as: neg0100000 rs2 rs1 000 rd 01100110x40000033 / mask 0xFE00707FSubtraction of two registersrd = rs1 - rs2Arithmetic
swrs2, imm12(rs1)imm[11-5] rs2 rs1 010 imm[4-0] 01000110x00002023 / mask 0x0000707FStore of a word[rs1 + sext(imm12)]32 = rs2Loads and stores
unziprd, rs1000010001111 rs1 101 rd 00100110x08F05013 / mask 0xFFF0707FDeinterleaving into even and odd bits (Zbkb)rd[i] = rs1[2i]; rd[i+16] = rs1[2i+1]Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
wfi0001000 00101 00000 000 00000 11100110x10500073 / mask 0xFFFFFFFFWait for an interruptpause until an interrupt is pendingSystem and privileged
xnorrd, rs1, rs20100000 rs2 rs1 100 rd 01100110x40004033 / mask 0xFE00707FInverted exclusive OR (Zbb, Zbkb)rd = ~(rs1 ^ rs2)Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
xorrd, rs1, rs20000000 rs2 rs1 100 rd 01100110x00004033 / mask 0xFE00707FExclusive ORrd = rs1 ^ rs2Logic and bits
xorird, rs1, imm12also shown as: notimm[11-0] rs1 100 rd 00100110x00004013 / mask 0x0000707FExclusive OR with a constantrd = rs1 ^ sext(imm12)Logic and bits
zext.hrd, rs10000100 00000 rs1 100 rd 01100110x08004033 / mask 0xFFF0707FZero extension of a half word (Zbb)rd = zext(rs1[15:0])Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)
ziprd, rs1000010001111 rs1 001 rd 00100110x08F01013 / mask 0xFFF0707FInterleaving of the bits of the two half words (Zbkb)rd[2i] = rs1[i]; rd[2i+1] = rs1[i+16]Bit manipulation (Zba, Zbb, Zbs, Zbc, Zbkb)