When does rm matter for fcvt.h.w?
When the integer value cannot be exactly represented in the destination floating-point format, rm or dynamic frm selects the rounding direction.
Convert a signed 32-bit integer to half-precision FP, rounding according to rm or frm.
fcvt.h.w converts the signed 32-bit integer in x[rs1] to a half-precision result in f[rd]. Its OP-FP encoding uses funct5=11010, fmt=H (10), and rs2=W (00000); an inexact result rounds according to rm or dynamic frm and records applicable fflags.
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.
The word is split as an R-type OP-FP instruction; FCVT uses opcode 1010011.
The current 32-bit integer example is exactly representable as H format, so example fflags remains 0.
The current 32-bit integer example is exactly representable as H format, so example fflags remains 0.
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.w converts a signed 32-bit integer source to a half-precision floating-point result. If the value is not exactly representable, the result is rounded according to rm and written to f[rd].
Understand this scenario with real code like «fcvt.h.w f10, x11, rne ; f10 = (half)x11».
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 restrictions, and whether rounding or invalid conversion can occur.