RISC-V rdtimeh Pseudo-Instruction Details
Assembler pseudo-instructionRead-timeh-counter pseudo-instruction, expanding to csrrs rd, timeh, x0. On RV32 it reads the high 32 bits of time; 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 timeh CSR access form exists on RV32
- The meaning and availability of the time counter are platform-defined.
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 rdtimeh a real RISC-V instruction?
rdtimeh 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 rdtimeh?
The h-suffixed form is mainly for RV32 reads of the high half of a 64-bit counter