RISC-V rdinstreth Pseudo-Instruction Details
Assembler pseudo-instructionRead-instreth-counter pseudo-instruction, expanding to csrrs rd, instreth, x0. On RV32 it reads the high 32 bits of instret; RV64 generally does not use the h-suffixed form.
What This Pseudo Instruction Is Saving You From Writing
Counters are read-only CSRs; the pseudo-instruction hides the fixed CSRRS rd, csr, x0 form and makes performance/time reads clearer.
Official Semantics Checklist
Availability And Extension Conditions
- RV32 high-half counter read
- The instreth CSR access form exists on RV32
- Counter read permission depends on platform and CSR access control.
How To Read The Expansion
What You May See In objdump / Disassembly
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 rdinstreth a real RISC-V instruction?
rdinstreth 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 rdinstreth?
The h-suffixed form is mainly for RV32 reads of the high half of a 64-bit counter