Repository navigation
Keep the rounded primitives from being merged across rounding-mode changes - #65
Merged
Merged
Conversation
reach2sayan
marked this pull request as draft
October 26, 2026 12:12
reach2sayan
marked this pull request as ready for review
October 26, 2026 12:17
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #65 +/- ##
===========================================
+ Coverage 82.60% 82.79% +0.18%
===========================================
Files 23 23
Lines 1006 1017 +11
Branches 410 412 +2
===========================================
+ Hits 831 842 +11
Misses 167 167
Partials 8 8
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
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.
This continues #61, by @SonnyChecksIn. In his review there, @Lastique pointed out that the merge GCC did on
sqrt"can happen with any operation, not just the square root. And on any target, not just x86".#61 fixed
sqrt; this PR does the same for the rest of the rounded primitives, usingdetail::reload_operandintroduced in #61The problem
An interval function calls the
_downand_upprimitives on the same operands, with a rounding-mode change in between. The compiler does not treat the mode change as a dependency, so it can computex + yonce and use it for both ends. The interval is then too narrow and can miss the true value.test/rounding_merge.cpp(new) checksadd,sub,mul,div,intandconvforfloat,doubleandlong double, underrounded_arith_stdandrounded_arith_opp.On
develop, with-frounding-math:develop-O2/-O3+ - * /(all types), stdconv-m32,-O2/-O3int, and opp (default policy)long double+ - * /-O2/-O3long double+ - * /-m32,-O2/-O3int-O2/-O3int_upreturns the floor-O0Changes
rounded_arith_std:+ - * /,convandintread one operand throughdetail::reload_operand, assqrtalready does after Stop g++ merging the two square roots of a point interval #61.int_downandint_upalso go throughforce_rounding, like every other primitive.long double(GCC and compatibles):force_roundingwas an identity, so nothing kept the result before the next mode change. It is now an emptyasm volatilewith a"+t"operand and a"memory"clobber.test/sqrt_rounding.cpppasses the same operand to both roots, so it also catches a merge. It now runslong doubleeverywhere except IBM double-double, which ignores the rounding mode.CI
The multiarch setup step no longer installs
qemu-user-static. Onubuntu-latest, now Ubuntu 26.04, it is a virtual package and apt fails, so the four QEMU jobs could not start. The host package was never used anyway. It registersbinfmt_mischandlers that point at the host's QEMU binaries, but the next step,bdde-multiarch, runstonistiigi/binfmt --uninstall "qemu-*", which removes them, and then--install all, which registers the QEMU binaries from that image instead.