FMIN.S

RISC-V FMIN.S Instruction Details

Instruction ManualR-type

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

Instruction Syntax

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

Instruction Behavior

FMIN.S selects the numerically smaller single-precision operand. Ordinary FMIN/FMAX follows the official minimumNumber/maximumNumber rules: with exactly one NaN input it returns the non-NaN operand, with two NaNs it returns canonical NaN; signaling NaN sets NV, and -0.0 is less than +0.0.

FMIN.S Decode And Execute Animation

Shows the F-extension single-precision OP-FP flow: decode fields, read FP operands, perform FMIN semantics, then write rd.

rd
rs1
rs2
fmin.s
,
,
Execution Context
FLEN=32 / fmt=S (00)
funct3: FMIN selects minimum
fflags: example fflags remains 0
31..27
26..25
24..20
19..15
14..12
11..7
6..0
00101
FMIN
00
fmt=S
01100
rs2
01011
rs1
000
funct3=000
01010
rd
1010011
OP-FP
Execution Data Path
instruction
0x28C58553
opcode
1010011 -> OP-FP
funct5/fmt
00101 + S(00) -> FMIN.S
funct3
000 -> FMIN selects minimum
rd/rs
fa0(f10) / fa1(f11) / fa2(f12)
read
-0.0, 0.0
FP op
FMIN(-0.0, 0.0) = -0.0
write
fa0(f10) = -0.0; example fflags remains 0
Current Step

Fetch: show the 32-bit OP-FP encoding

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

encoding: 0x28C58553
syntax : fmin.s fa0(f10), fa1(f11), fa2(f12)
result : fa0(f10) = -0.0; example fflags remains 0

The default example shows the official signed-zero ordering: -0.0 is less than +0.0. With NaNs, ordinary FMIN/FMAX returns the non-NaN operand for a single NaN and canonical NaN for two NaNs; signaling NaN sets NV.

Single-precision Calculation
rs1
fa1(f11) = -0.0
rs2
fa2(f12) = 0.0
result
FMIN(-0.0, 0.0) = -0.0

The default example shows the official signed-zero ordering: -0.0 is less than +0.0. With NaNs, ordinary FMIN/FMAX returns the non-NaN operand for a single NaN and canonical NaN for two NaNs; signaling NaN sets NV.

This animation shows only F-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

FMIN.S is an F-extension OP-FP selection instruction, not rounded arithmetic. The key points are how funct5/fmt/funct3 identify FMIN.S, and how NaNs and -0.0/+0.0 affect the selected result.

OP-FP opcode=1010011, funct5=00101, fmt=S, and funct3=000 identify FMIN.S.
Ordinary FMIN/FMAX returns the non-NaN operand for a single NaN; two NaNs return canonical NaN, and signaling NaN sets NV.
-0.0 is less than +0.0; the default animation example is chosen to show this official ordering rule.
There is no rm rounding operand, so the animation shows ISA-visible selection and writeback rather than a rounding path.

Common Usage Scenarios

Floating-Point Compare

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

Numerical Computing

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

Pre-Use Checklist

Syntax Check
  • 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.
Semantic Check
  • Confirm the floating-point format suffix (.H/.S/.D/.Q) matches the data width.
  • Decide whether software must inspect fflags for NV, DZ, OF, UF, or NX.

Pitfalls / Common Confusions

Ordinary FMIN/FMAX returns the non-NaN operand when exactly one input is NaN; do not confuse it with Zfa FMINM/FMAXM.
A signaling NaN sets NV; when both inputs are NaNs, the result is canonical NaN.
-0.0 is less than +0.0 by the official rule, so signed zero can change the selected result.
This instruction has no rm rounding operand; funct3 selects FMIN or FMAX.

FAQ

Does FMIN.S use the rm rounding mode?

No. The instruction uses funct3 to distinguish FMIN/FMAX and has no rm rounding operand in assembly syntax.

How does FMIN.S differ from FMINM.S?

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