cpu: lower 32-bit and 64-bit ADX instructions (ADCX, ADOX) and SETO #335
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!335
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/335/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:33 UTC · original
Vonsek:ag/cpu-lower-adx→main· +469 −34 · 6 files · 6 commits · merged 2026-11-22 09:15 UTCChange
OF) alongsideZFandCFintools/ffx_version_query.pyand lower 32-bit and 64-bitadcx,adox, andseto, preservingOFacrossadcxandCFacrossadoxwith zero-extending 32-bit writes.tests/cpu/adx.asm,tests/cpu/adx.def) and differential test (tests/cpu/adx.py) wired intoCMakeLists.txtascpu_aot_adxwith ahost_has_adx()CPUID leaf 7 EBX bit 19 check andSKIP_RETURN_CODE 77for hosts without ADX.adcx32_op,adcx64_op,adox32_op,adox64_op, and interleaved dual-carryadx_dual64) across 1,093 cases against both the native DLL and a reference model.adx->cpu_aot_adxintools/form_coverage.py(+2 BMI/ADX mnemonicsadcx/adox+seto) 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_adx_liftedfailed with:cmake --build --preset dev --target cpu_adx_liftedsucceeded.ctest --preset dev --no-tests=error -R "^(cpu_aot_adx|cpu_aot_bmi1|cpu_aot_shift_count|cpu_aot_version_query|cpu_aot_address_size)$" -V: 5/5 passed (1093 ADX cases (ADCX, ADOX, and interleaved dual-carry chains) matched native and translated DLLs).python -B tests/form_coverage_check.py:form coverage checks passed.Evidence and follow-up
adcx,adox) of the 16-entryBMI/ADXgroup indocs/coverage/x64_zen2.tsvalongside #286 (BMI1, merged) and #287 (BMI2).Checklist
@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 22:37 UTC · original · edited 2026-11-21 22:41 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
9a45134ℹ️ 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.
@ -629,2 +658,4 @@M.SETAE: "!carry", M.SETB: "carry", M.SETBE: "carry || zero"}[op]stmt = write(f"({cond})")elif op == M.SETO:stmt = write("overflow")@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 22:41 UTC · original
When
setooradoxfollows an existing OF-writing instruction, it can consume staleoverflow: theIMUL, one-bit shift, and BMI1 handlers never update that variable. A Linux x64 native-versus-generated-C++ check ofmov eax, 0x40000000; shl eax, 1; seto alproduced native AL=1 but lowered AL=0; feeding the same flag intoadoxalso changed the sum. Update OF for IMUL, count-one shifts, and BMI1 forms that clear it, or reject those compositions rather than silently generating incorrect results. Add composition cases to the differential fixture so these producers are checked alongside the new consumers.Useful? React with 👍 / 👎.
@Vonsek on GitHub · 2026-11-21 22:46 UTC · original
Updated
overflowinIMUL, count-1SHL/SHR/SAR, and the five OF-clearing BMI1 forms (ANDN,BEXTR,BLSI,BLSMSK,BLSR), and addedshl1_adox32,imul_seto32, andandn_clears_of32composition checks totests/cpu/adx.asmandtests/cpu/adx.py.@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 22:41 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
9a45134461ℹ️ 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".