FSUB.D

RISC-V FSUB.D Instruction Details

Instruction ManualR-type

Double-precision floating-point subtraction: rd = rs1-rs2.

Instruction Syntax

fsub.d rd, rs1, rs2, 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

FSUB.D performs double-precision floating-point subtraction: rd = rs1 − rs2. R-type, fmt=D(01). Note: rs2 is the subtrahend, not the minuend. Inputs must be properly NaN-boxed. Rounding mode by rm. Catastrophic cancellation may occur when operands are close.

Common Usage Scenarios

Basic Arithmetic

Understand this scenario with real code like «fsub.d f0, f1, f2 # f0 = f1-f2 (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

catastrophic cancellation when operands close