FSQRT.Q

RISC-V FSQRT.Q Instruction Details

Instruction ManualR-type

Quad-precision floating-point square root: rd = sqrt(rs1).

Instruction Syntax

fsqrt.q rd, rs1[, rm]
Operand Breakdown
rd and rs1 select FP f0–f31 or ABI names; f0 is writable and rd may overlap a source. rs2 is fixed 00000, not a source operand.
32-bit OP-FP: funct5=01011, fmt=11 (Q), opcode=1010011. Optional rm defaults to dyn; explicit rm mnemonics must be lowercase.
Requires enabled FP state and Q 2.2 (dependent on D), with FLEN=128 but no XLEN=128 requirement. Round sqrt(rs1) by rm/frm and write rd.
rm=101/110 and dynamic frm=101–111 have reserved behavior. Applicable NV and NX accrue in fflags; setting a flag does not itself trap. The animation covers finite exact inputs only.
QFloating-Point Arithmetic

Instruction Behavior

FSQRT.Q computes the quad-precision floating-point square root, rounds according to rm or the dynamic rounding mode, writes rd, and accrues applicable floating-point exception conditions in fflags.

FSQRT.Q Decode And Execute Animation

Shows the Q-extension quad-precision OP-FP flow: decode fields, read FP operands, perform FSQRT semantics, then write rd.

rd
rs1
rm
fsqrt.q
,
,

Leave rm empty to use the assembly default dyn encoding and fcsr.frm below.

Execution Context
FLEN=128 / fmt=Q (11)
rounding: RNE nearest-even
fflags: initial 0
31..27
26..25
24..20
19..15
14..12
11..7
6..0
01011
FSQRT
11
fmt=Q
00000
rs2
01011
rs1
000
rm
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0x5E058553
opcode
1010011 -> OP-FP
funct5/fmt
01011 + Q(11) -> FSQRT.Q
rm
000 -> RNE nearest-even
rd/rs
fa0(f10) / fa1(f11) / rs2=00000
read
Source registers not read yet
FP op
Awaiting Execute
write
Not written yet; initial fflags=0
Current Step

Fetch: show the 32-bit OP-FP encoding

The word is split as an R-type OP-FP instruction; quad-precision OP-FP instructions use opcode 1010011.

encoding: 0x5E058553
syntax : fsqrt.q fa0(f10), fa1(f11), rne
result : Not written yet; initial fflags=0

The default example sqrt(2.25)=1.5 is exactly representable, so example fflags remains 0.

Quad-precision Calculation
rs1
fa1(f11) = 2.25
result
Awaiting Execute

The default example sqrt(2.25)=1.5 is exactly representable, so example fflags remains 0.

Assumes the extension and FS are enabled, correctly NaN-boxed input, and initial fflags=0. Only 1, 2.25, and 9 are accepted, producing exact 1, 1.5, and 3 under every legal rounding mode with no flags set. Other inputs stop execution. rd may overlap the source and f0 accepts writes. Steps are teaching views.

This animation shows only Q-extension ISA-visible OP-FP encoding, example numeric results, and fflags relationship; it does not model FPU pipelines, latency, every IEEE 754 corner case, or microarchitecture.

Quick Understanding & Search Notes

FSQRT.Q is Q-extension quad-precision floating-point square root. It uses OP-FP encoding with funct5=01011, fmt=Q(11), and rs2 fixed to 00000; it reads the rs1 quad-precision value, rounds according to rm or dynamic frm, and writes rd.

FSQRT.Q is a unary OP-FP instruction; rs2 is encoded as 00000 and no second source register appears in the syntax.
FSQRT.Q's applicable exception flags are NV and NX, accrued in fflags.
The animation accepts only exact inputs 1, 2.25, and 9, producing 1, 1.5, and 3. With initial fflags=0, no flags are added under any legal rounding mode. Other values are not executed.
Requires Q 2.2 (dependent on D) and enabled FP state. Q extends FP registers to FLEN=128; XLEN=128 is not required.

Common Usage Scenarios

Floating Point Basic

Understand this scenario with real code like «fsqrt.q f0, f1, rne # f0 = sqrt(f1)».

Numerical Computing

Understand this scenario with real code like «fsqrt.q f0, f1, rne # f0 = sqrt(f1)».

Pre-Use Checklist

Syntax Check
  • rd and rs1 select FP f0–f31 or ABI names; f0 is writable and rd may overlap a source. rs2 is fixed 00000, not a source operand.
  • 32-bit OP-FP: funct5=01011, fmt=11 (Q), opcode=1010011. Optional rm defaults to dyn; explicit rm mnemonics must be lowercase.
Semantic Check
  • Requires enabled FP state and Q 2.2 (dependent on D), with FLEN=128 but no XLEN=128 requirement. Round sqrt(rs1) by rm/frm and write rd.
  • rm=101/110 and dynamic frm=101–111 have reserved behavior. Applicable NV and NX accrue in fflags; setting a flag does not itself trap. The animation covers finite exact inputs only.

Pitfalls / Common Confusions

Optional lowercase rm defaults to dyn; rm=111 uses frm. Static 101/110 and dynamic frm=101–111 have reserved behavior.
Floating-point exceptions accrue in fflags; setting these flags does not itself generate a trap.
FSQRT.Q's applicable exception flags are NV and NX, accrued in fflags.

FAQ

How does the encoding identify quad-precision square root?

opcode=1010011 enters OP-FP, funct5=01011 selects FSQRT, fmt=11 selects the Q quad-precision format, and rs2 is fixed to 00000.

Which exception flags can FSQRT.Q record?

FSQRT.Q's applicable exception flags are NV and NX, accrued in fflags.