RISC-V ISA Explorer · Bit Manipulation (Zb*)
Zbb: Basic Bitmanip
Ratified 2021-06 · version 1.0.0
Common bit and word operations such as count leading zeros, population count, min/max, rotate and sign extend.
Typical use: Bit counting, min/max and byte swapping
Open Zbb in the explorerDependencies
Required by
Instructions (25)
| Mnemonic | Name | Encoding | Match | Mask |
|---|---|---|---|---|
ANDN | AND with inverted operand | 0100000----------111-----0110011 | 0x40007033 | 0xfe00707f |
CLZ | Count leading zero bits | 011000000000-----001-----0010011 | 0x60001013 | 0xfff0707f |
CLZW | Count leading zero bits in word | 011000000000-----001-----0011011 | 0x6000101b | 0xfff0707f |
CPOP | Count set bits | 011000000010-----001-----0010011 | 0x60201013 | 0xfff0707f |
CPOPW | Count set bits in word | 011000000010-----001-----0011011 | 0x6020101b | 0xfff0707f |
CTZ | Count trailing zero bits | 011000000001-----001-----0010011 | 0x60101013 | 0xfff0707f |
CTZW | Count trailing zero bits in word | 011000000001-----001-----0011011 | 0x6010101b | 0xfff0707f |
MAX | Maximum | 0000101----------110-----0110011 | 0xa006033 | 0xfe00707f |
MAXU | Unsigned maximum | 0000101----------111-----0110011 | 0xa007033 | 0xfe00707f |
MIN | Minimum | 0000101----------100-----0110011 | 0xa004033 | 0xfe00707f |
MINU | Unsigned minimum | 0000101----------101-----0110011 | 0xa005033 | 0xfe00707f |
ORC.B | Bitware OR-combine, byte granule | 001010000111-----101-----0010011 | 0x28705013 | 0xfff0707f |
ORN | OR with inverted operand | 0100000----------110-----0110011 | 0x40006033 | 0xfe00707f |
REV8 | Byte-reverse register (RV64 encoding) | 011010111000-----101-----0010011 | 0x6b805013 | 0xfff0707f |
ROL | Rotate left (Register) | 0110000----------001-----0110011 | 0x60001033 | 0xfe00707f |
ROLW | Rotate left word (Register) | 0110000----------001-----0111011 | 0x6000103b | 0xfe00707f |
ROR | Rotate right (Register) | 0110000----------101-----0110011 | 0x60005033 | 0xfe00707f |
RORI | Rotate right (Immediate) | 011000-----------101-----0010011 | 0x60005013 | 0xfc00707f |
RORIW | Rotate right word (Immediate) | 0110000----------101-----0011011 | 0x6000501b | 0xfe00707f |
RORW | Rotate right word (Register) | 0110000----------101-----0111011 | 0x6000503b | 0xfe00707f |
SEXT.B | Sign-extend byte | 011000000100-----001-----0010011 | 0x60401013 | 0xfff0707f |
SEXT.H | Sign-extend halfword | 011000000101-----001-----0010011 | 0x60501013 | 0xfff0707f |
XNOR | Exclusive NOR | 0100000----------100-----0110011 | 0x40004033 | 0xfe00707f |
ZEXT.H | Zero-extend halfword | 000010000000-----100-----0111011 | 0x800403b | 0xfff0707f |
ZEXT.H.RV32 | 000010000000-----100-----0110011 | 0x8004033 | 0xfff0707f |