fpu: round integer-to-float conversions with RMM ties-away - #269
Open
carlosqwqqwq wants to merge 1 commit into
Open
fpu: round integer-to-float conversions with RMM ties-away#269carlosqwqqwq wants to merge 1 commit into
carlosqwqqwq wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fpu: round integer-to-float conversions with RMM ties-away
Fixes #264
Commit message
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 (staticrm=RMMordyn + frm=RMM) the exact-halfway cases must round away from zero; the current code returns the RNE neighbour. Add magnitude-based RMM conversion helpers insrc/util/fpu_lib.h(exact for inputs that fit, otherwise one rounded significand with ties-away and explicitNX), and select them fromsrc/cpu/riscv_fpu.cwhen the effective mode is RMM.fcvt.d.lalso now passes the resolved dynamic mode to the existingfpu_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.