rdinstreth
RISC-V rdinstreth Pseudo-Instruction Details
Assembler pseudo-instructionThe RISC-V rdinstreth pseudo-instruction expands to csrrs rd, instreth, x0 and, only on RV32, reads bits 63:32 of the instret counter.
What You Write
rdinstreth rd
Typical Real Expansion
csrrs rd, instreth, x0
What This Pseudo Instruction Is Saving You From Writing
The assembly manual names the CSRRS form for reading the instructions-retired counter as rdinstret[h].
The RISC-V rdinstreth pseudo-instruction expands to csrrs rd, instreth, x0 and, only on RV32, reads bits 63:32 of the instret counter.
Official Semantics Checklist
The rdinstreth expansion is csrrs rd, instreth, x0; on RV32 it reads the high 32 bits of instret.
rdinstreth is present only when XLEN=32; do not treat it as an RV64 instruction.
The h-suffixed form reads the high 32 bits only when XLEN=32.
Availability And Extension Conditions
Base Conditions
- Zicntr depends on Zicsr.
Notes
- rdinstreth is present only when XLEN=32; do not treat it as an RV64 instruction.
How To Read The Expansion
Step 1
The rdinstreth expansion is csrrs rd, instreth, x0; on RV32 it reads the high 32 bits of instret.
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
Read the upper half of the 64-bit instret counter on RV32.
Pitfalls / Common Confusions
rdinstreth is present only when XLEN=32; do not treat it as an RV64 instruction.
FAQ
When is rdinstreth available?
rdinstreth is present only when XLEN=32; do not treat it as an RV64 instruction.