FCVT.Q.D

RISC-V FCVT.Q.D Instruction Details

Instruction ManualR-type

Convert double-precision FP to quad-precision FP; the widening conversion is exact, the assembly syntax has no rm operand, and software should encode rm as RNE (000).

Instruction Syntax

fcvt.q.d rd, rs1
Operand Breakdown
Destination rd: register receiving the operation result.
Source rs1: register holding the first operand.
Source rs2: register holding the second operand.
QFloating-Point Convert

Instruction Behavior

fcvt.q.d reads a double-precision source value from FP register rs1, converts it to a quad-precision FP result, and writes FP register rd. In the OP-FP encoding, fmt=Q (11) denotes the destination format and rs2=D (01) denotes the source format; this widening conversion is exact and has no rm assembly operand.

FCVT.Q.D Decode And Execute Animation

Shows the Q-extension FCVT flow: decode OP-FP fields, fmt/rs2 conversion selection, an rm=000 encoding example, read the floating-point source, then write the floating-point destination.

rd
rs1
fcvt.q.d
,
Execution Context
fmt=Q (11)
rs2=D
rounding: example rm=000; conversion never rounds
fflags: 0
The source value is invalid and is not used for execution. The animation is using a legal FCVT.Q.D default example value.
31..27
26..25
24..20
19..15
14..12
11..7
6..0
01000
FCVT.Q
11
fmt=Q
00001
rs2=D
01011
rs1
000
rm=000 example
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0x46158553
opcode
1010011 -> OP-FP
funct5/fmt
01000 + 11 -> FCVT.Q.D
rs2
00001 -> D source
rm
000 -> example encoding; conversion never rounds
rd/rs1
fa0(f10) / fa1(f11)
read
fa1(f11) = D 1.5 (0x3FF8000000000000)
convert
D 1.5 -> Q 1.5
write
fa0(f10) = Q 1.5 (numeric Q); 0
Current Step

Fetch: show the 32-bit OP-FP encoding

The word is split as an R-type OP-FP instruction; FCVT uses opcode 1010011.

encoding: 0x46158553
syntax : fcvt.q.d fa0(f10), fa1(f11)
result : fa0(f10) = Q 1.5 (numeric Q); 0

D-to-Q is a floating-point widening conversion; the current finite example is exact, does not need rm rounding, and leaves example fflags at 0.

FCVT Conversion View
D FP source
D 1.5 (0x3FF8000000000000)
conversion
D 1.5 -> Q 1.5
writeback
fa0(f10) = Q 1.5 (numeric Q)

D-to-Q is a floating-point widening conversion; the current finite example is exact, does not need rm rounding, and leaves example fflags at 0.

This animation shows only Q-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.

Quick Understanding & Search Notes

fcvt.q.d is an FP-to-FP format conversion: rd and rs1 are FP registers, fmt encodes destination Q, and rs2 encodes source D. The widening conversion is exact, the assembly syntax has no rm operand, and software should encode rm as RNE (000).

OP-FP opcode is 1010011; funct5=01000 denotes FP-to-FP format FCVT.
fmt=11 selects destination Q (quad-precision); rs2=01 selects source D (double-precision).
rd and rs1 are both FP registers; the rs2 field is a source-format selector, not an assembly operand.
The widening conversion is exact and needs no numerical rounding; its assembly syntax has no rm operand, software should encode rm as RNE (000), and implementations still distinguish legal and reserved encodings.
With Q, FLEN=128: NaN-boxing checks the D source, while the Q destination is FLEN-wide rather than a narrower boxed writeback. The animation does not enumerate every NaN payload or special-value combination.

Common Usage Scenarios

Floating-Point Format Conversion

Understand this scenario with real code like «fcvt.q.d f0, f1 # f0 = (quad-precision)(f1 as double-precision)».

Type Conversion

Understand this scenario with real code like «fcvt.q.d f0, f1 # f0 = (quad-precision)(f1 as double-precision)».

Pre-Use Checklist

Syntax Check
  • Verify rd, rs1, rs2 (and rs3) are valid GPRs.
  • Confirm funct3 and funct7 encoding is correct.
Semantic Check
  • Check if the result affects subsequent branches or address calculations.
  • Ensure the rd register is not overwritten by another instruction.

Pitfalls / Common Confusions

fmt=Q selects the destination quad-precision format; rs2=D selects the source double-precision format and is not a second source register.
This is a floating-point widening conversion with exact official semantics; do not add an rm operand in assembly syntax.
With Q, FLEN=128: the D source must be validly NaN-boxed, while the Q destination is FLEN-wide rather than a narrower NaN-boxed result.
The animation shows finite checkable examples only; NaNs, infinities, overflow, underflow, and payload details follow the official manual text.

FAQ

Is rs2 a source register in fcvt.q.d?

No. The assembly syntax has rd, rs1 only; the encoded rs2 field selects the source D FP format.

When does fcvt.q.d use rm?

The assembly syntax has no rm operand and the exact widening result is unaffected by rounding mode; software should set the machine encoding's rm to RNE (000), while implementations still treat reserved values as reserved encodings.

How is fcvt.q.d different from integer FCVT forms?

In this form, both rd and rs1 are FP registers; W/WU/L/LU forms convert between integer and FP registers.