Skip to content

fpu: round Zfa values directly to integral floating-point values - #302

Open
carlosqwqqwq wants to merge 1 commit into
LekKit:stagingfrom
carlosqwqqwq:fix/zfa-fround-integral
Open

fpu: round Zfa values directly to integral floating-point values#302
carlosqwqqwq wants to merge 1 commit into
LekKit:stagingfrom
carlosqwqqwq:fix/zfa-fround-integral

Conversation

@carlosqwqqwq

@carlosqwqqwq carlosqwqqwq commented Sep 5, 2026

Copy link
Copy Markdown

fpu: round Zfa values directly to integral floating-point values

Fixes #296

Commit message

fpu: round Zfa values directly to integral floating-point values

Description

The current fround/froundnx implementation rounds through a signed 64-bit integer and converts back. That saturates huge, infinity, and NaN inputs, raises flags from the conversion path, and makes fround set NX. Use the existing bit-exact integral-rounding helpers directly, resolve RM_DYN to the guest frm at the caller, raise NX only for the froundnx variant, and retain NV for signaling NaNs.

Validation

  • QEMU (qemu-riscv64, Zfa) preserves huge/inf/NaN inputs unmodified, sets NX only for froundnx, and raises only NV for signaling NaNs; the patched build matches on the single- and double-precision witness matrix.
  • Dynamic-rounding witnesses cover rm=dyn with frm=RNE, RDN, RUP, and RMM; the helpers receive the resolved mode rather than RM_DYN.

@carlosqwqqwq
carlosqwqqwq force-pushed the fix/zfa-fround-integral branch from b550f80 to ad9d6c2 Compare September 5, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fround/froundnx via integer conversion: wrong NX, huge/inf/NaN saturate

1 participant