cpu: lower XLATB in the shared lifter #409
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/415"
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 denn0x on 2026-11-22T00:56:55Z.
Change
Advances CPU translation coverage. XLATB is an independent problem:
lower()rejects it today, and no open PR or issue claims it. I checked the diffs of the opencpu:PRs for the mnemonic. There is no prerequisite PR.The shared interface is
lower()intools/ffx_version_query.pyandCPU_FIXTURESintools/form_coverage.py. #287, #289, #291, #326, #328, #331, #335, #368, #379, #386, #403 and #412 also extend these. This change adds oneelifbranch afterM.CALL, at an anchor none of them uses.docs/experiments.md. Both add a paragraph after the address-size paragraph. I'll rebase whichever of the two lands second.Lowering.
xlatbloads AL from RBX + AL, with AL zero-extended. Bits 8 to 63 of RAX and the flags are unchanged.address()would add all of RAX, so the branch builds the address itself.48 d7decodes to the sameXLAT_M8and lowers the same way.Fixture
tests/cpu/xlatb.asmbuilds four exports:xlat_basic,xlat_rexw(db 48h),xlat_addr32(db 67h) andxlat_twice(two lookups in a row).emitasserts the number ofXLAT_M8instructions in each export and their base register (RBX, or EBX for the 67h form).Check.
tests/cpu/xlatb.py checkcommits a page below 4 GiB, fills it with0xccand places a 256-byte permutation table in the middle.Negative controls. Three translations of the same image are mutated after lowering, and each must mismatch. A control that faults counts as a mismatch: ctypes reports the access violation as
OSError.signednoaddr32clearOn
main,lower()rejectsd7 c3withunsupported query operation at 0x1000: xlatband67 d7 c3with... xlat byte ptr [ebx].Verification
Tested at
d8c6c25on6549244. Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, Python 3.13, AMD Ryzen 7 7700.ctest --preset dev --no-tests=error --output-junit <repo>/out/test-results.xmlgives 144 passed, 1 failed and 2 capability skips (bvh_wave64_warp,wave_shuffle_warp). The run includes the GPU tests. The failure isgpu_alias_lookup_writes_hardware, the RDNA 4 array-atomics probe recorded in #369 and #383, which fails the same way onmain. This change touches no GPU code.tests/form_coverage_check.pyandtests/docs_links_check.pypass.d8c6c25in the fork'sWindows checksrun 44968451823.Coverage.
python tools/form_coverage.py out/test-results.xmlgives x64 56 of 948 forms, 55 withoutcpu_aot_xlatb. The added form isxlatb.Evidence
The fixture is synthetic and original to this repository (MIT).
docs/experiments.mddocuments the lowering, the fixture and its controls.Checklist
AI-assisted (Claude Code).