cpu: lower 32-bit and 64-bit BMI1 bit-manipulation instructions #286
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!286
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/286/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 20:50 UTC · original
Vonsek:ag/cpu-lower-bmi1→main· +425 −0 · 7 files · 2 commits · merged 2026-11-21 22:25 UTCChange
andn,bextr,blsi,blsmsk,blsr,tzcnt) intools/ffx_version_query.py, preserving zero-extending 32-bit writes and exact ZF/CF flag updates.tests/cpu/bmi1.asm,tests/cpu/bmi1.def) and differential test (tests/cpu/bmi1.py) wired intoCMakeLists.txtascpu_aot_bmi1, checking all 12 exports (32-bit and 64-bit) for both values and observed ZF/CF flags plus a 16-bittzcntrejection control.bmi1->cpu_aot_bmi1intools/form_coverage.py(raising BMI/ADX x64 Zen 2 form coverage from 0/16 to 6/16) 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_bmi1_liftedfailed with:cmake --build --preset dev --target cpu_bmi1_liftedsucceeded.ctest --preset dev --no-tests=error -R "^(cpu_aot_bmi1|cpu_aot_shift_count|cpu_aot_version_query|cpu_aot_address_size)$" -V: 4/4 passed (1054 binary and 136 unary BMI1 cases (values + ZF/CF) matched native and translated DLLs).python -B tests/form_coverage_check.py:form coverage checks passed.Evidence and follow-up
andn,bextr,blsi,blsmsk,blsr,tzcnt) indocs/coverage/x64_zen2.tsv; BMI2 (bzhi,mulx,pdep,pext,rorx,sarx,shlx,shrx) and ADX (adcx,adox) can follow in separate focused PRs.Checklist
@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 20:53 UTC · original · edited 2026-11-21 20:56 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
1c2755cℹ️ 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.
@R0Y00 on GitHub · 2026-11-21 20:56 UTC · original
The new CTest invokes native BMI1 exports unconditionally. BMI1 is optional on supported x64 Windows hosts, so an older CPU can fault before producing a comparison. Please check CPUID BMI1 before calling the native fixture and register a capability skip for unsupported hosts. Preserve the differential and 16-bit rejection controls on BMI1-capable machines.
@Vonsek on GitHub · 2026-11-21 22:12 UTC · original
Added a
host_has_bmi1()CPUID leaf 7 EBX bit 3 check in the portable lifted DLL before loading/invoking the native BMI1 fixture, exiting 77 when BMI1 is absent, and registeredSKIP_RETURN_CODE 77oncpu_aot_bmi1inCMakeLists.txt. Differential and 16-bit rejection controls remain unchanged on BMI1-capable hosts.