amd64: preserve XMM/YMM/ZMM register aliasing and upper-bit semantics - #45
Merged
xushiwei merged 4 commits intoOct 5, 2026
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Collaborator
|
Reviewed commit The shared backing slots model XMM/YMM/ZMM aliasing correctly. Legacy SSE writes preserve the upper bytes, VEX/EVEX writes clear them, and Validation:
Non-blocking suggestion: add the Z16/Z31 preservation cases to the permanent regression suite. This boundary is explicitly specified in the Intel SDM. The x86 execution checks used Rosetta and LLVM legalization; they do not establish native AVX512 hardware coverage. |
cpunion
approved these changes
Oct 4, 2026
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.
Go's amd64 CRC32 AVX512 path mixes XMM and ZMM views of the same register. The translator currently allocates independent XMM/YMM/ZMM storage, so writes such as
VMOVAPS X0, X10are invisible to a later read ofZ10, and a ZMM result is invisible through its XMM view. This produces incorrect IEEE CRC32 values for buffers of at least 1024 bytes and causes gzip checksum failures when the path is enabled, as observed in xgo-dev/llgo#2722.Allocate one backing slot per register number at the widest width used by the function, and share its low bytes across XMM/YMM/ZMM views. Preserve upper bytes for legacy SSE writes, clear them for VEX/EVEX writes, and implement
VZEROUPPER/VZEROALLfor registers 0–15 instead of treating them as no-ops.Refresh the strict latest-version corpus pins to compress v1.20.1 and lz4 v4.1.33, including the new lz4 amd64 assembly inventory. The updated lz4 ARM64 decoder uses
FSTPQ; implement full-width register-pair stores with offset, pre-indexed, post-indexed, and global-symbol addressing.Validation:
go test ./... -count=1passed on macOS arm64 with LLVM 22.1.8 and Go 1.27.0; the amd64 regression executables ran through Rosetta.scripts/check-arm64-plan9-corpus.shpassed after inspecting the before/after form reports and updating the baseline for exactly two newly supported FSTPQ forms. FSTPQ is also included in the native-Go-accepted family check (501 accepted instructions, zero unsupported forms).