Compare at the destination width when lowering CMP #82
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/83"
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-21T15:41:11Z.
Change
lower()intools/ffx_version_query.pyemitted CMP as a comparison against the raw iced immediate. iced reports 8-bit immediates sign-extended to 32 or 16 bits as 64-bit values, socmp ecx,-1becamestatic_cast<uint32_t>(rcx) == 18446744073709551615ull: the zero flag could never be set and the carry flag was always set. Anyje/jae/cmovbeafter acmp r32,-Ntook the wrong path. CMP now casts both operands to the destination width, matching the existing ADD/SUB/AND handling and the imm8 masking incpu_leaf_aot.The
cpu_aot_heap_layoutfixture gains anindex_guardexport (cmp ecx,-1/je,cmp ecx,-3/jae) that the native and lifted libraries must agree on.Verification
On Linux, the fixture DLL was assembled with
llvm-ml -m64and linked withlld-link /dll /noentry, thentests/cpu/heap_layout.py emitran and the lifted C++ was built with g++:AssertionError: lifted.so: index guard returned 0xfffffffd for 0xfffffffdcpu_aot_version_querylifted fixture still passes through the same pipeline.Windows:
ctest --preset dev --no-tests=error -R '^cpu_aot_heap_layout$' -Vatf59e684on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.12, RTX 5080 (driver 32.0.16.1692): passed, with ML64 and MSVC building the native and lifted libraries. The Windows CI job also passed: https://github.com/R0Y00/Xbox2Windows/actions/runs/44920496026.Evidence and follow-up
The new fixture function is original source in
tests/cpu/heap_layout.asm(MIT). No game files were used. The lowerer is shared by the FidelityFX device-init, create-context and provider-loop translations, so regenerating those outputs picks up the corrected comparison. Whether the pinned package images contain acmp r32,-Non these paths has not been checked.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T15:46:32Z.
Thanks for the CMP width fix. #88 touched the same lowerer. Please sync with main, rerun the native/lifted regression, and mark ready when the results agree.