Conversation
ptitSeb
approved these changes
Sep 17, 2026
ptitSeb
left a comment
Owner
There was a problem hiding this comment.
I don't really like the coding style (with the break inside the braces of the case...
Contributor
Author
I can modify it.= . = |
The interpreter implements a number of SSE and AVX instructions using host floating-point operations, but did not apply the guest MXCSR.RC before performing them. As a result, directed rounding modes could produce results using the host's previous rounding mode. Add mxcsr_setround() to save the host rounding mode and temporarily apply the rounding mode selected by the guest MXCSR. Use it around the affected SSE and AVX arithmetic, horizontal, dot-product, conversion, and FMA interpreter paths, restoring the original host mode afterward. Add an interpreter regression test covering all four MXCSR rounding modes and representative scalar, packed, conversion, AVX, and FMA instructions. Force the test through the interpreter so that a dynarec path cannot hide interpreter rounding errors. Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
yzewei
force-pushed
the
fix-interp-mxcsr-rounding
branch
from
September 17, 2026 08:22
9fa54db to
947238a
Compare
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.
The interpreter implements many SSE and AVX instructions using host floating-point operations without synchronizing with the guest's MXCSR.RC.
mxcsr_setround()has been added to save the host rounding mode and temporarily apply the rounding mode selected by the guest's MXCSR (similar tox87_setround()). Regression tests for the interpreter have also been added, covering all four MXCSR rounding modes and a representative set of scalar, packed, conversion, AVX, and FMA instructions.