FMIN.D

RISC-V FMIN.D Instruction Details

Instruction ManualR-type

Return the minimum of two double-precision floating-point operands.

Instruction Syntax

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

FMIN.D returns the numerically smaller of two double-precision floating-point operands. If only one operand is NaN, it returns the non-NaN operand; if both are NaN, it returns canonical NaN. A signaling NaN sets NV, and -0.0 is less than +0.0.

Quick Understanding & Search Notes

FMIN.D's key search point is NaN handling. The ordinary form selects the non-NaN operand for a single NaN and returns canonical NaN only when both inputs are NaN.

-0.0 and +0.0 are ordered: -0.0 is less than +0.0.
The instruction does not use rm; it is a selection operation, not rounded arithmetic.

Common Usage Scenarios

Floating-Point Compare

Understand this scenario with real code like «fmin.d f0, f1, f2 # f0 = min(f1,f2)».

Numerical Computing

Understand this scenario with real code like «fmin.d f0, f1, f2 # f0 = min(f1,f2)».

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

Ordinary FMIN/FMAX returns the non-NaN operand when exactly one input is NaN.
A signaling NaN sets NV; quiet-NaN handling differs between ordinary and M forms.
-0.0 is considered less than +0.0.

FAQ

What is the main difference from the M form?

The ordinary form returns the other non-NaN operand when exactly one input is NaN; the M form returns canonical NaN if either input is NaN.

Does FMIN.D round?

No. It selects between two operands and has no rm rounding field.