How is fcvtmod.w.d different from fcvt.w.d?
fcvtmod.w.d takes the low 32 bits of the unbounded RTZ conversion result modulo 2^32; fcvt.w.d uses the official invalid-conversion result for out-of-range integer conversion.
Modular convert double-precision float to signed word (mod 2^32)
fcvtmod.w.d is a Zfa instruction. It converts a double-precision value toward zero to an unbounded two's-complement integer, takes the low 32 bits, sign-extends to XLEN, and converts NaN and infinities to zero.
Shows the Zfa + D-extension FCVTMOD flow: decode OP-FP fields, fmt/rs2 conversion selection, fixed rm=001 (RTZ), read the floating-point source, then write the integer destination.
The word is split as an R-type OP-FP instruction; FCVTMOD uses opcode 1010011.
The current example uses fixed RTZ, takes the low 32 bits of the unbounded two's-complement result, and sign-extends them; fflags shows the NX outcome of FCVT.W.D for the same input.
The current example uses fixed RTZ, takes the low 32 bits of the unbounded two's-complement result, and sign-extends them; fflags shows the NX outcome of FCVT.W.D for the same input.
This animation shows only Zfa + D-extension FCVTMOD ISA-visible encoding, source/destination register direction, rounding field, and example fflags; it does not model FPU pipelines, exception handling, NaN payloads, or microarchitecture.
fcvtmod.w.d is a Zfa instruction. It converts a double-precision value toward zero to an unbounded two's-complement integer, takes the low 32 bits, sign-extends to XLEN, and converts NaN and infinities to zero.
Understand this scenario with real code like «fcvtmod.w.d x10, f0, rtz # RTZ, take low 32 bits, then sign-extend to XLEN».
Understand this scenario with real code like «fcvtmod.w.d x10, f0, rtz # RTZ, take low 32 bits, then sign-extend to XLEN».
Understand this scenario with real code like «fcvtmod.w.d x10, f0, rtz # RTZ, take low 32 bits, then sign-extend to XLEN».
fcvtmod.w.d takes the low 32 bits of the unbounded RTZ conversion result modulo 2^32; fcvt.w.d uses the official invalid-conversion result for out-of-range integer conversion.
Zfa requires assembly syntax to explicitly specify RTZ; other rm encodings are reserved.