Skip to content

riscv: avoid FMA error recovery for directed fmadd.s - #315

Open
carlosqwqqwq wants to merge 1 commit into
LekKit:stagingfrom
carlosqwqqwq:fix/fma-f32-directed
Open

riscv: avoid FMA error recovery for directed fmadd.s#315
carlosqwqqwq wants to merge 1 commit into
LekKit:stagingfrom
carlosqwqqwq:fix/fma-f32-directed

Conversation

@carlosqwqqwq

@carlosqwqqwq carlosqwqqwq commented Sep 6, 2026

Copy link
Copy Markdown

riscv: avoid FMA error recovery for directed fmadd.s

Fixes #309

Commit message

riscv: avoid FMA error recovery for directed fmadd.s

Description

The fpu_fma32 error-recovery calculation is exact only for RNE. For directed modes it can cross an f32 grid point and under-report UF. Apply the f32-specific single-rounding path, preserve the NX raised by the preceding f64 sum, and discard only the later TwoSum flags that are not guest-visible. The change is limited to src/util/fpu_lib.h; validation artifacts stay out of the source diff.

Validation

  • The witness runs on native RISC-V hardware, QEMU, and the affected RVVM build; the patched build matches both references.
  • Both the interpreter and JIT lanes were exercised, and the patched build is limited to this root.

The patch is independently applicable to the staging branch. Its scope is
finite fmadd.s directed rounding under RTZ/RDN/RUP; other FMA root causes
remain outside this patch.

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.

fmadd.s directed rounding returns wrong results and underreports UF

1 participant