FROUND.H

RISC-V FROUND.H Instruction Details

Instruction ManualR-type

Round a half-precision floating-point value to an integral value in the same FP format, without setting NX.

Instruction Syntax

fround.h 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.
ZfaZfhFP Precision

Instruction Behavior

FROUND.H rounds the half-precision floating-point value in f[rs1] to an integral value according to rm, but writes the result back to f[rd] in the same half-precision floating-point format. The FROUND form does not set the inexact NX flag. A signaling NaN sets NV; quiet NaNs follow the floating-point NaN result rules.

Quick Understanding & Search Notes

FROUND.H differs from FCVT by output type: FROUND.H still writes a floating-point register, with the value rounded to an integral value. FROUND deliberately does not report inexact NX.

rm selects the rounding direction, with frm supplying dynamic rounding.
Special values such as zero and infinity follow the Zfa rules; signaling NaNs still set NV.

Common Usage Scenarios

Floating-Point Rounding

Understand this scenario with real code like «fround.h f0, f1, rne # f0 = round(f1), no inexact flag».

Numeric Format Handling

Understand this scenario with real code like «fround.h f0, f1, rne # f0 = round(f1), no inexact flag».

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

FROUND does not set NX; use FROUNDNX when inexact reporting is needed.
The result is still floating-point, not an integer-register result; use FCVT for an integer result.
rm controls the direction for rounding to an integral value.

FAQ

Does FROUND.H write an integer register?

No. The result is written to floating-point register f[rd]; the floating-point value is integral.

How does FROUND.H differ from the other FROUND form?

FROUND does not set NX; FROUNDNX sets NX when inexact.