FSQRT.S

RISC-V FSQRT.S Instruction Details

Instruction ManualR-type

Computes single-precision FP square root: rd = sqrt(rs1).

Instruction Syntax

fsqrt.s 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.
FFloating-Point Arithmetic

Instruction Behavior

FSQRT.S computes sqrt of single-precision value in rs1; result to rd. R-type. Negative input produces canonical NaN and sets NV flag.

Quick Understanding & Search Notes

FSQRT.S 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 .S suffix uses 32-bit single precision from the F 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.s f0, f1 # f0 = sqrt(f1) (RNE)».

Type Conversion

Understand this scenario with real code like «fsqrt.s 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 produces NaN

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.