cpu: lower unsigned and equality CMOVcc and SETcc forms #323
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/328"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T22:19:03Z.
Change
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
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T22:26:18Z.
Review: COMMENTED
💡 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".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T22:22:12Z.
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.
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T22:30:16Z.
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.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T22:26:19Z.
Code review location:
tools/ffx_version_query.py; line 130For 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 👍 / 👎.