RISC-V rdcycleh Pseudo-Instruction Details
Assembler pseudo-instructionRISC-V rdcycleh is the pseudo-instruction for the cycle high half and expands to csrrs rd, cycleh, x0. It exists only when XLEN=32 and reads bits 63 through 32 of the same 64-bit cycle counter.
What This Pseudo Instruction Is Saving You From Writing
The assembly manual's rdcycle[h] row lists the standard counter-read spelling csrrs rd, cycle[h], x0.
Availability And Extension Conditions
- RV32
- Zicntr depends on Zicsr
- cycle bits 63 through 32
- A high-low-high comparison retry obtains a valid 64-bit cycle value.
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 rdcycleh a real RISC-V instruction?
rdcycleh 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 rdcycleh?
rdcycleh exists only on RV32; a full read compares high, low, high and retries on mismatch.