Repository navigation
Conversation
…ouble The single fimmMapping keyed by float64 served both FLIS (single-precision immediate) and FLID (double-precision immediate), which made progedit and the encoder disagree: progedit looked up float64(f32) (the operand rounded to float32 then widened back) while the encoder looked up the original float64 operand. A double like 1.0000000000000002 rounds to 1.0 as float32 and would pass progedit's check but fail the encoder's, producing an "unknown floating point immediate" error. Split the map into flisMapping (float32 keys) and flidMapping (float64 keys), and check each instruction in its own domain: FLIS keys on the float32 value, FLID on the float64 value. Also check NaN on float32 directly (f32 != f32) since math.IsNaN only accepts float64.
flidMapping[1] was copied from flisMapping and held the single-precision minimum positive normal (2^-126, 1.1754943508222875e-38). Per the RISC-V Zfa spec, entry 1 (the minimum positive normal value) has a numerically different value for double-precision, so flidMapping[1] must be the double-precision minimum positive normal 2^-1022 (2.2250738585072014e-308). Update the corresponding FLID test line in riscv64.s to use the double value; its encoding (index 1) is unchanged.
The Zfa fround/froundnx instructions take an explicit rounding mode in the rm field (bits 14:12), but AFROUNDS/AFROUNDNXS/AFROUNDD/AFROUNDNXD were only given rFFEncoding, which hardcoded funct3 to 0 (RNE) with no way to select another rounding mode. Wire them into the existing rounding-mode suffix mechanism used by fcvt: ParseSuffix now accepts .RNE/.RTZ/.RDN/.RUP/.RMM on the fround instructions and stores the mode in Scond, and instructionsForProg writes it into funct3, defaulting to RNE when no suffix is given (preserving the previous encoding for suffix-free fround). Add end-to-end tests for all four fround instructions across all five rounding modes.
lxq015
marked this pull request as draft
October 20, 2026 07:18
Contributor
|
This PR (HEAD: 48307c9) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/851245. Important tips:
|
Contributor
|
This PR (HEAD: 5efa00b) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/851245. Important tips:
|
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.
On rva23u64, use the Zfa FLIS/FLID instructions to materialize float
constants from the Zfa immediate table instead of loading them from
memory.
Updates #732700