FMAXM.S

RISC-V FMAXM.S Instruction Details

Instruction ManualR-type

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

Instruction Syntax

fmaxm.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.
ZfaFFloating-Point Arithmetic

Instruction Behavior

FMAXM.S is the Zfa single-precision IEEE 754-2019 maximum operation: if either input is NaN, the result is canonical NaN; otherwise it returns the numerically larger operand and handles -0.0 versus +0.0 as specified.

Quick Understanding & Search Notes

FMAXM.S's key search point is NaN handling. The M form is the Zfa version and returns canonical NaN if either input is 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 «fmaxm.s f10, f11, f12 ; IEEE 754-2019 max».

Numerical Computing

Understand this scenario with real code like «fmaxm.s f10, f11, f12 ; IEEE 754-2019 max».

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

Unlike ordinary FMIN/FMAX, FMINM/FMAXM returns canonical NaN if either 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 ordinary form?

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

Does FMAXM.S round?

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