cpu: lower 32-bit and 64-bit BMI2 instructions #283
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/287"
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-21T20:53:18Z.
Change
bzhi,mulx,pdep,pext,rorx,sarx,shlx,shrx) intools/ffx_version_query.py, preserving flags on the flag-free forms, updating ZF/CF onbzhi, zero-extending 32-bit destinations, and resolving same-destinationmulxto the high half.tests/cpu/bmi2.asm,tests/cpu/bmi2.def) and differential test (tests/cpu/bmi2.py) wired intoCMakeLists.txtascpu_aot_bmi2, verifying all 17 exports (values,bzhiZF/CF, preserved ZF/CF onrorx/shlx, and same-destinationmulx64_same) against both the native DLL and a reference model.bmi2->cpu_aot_bmi2intools/form_coverage.py(covering 8/16 of the BMI/ADX group 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_bmi2_liftedfailed with:cmake --build --preset dev --target cpu_bmi2_liftedsucceeded.ctest --preset dev --no-tests=error -R "^(cpu_aot_bmi2|cpu_aot_shift_count|cpu_aot_version_query|cpu_aot_address_size)$" -V: 4/4 passed (2249 BMI2 cases (32/64-bit values, BZHI flags, preserved flags, MULX same-dest) matched native and translated DLLs).python -B tests/form_coverage_check.py:form coverage checks passed.Evidence and follow-up
docs/coverage/x64_zen2.tsv; complements #286 (BMI1, 6 mnemonics).Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T20:59:54Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
9905644587ℹ️ 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-21T20:56:01Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
9905644ℹ️ 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:13:56Z.
Added a
host_has_bmi2()CPUID leaf 7 EBX bit 8 check in the portable lifted DLL before loading/invoking the native BMI2 fixture, exiting 77 when BMI2 is absent, and registeredSKIP_RETURN_CODE 77oncpu_aot_bmi2inCMakeLists.txt.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T20:59:54Z.
Code review location:
tests/cpu/bmi2.py; line 147On an x64 Windows host without BMI2, such as an Ivy Bridge CPU or a VM that masks the feature, the first native
bzhi32invocation raises an illegal-instruction exception. BecauseCMakeLists.txt:606-607registers this test unconditionally, the standard CPU/full suite now fails on those hosts, and the portable lifted/reference checks never run. Probe BMI2 before executing native exports and either omit the unavailable native comparison while retaining reference coverage or report a configured capability skip.AGENTS.md reference: AGENTS.md:L37-L39
Useful? React with 👍 / 👎.