Repository navigation
Conversation
The integer lifter now lowers movsb/movsw/movsd/movsq and stosb/stosw/stosd/stosq, with and without rep, plus cld. Elements are copied one at a time from low to high addresses, so a forward-overlapping copy repeats its first element as the hardware does instead of acting like memmove. rep counts RCX down to zero; RSI and RDI advance by the element size. cld lowers to nothing because the Windows x64 ABI enters with DF clear. std, repne, 32-bit address-size forms, FS/GS sources, cmps, scas, lods and the SSE movsd (same mnemonic, register operands) stay rejected. cpu_aot_string_ops builds ten MASM exports and compares memory, final RCX and the RSI/RDI advances against the native DLL and a sequential reference (385 cases, 36 forward-overlap cases asserted to differ from memmove). AI-assisted (Claude Code).
Contributor
Author
|
Closing as a duplicate of #368, which lowers the same forward |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
This advances integer-lifter coverage for CPU code: compilers emit
rep movsandrep stosfor inlinememcpyandmemsetand for struct copies. It touches only the sharedlowerdispatch intools/ffx_version_query.py. The new branch keys onMEMORY_ESRDIoperands, so it cannot catch the SSEmovsd. No open PR claims string instructions (#326 ismovsx, #364 ispmovsx/pmovzx), and no prerequisite PR is needed.movsb,movsw,movsd,movsq,stosb,stosw,stosd,stosq, with and withoutrep:memmove.repcounts RCX down to zero. RSI and RDI advance by the element size. Flags are unchanged.cld: lowers to nothing, because the Windows x64 ABI enters with DF clear and only forward strings are lowered.std(backward strings);repneon a move or store;67prefix, ESI/EDI);cmps,scas,lods;movsd, which shares the mnemonic but has register operands.Tests
tests/cpu/string_ops.asm: ten MASM exports.repforms of all eight instructions, plus onemovsqand onestosdwithoutrep.(dst, src_or_value, count)and returns((final RCX << 20) + RSI advance) << 20 + RDI advance, so the counter and both pointer advances are observed as well as memory.tests/cpu/string_ops.py: compares the native DLL, the translated DLL and an independent sequential Python model, on the full 512-byte buffer and the return value.memmoveof the same range, so a block-copy lowering cannot pass.repne movsb,rep movsbandstosbwith a67prefix, FSmovsb,std,repe cmpsb,lodsb,repne scasband SSEmovsd xmm0, xmm1, each with its exact diagnostic.tools/form_coverage.pymapsstring_opstocpu_aot_string_ops, and x64 coverage goes from 55 of 948 forms on9bdbb20to 64 atbd00df2(the eight string forms pluscld), measured withtools/form_coverage.pyover the JUnit ofctest --preset dev -R '^cpu_'.Verification
Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, Python 3.13.14 with iced-x86 1.21.0. Commit
bd00df2(rebased on9bdbb20).Mutation check (local, reverted): lowering
rep movsas a singlememmovefails at the first forward-overlap case:Full suite (
ctest --preset dev --no-tests=error), rebased on9bdbb20:bvh_wave64_warp,wave_shuffle_warp), 1 failed. ctest prints99% tests passed, 1 tests failed out of 147because it counts the skips as not failed.gpu_alias_lookup_writes_hardwarefails on the RX 9070 XT (driver 32.0.32015.7029). It is a GPU atomics test that arrived with gpu: skip the title-address write fixture where array atomics are inexact #332, and this change does not touch it. I reported it with measurements in gpu_alias_lookup_writes_hardware: array atomics probe reads 256 per buffer on RX 9070 XT #369.Before the rebase, on
bc24dfd, the suite gave 145 passed and the same two skips, with no failures. All 43cpu_tests pass atbd00df2.tests/form_coverage_check.pypasses.Checklist
docs/experiments.mdis updated.AI-assisted (Claude Code).