FMV.X.W

RISC-V FMV.X.W Instruction Details

Instruction ManualR-type

Bit-copy a single-precision floating-point encoding to an integer register.

Instruction Syntax

fmv.x.w rd, rs1
Operand Breakdown
rd/rs fields denote integer or floating-point registers depending on the direction of this instruction.
FMV forms copy bit patterns; they are not FCVT numeric conversions and do not use rm.
FFloating-Point Convert

Instruction Behavior

FMV.X.W bit-copies the single-precision floating-point encoding in f[rs1] into x[rd]; on RV64, bit 31 is copied into the upper 32 bits of the integer register. This is a bit move, not a floating-point-to-integer numeric conversion; it does not round and sets no floating-point exception flags.

Quick Understanding & Search Notes

FMV.X.W's core idea is bit-pattern movement. Use FCVT for numeric conversion and rounding; use FMV forms when preserving NaN payloads or inspecting raw encodings.

FMV instructions do not use an rm field.
A bit move does not canonicalize NaNs or change the input according to numeric value; FMV.X.W copies bit 31 into the upper 32 bits on RV64.

Common Usage Scenarios

Floating-Point Bit Move

Understand this scenario with real code like «fmv.x.w x10, f0 # x10[31:0] = f0 bits; RV64: x10[63:32]=sign».

Debugging Bit Patterns

Understand this scenario with real code like «fmv.x.w x10, f0 # x10[31:0] = f0 bits; RV64: x10[63:32]=sign».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is R-type.
  • Confirm the operand order matches the example.
Semantic Check
  • Ensure the destination register usage is compatible with the calling convention.
  • Confirm this is not the lower-level form of a pseudo-instruction expansion.

Pitfalls / Common Confusions

This is a bit copy, not an FCVT numeric conversion.
It does not use rm and does not set fflags.
The integer destination holds the encoding bit pattern; on RV64 the upper bits are sign-extended from bit 31, not a rounded integer value.

FAQ

How is FMV.X.W different from FCVT?

FMV copies the bit pattern; FCVT performs numeric conversion, can round, and can set exception flags.

Does FMV.X.W set fflags?

No. It is neither arithmetic nor numeric conversion.