Repository navigation
cpu: lower VEX.128 saturating, multiply and compare word forms - #1308
Merged
Merged
Conversation
tedin7
marked this pull request as ready for review
November 24, 2026 07:36
Collaborator
Author
|
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207) at
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
What
tools/cpu_vex_aot.pylowers ten more VEX.128 16-bit forms as explicit per-lane C++:vpaddsw,vpaddusw,vpsubsw,vpsubusw,vpmullw,vpmulhuw,vpmaxuw,vpminuw,vpcmpeqw,vpcmpgtw.tests/cpu/vex_words.asmaddssat_words,mul_minmax_wordsandcmp_words(register and memory sources, both compare operand orders).vex_words.defand the export list inCMakeLists.txtgain the three names.tests/cpu/vex_words_check.pycompares the three new functions, native and lifted, with an independent per-lane integer model, in addition to the existing native vs lifted comparison (same 4096 edge and random pairs, guard zones, aliasing, RCX == RDX, misaligned buffers).LOGICAL_SHIFTaltered build also swapsvpmulhuwforvpmulhwinmul_minmax_words. Its lifted DLL must match the altered model and differ from the original in at least one output.docs/experiments.md: supported forms, semantics note, new reference and control paragraphs.Why
These forms were rejected as unsupported. Semantics are those of the integer instructions: signed and unsigned clamps, signed vs unsigned multiply high, unsigned min/max, compare masks of all ones or zeros. They read no MXCSR bits, raise no exceptions and have no NaN or signed-zero cases. VEX.128 zeroes the upper YMM bits, which the profile never reads (unchanged). No constant folding is used.
Overlap with open PR #1188 (cpu/vex-pf-consumers): it changes
CMakeLists.txt(a different region, thecpu_vex_parityblock),docs/experiments.md(new section at the end),tools/ffx_version_query.py,tools/x87_lower.py,tests/cpu/vex_parity.*and x87 tests. It does not touchtools/cpu_vex_aot.pyortests/cpu/vex_words*. No textual conflict expected beyond possible adjacent-hunk context in the two shared files.Tested
Linux (this branch, commit 5bcba0c):
python3 -B tests/docs_links_check.pypassed;python3 -B tests/bidi_controls_check.pypassed.python -m py_compile tools/cpu_vex_aot.py tests/cpu/vex_words_check.pypassed.vex_words_check.check_rejected_encodings()(the Linux-runnable part) passed: 9 rejected encodings.vpmulhwvariant) were assembled with GNU as, run natively on an AVX2 host, lifted withcpu_vex_aot.lift, compiled with g++ and run through the check'sinputs(): native, lifted andreference()agree on all 4096 pairs for each function; the altered native differs from the original model in 4071 of 4096.vpmulhuwsigned,vpadduswunclamped,vpsubswunclamped,vpmaxuwsigned,vpcmpgtwunsigned,vpcmpeqwgiving 1) each fail the model comparison.Windows, not run locally:
The Windows MSVC/ML64 test was NOT run locally. The full
vex_words_check.pymain path needs ML64-assembled DLLs andctypes.windll, so it ran only in CI-style pieces above. The fixture was hand-mirrored to GNU as syntax for the Linux run, so the MASM source itself is unassembled until CI.