Repository navigation
[AUTOMATED] Preserve intermediate rounding in integer-to-float conversions - #1071
Merged
Merged
Conversation
thotypous
force-pushed
the
fix/integer-float-rounding
branch
from
October 14, 2026 03:31
1e192e6 to
3785f2e
Compare
…sions Keep potentially inexact integer conversion intermediates during float cast folding. Require exactness at both widths before subfloat tracing moves an integer conversion through other consumers. Add independent SPARC32/SPARC64 stages and a native GCC/Clang emitted-C roundtrip covering widening, double rounding, and later truncation. Re-record only the three new stage assertions; stock 675 and stages 2820 parity, full Rust 8657 tests, spec ownership, and 64 tooling tests pass.
thotypous
force-pushed
the
fix/integer-float-rounding
branch
from
October 14, 2026 10:11
3785f2e to
496bb0d
Compare
Resolve the stage corpus count and re-record docs/baseline-stages.json on the merged tree. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015sdZpNU5odw5dVyaxeSvvz
…ehind intfloatround The 80-bit x87 format has no float-format entry, so the exactness check declined every x87 conversion: on glibc's i386 libm 116 of 827 functions moved, nearly all from `1.0 < ABS(a0)` to `(long double)1 < ABS((long double)a0)` for `fld1`/`fldz` and exact `fild`s. SubfloatFlow now judges only its replacement precision (never wider than the original, so its exactness implies the original's) and a constant by its own bits, and the extended format counts 64 significant bits. That leaves 10 functions: seven regain an x87 spill's float rounding, one int64 comparison stays in long double where the narrowed form happened to be exact, and two storage comments. Because declining still moves some correct output, the check is the named option `intfloatround` in kuna_intfloatround.rs, default on (0/675 datatest assertions move; every datatest prints identically); `off` is byte-identical to main. The SPARC stage gains an off pass, and a new x87 stage pins fld1, an exact fild compare and a float spill, with an off pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015sdZpNU5odw5dVyaxeSvvz
Re-derive the option counts (301 with castnarrow), recapture the catalog fixture, regenerate docs/options.md and re-record docs/baseline-stages.json. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015sdZpNU5odw5dVyaxeSvvz
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015sdZpNU5odw5dVyaxeSvvz
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015sdZpNU5odw5dVyaxeSvvz
Contributor
|
[AUTOMATED] Before merging we added one commit on top (0ed2266), keeping your rule as the default path:
An x87 int stored to a float slot and reloaded now keeps its |
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.
A signed integer converted to float and then widened to double loses its first rounding. For
value = 16777217, these SPARC instructions return16777216.0, but the printed C returns16777217.0.Current output:
It should retain
return (float8)(float4)value;.Tests cover SPARC32 widening, SPARC64 double rounding, later truncation, exact intermediates, and same-width controls. A native x86 roundtrip compares emitted C with both rounding chains using GCC/Clang at O0/O2.
Debian: 48 ELFs, 12 architectures, 10,092 successful function comparisons. Two x87 paths regain spill rounding; three retain extended precision. No new failures or identified regressions; 61 matched timeouts/existing failures excluded.
Paired CPU timing (matched dev opt0 builds): -0.15% unaffected, +6.30% affected (128 functions each).