FSQRT.D

RISC-V FSQRT.D Instruction Details

Instruction ManualR-type

Compute double-precision square root: rd = sqrt(rs1).

Instruction Syntax

fsqrt.d rd, rs1, rm
Operand Breakdown
rd: destination floating-point register receiving the formatted result.
rs1/rs2: source floating-point registers; arithmetic/rounding forms with rm use rm or dynamic frm for rounding mode.
DFloating-Point Arithmetic

Instruction Behavior

FSQRT.D computes the square root of the double-precision value in f[rs1], writing the result to f[rd]. R-type, fmt=D(01). Negative input (except −0) produces canonical NaN with NV set. sqrt(−0) = −0 per IEEE 754. Rounding mode by rm.

Quick Understanding & Search Notes

FSQRT.D is a floating-point arithmetic instruction. It uses the rm field for rounding mode and sets fflags exception flags according to IEEE 754/RISC-V floating-point rules.

The .D suffix uses 64-bit double precision from the D extension.
Negative operands, NaNs, and exactness are handled by floating-point square-root rules and exception flags.

Common Usage Scenarios

Numerical Computing

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

Geometry

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

Scientific Computing

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

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

negative input (including −∞) produces canonical NaN with NV; sqrt(−0)=−0 is the only exception
irrational results (√2, √3, etc.) will always set NX

FAQ

Does it raise integer exceptions?

No. Floating-point exceptions are recorded in fflags and results follow the floating-point rules.

Can rm be omitted?

Assemblers may provide a dynamic/default spelling, but the machine instruction contains a rounding-mode field.