Skip to content

fpu: round integer-to-float conversions with RMM ties-away - #269

Open
carlosqwqqwq wants to merge 1 commit into
LekKit:stagingfrom
carlosqwqqwq:fix/fcvt-int2float-rmm
Open

fpu: round integer-to-float conversions with RMM ties-away#269
carlosqwqqwq wants to merge 1 commit into
LekKit:stagingfrom
carlosqwqqwq:fix/fcvt-int2float-rmm

Conversation

@carlosqwqqwq

Copy link
Copy Markdown

fpu: round integer-to-float conversions with RMM ties-away

Fixes #264

Commit message

fpu: round integer-to-float conversions with RMM ties-away

Description

The integer-to-float conversions (fcvt.s.w[u]/l[u], fcvt.d.w[u]/l[u]) use plain host casts, which only provide RNE. Under RMM (static rm=RMM or dyn + frm=RMM) the exact-halfway cases must round away from zero; the current code returns the RNE neighbour. Add magnitude-based RMM conversion helpers in src/util/fpu_lib.h (exact for inputs that fit, otherwise one rounded significand with ties-away and explicit NX), and select them from src/cpu/riscv_fpu.c when the effective mode is RMM. fcvt.d.l also now passes the resolved dynamic mode to the existing fpu_round_i64_to_f64. This is a separate source path from the float-to-integer conversion fix (the conversion direction and helpers differ), from the arithmetic RMM synthesis, and from the FMA rounding repairs.

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.

RV64 fcvt.* rounds exact halfway inputs as RNE under RMM

1 participant