RISC-V rdinstret Pseudo-Instruction Details
Assembler pseudo-instructionRISC-V rdinstret is the pseudo-instruction for the instret CSR and expands to csrrs rd, instret, x0. It reads the low XLEN bits; instret counts instructions retired by this hart from an arbitrary past start point.
What This Pseudo Instruction Is Saving You From Writing
The assembly manual lists rdinstret as the standard counter-read spelling for csrrs rd, instret, x0.
Availability And Extension Conditions
- Zicntr depends on Zicsr
- Reads the low XLEN bits of instret
- The execution environment permits counter access
- Instructions causing synchronous exceptions, including ECALL and EBREAK, do not retire or increment instret.
How To Read The Expansion
Official References And Reading Order
This page treats pseudo-instructions as assembler-level aliases or macros: first read what real instructions they expand to, then use the official ISA manual for the behavior of those real instructions. ABI, relocation, and linker-relaxation details follow the psABI document.
When To Think Of It First
Pitfalls / Common Confusions
FAQ
Is rdinstret a real RISC-V instruction?
rdinstret is an assembler pseudo-instruction or alias, not a separate hardware opcode. The “Typical Real Expansion” section lists the official expansion, and behavior is defined by the expanded ISA instructions.
What is the main trap when using rdinstret?
Synchronously excepting instructions do not retire or increment instret; an RV32 full value needs the rdinstreth high-half read.