cpu: lower unsigned and equality CMOVcc and SETcc forms #328
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!328
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/328/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Vonsek on GitHub · 2026-11-21 22:19 UTC · original
Vonsek:ag/cpu-lower-cmov-setcc→main· +265 −8 · 6 files · 4 commits · merged 2026-11-22 09:04 UTCChange
tools/ffx_version_query.pyto lower all six unsigned/equalityCMOVcc(cmove,cmovne,cmova,cmovae,cmovb,cmovbe) andSETcc(sete,setne,seta,setae,setb,setbe) instructions using the existingzeroandcarryflags, unconditionally zero-extending 32-bitCMOVccdestinations and preserving upper bytes onSETcc.tests/cpu/cmov_setcc.asm,tests/cpu/cmov_setcc.def) and differential test (tests/cpu/cmov_setcc.py) wired intoCMakeLists.txtascpu_aot_cmov_setcc, verifying all 13 exports across 1,300 cases against both the native DLL and a reference model.cmov_setcc->cpu_aot_cmov_setccintools/form_coverage.py(+9 uncovered Integer mnemonics indocs/coverage/x64_zen2.tsv) and document the test indocs/experiments.md.Verification
Tested on Windows 11 (VS 2022 Build Tools 17.14, MSVC 19.44, ML64 14.44, Windows SDK 10.0.26100, Python 3.12):
cmake --build --preset dev --target cpu_cmov_setcc_liftedfailed with:cmake --build --preset dev --target cpu_cmov_setcc_liftedsucceeded.ctest --preset dev --no-tests=error -R "^cpu_aot_cmov_setcc$" -V: passed (1300 CMOVcc and SETcc cases (cmova/ae/b/e, seta/ae/b/be/ne) matched native and translated DLLs).python -B tests/form_coverage_check.py:form coverage checks passed.Evidence and follow-up
cmova,cmovae,cmovb,cmove,seta,setae,setb,setbe,setne) todocs/coverage/x64_zen2.tsvcoverage; all are part of baseline x86-64 and require no optional CPUID gate.Checklist
@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 22:22 UTC · original · edited 2026-11-21 22:26 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
3ca133fℹ️ About Codex in GitHub
Your 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.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 22:26 UTC · original
For the newly accepted
cmova/cmovae/cmovbmemory-source forms, puttingoperand(1)inside?:skips its load when the predicate is false. x86 reads a CMOV memory source regardless of the predicate:cmp ecx, ecx; cmova eax, [r8]must fault with nullr8, but the emitted code returns normally. A Linux x64 probe confirmed this difference between native code and the generated C++. These forms previously failed translation, whereas they now silently suppress faults and corresponding exception handling. Use an unconditional, optimization-proof memory read, astools/cpu_switch_aot.pyalready does, or continue rejecting memory-source forms.Useful? React with 👍 / 👎.
@Vonsek on GitHub · 2026-11-21 22:30 UTC · original
Rebased onto
mainand added an unconditional volatileload_always<T>read forCMOVccmemory sources so the memory operand is always read regardless of the predicate, plus a check intests/cpu/cmov_setcc.py.@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 22:26 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
3ca133fd75ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".