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 Bit Move

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.

FMV.X.W Decode And Execute Animation

Shows the F-extension FMV bit-pattern move: decode OP-FP fields, read the source bit pattern, then write the destination without numeric conversion.

rd
rs1
fmv.x.w
,
Execution Context
fmt=S (00)
FLEN>=32
31..27
26..25
24..20
19..15
14..12
11..7
6..0
11100
funct5=to-x
00
fmt=S
00000
rs2=00000
01011
rs1
000
funct3=000
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0xE0058553
opcode
1010011 -> OP-FP
funct5/fmt
11100 + 00 -> funct7 1110000
rs2
00000 fixed for FMV.X.W
rd/rs1
a0(x10) / fa1(f11)
read bits
fa1(f11) = 0x40490FDB
bit move
copy 32-visible bits -> 0x40490FDB
write
a0(x10) = 0x40490FDB; fflags unchanged
Current Step

Fetch: show the 32-bit OP-FP encoding

The word is split as an R-type OP-FP instruction; FMV bit moves use opcode 1010011.

encoding: 0xE0058553
syntax : fmv.x.w a0(x10), fa1(f11)
result : a0(x10) = 0x40490FDB; fflags unchanged
Bit-Pattern Move View
FP source bits
0x40490FDB
unchanged payload
0x40490FDB
writeback
a0(x10) = 0x40490FDB

FMV.X.D is defined only when XLEN>=64 and writes the 64-bit double-precision encoding unchanged to the integer register without setting fflags.

This animation shows only F-extension FMV ISA-visible encoding and bit-pattern movement; it does not model FPU pipelines, numeric FP interpretation, exception handling, or microarchitecture.

Quick Understanding & Search Notes

FMV.X.W takes the 32-bit single-precision encoding from an FP register and writes it to an integer register. It preserves the raw bit pattern; on RV64 the integer result is filled in the upper 32 bits with bit 31, not zero-extended.

The OP-FP encoding uses fmt=S and fixed fields to select the FMV.X.W bit-move form.
This is a bit-pattern move: it does not use rm, round, or set floating-point exception flags.
On RV64, the upper 32 bits of x[rd] are filled from source single-precision bit 31.

Common Usage Scenarios

FP bit inspection

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

NaN payload preservation

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

raw encoding debugging

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
  • 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.
Semantic Check
  • Confirm this is bit copying, not floating/integer numeric conversion.
  • Confirm destination direction, sign-extension, or NaN-boxing rules for this FMV variant.

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

Does FMV.X.W convert a float to an integer?

No. It copies the single-precision encoding bits; use FCVT.W.S or related FCVT instructions for numeric conversion.

What are the upper 32 bits on RV64?

The official rule copies source bit 31 into the upper 32 bits of the integer register, so the result can look like a sign-extended 64-bit bit pattern.