When does rm matter for fcvt.h.lu?
When the integer value cannot be exactly represented in the destination floating-point format, rm or dynamic frm selects the rounding direction.
Convert an unsigned 64-bit integer to half-precision floating point [RV64]; rm or dynamic frm selects rounding when needed.
rd selects f0–f31; rs1 selects integer x0–x31 (x0 is always zero); rs2 selects format LU, not a second source register.
32-bit OP-FP: funct5=11010, fmt=10, rs2=00011, opcode=1010011; no immediate.
Requires RV64 Zfh; rm/frm controls conversion of a 64-bit integer to H. Optional rm defaults to dyn; reserved rounding encodings remain reserved.
Enable required extensions and FP state. Check FP-source NaN-boxing when narrower than FLEN; a narrower destination gets upper ones. Applicable exceptions accrue in fflags; setting a flag does not itself cause an FP exception trap.
fcvt.h.lu converts an unsigned 64-bit integer from x[rs1] to half precision in f[rd] on RV64. Inexact values round according to rm or dynamic frm.
Shows the Zfh-extension FCVT flow: decode OP-FP fields, fmt/rs2 conversion selection, the rm rounding field, read the integer source, then write the floating-point destination.
Leave rm empty for the assembly default dyn (111); this DYN example fixes frm=RNE. Use lowercase rne/rtz/rdn/rup/rmm/dyn only.
Assume required extensions and FP state are enabled, applicable source NaN-boxing is valid, and initial fflags=0. Results preview the current input; Writeback represents commit.
The word is split as an R-type OP-FP instruction; FCVT uses opcode 1010011.
The current 64-bit integer example is not exactly representable as H format, so the rounded example shows NX.
The current 64-bit integer example is not exactly representable as H format, so the rounded example shows NX.
This animation shows only Zfh-extension FCVT ISA-visible encoding, source/destination register direction, rounding field, and example fflags; it does not model FPU pipelines, exception handling, NaN payloads, or microarchitecture.
fcvt.h.lu reads an unsigned 64-bit integer from x[rs1], rounds to half precision according to rm or dynamic frm when needed, and writes f[rd]; this form is RV64-only.
Understand this scenario with real code like «fcvt.h.lu f0, x10, rne # 2049 -> 2048, NX; RV64, initial x10=2049, fflags=0».
When the integer value cannot be exactly represented in the destination floating-point format, rm or dynamic frm selects the rounding direction.
It differs by source/destination format, integer signedness, RV64 restriction, and whether rm/frm rounding is needed; this form sets NX when rounding changes the result and OF on half-precision range overflow.