A compressed instruction is a 16-bit RISC-V instruction encoding.
It is part of the compressed extension and represents a common operation in a shorter form than the standard 32-bit instruction. Compressed mnemonics are commonly prefixed with c..
Purpose
Compressed instructions reduce code size. Only a subset of RISC-V operations has a compressed form.
Formats
Compressed instructions use a 16-bit encoding.
Some formats use a 3-bit register code instead of a 5-bit register number. These select registers x8 to x15.
Immediates are typically 6 to 11 bits wide.
The opcode is 2 bits wide.
The prime on a register name means the compressed register subset x8 to x15.
Compressed instructions can be divided into the following formats: