PE loader: decode the AVX masked stores a Rosetta 2 fault cannot resume #1293

Open
Lucasyudi wants to merge 1 commit from upstream-pr/1303 into main
Lucasyudi commented 2026-11-24 14:31:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Lucasyudi on 2026-11-24T14:31:58Z.


First of four PRs that bring @Ahmet-Dedeler's masked-store fix for Rosetta 2 from mac-on-main-wip (b51552b, 04e9301) to main, split by the size rule. Part of #258.

Rosetta 2 runs VMASKMOVPS / PD and VPMASKMOVD / Q to memory an element at a time and resumes a fault only on the first element; a fault on a later one ends the process (rosetta error: unexpectedly need to EmulateForward on a synchronous exception). Under Wine on macOS the write watch keeps pages protected, so a title's masked store that runs into a watched page ends the run. The fix replaces each such store at image load with a call to a helper that stores one element at a time. This PR is only the decoding; nothing calls it yet.

Plan for the rest (each its own PR, stacked): 2. the helpers, call_site and their unwind data, with the tests that run each helper against the instruction itself; 3. plan, which finds the sites of an image by walking from the start of each function; 4. the loader step (XCL_MASKED_STORES, on only under Rosetta 2), the one runtime change.

What is in it

  • maskmov.rs (new): insn_len (length of an x86-64 instruction, None for what a walk must not guess at), decode / is_candidate (the four stores with any memory operand), and two unit tests, instruction_lengths and decodes_the_masked_stores. Code and tests are Ahmet's from b51552b, unchanged; only the module comment now lists what this PR has. The commit keeps him as its author.
  • lib.rs: pub mod maskmov;.

Tested

  • Apple M4 Pro, macOS 27.2.1, CrossOver 26.3, Rosetta 2. Cross-built for x86_64-pc-windows-gnu with mingw-w64 (GCC 16.2.0), Rust 1.100.0, debug; the lib test binary run under CrossOver's wine.
  • maskmov:: on this head: 2 passed, 0 failed.
  • The whole b51552b module on main 930e8b4 (cherry-picked as is): maskmov:: 7 passed, 1 ignored. The ignored one (the_instruction_itself_across_a_watched_page_boundary), run with --ignored, ends the process here as on Ahmet's M5 Pro: "a fault on the first element was resumed; now one on the fourth", then rosetta error: unexpectedly need to EmulateForward on a synchronous exception … inst_index=18.

Regression run

From @Toons29: AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, Windows 11 build 26300, release builds, scripts/smoke.ps1, the same retail title for 60 s, main 4178e88 and this head: 100 % of main's frames, 100 % of its peak commit, no crash, no device removal.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: b558ec333047102add1ba3c5ec38c594cd25c087
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1623 (PresentX 1623)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14813 MB

Nothing calls this code yet, so the pair shows only that the title runs as on main.

Not tested

  • Windows: not built with MSVC, not run. The tests are pure byte decoding and do not depend on the host.
  • cargo test --workspace as a whole (it does not finish under CrossOver, see #258).
  • Ahmet checked insn_len against Capstone on 22.4 million instructions of a retail image (in his HANDOFF notes on mac-on-main-wip); I did not repeat that.

AI use

  • Claude Code with Claude Opus 5.5 (claude-opus-5-5): split the commit, ran the tests above and wrote this description. The code and tests are Ahmet's.
<!-- greyfinch-sync:ivall/xcl:issue:5474142535 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1303). Originally posted by [Lucasyudi](https://github.com/Lucasyudi) on 2026-11-24T14:31:58Z. --- First of four PRs that bring @Ahmet-Dedeler's masked-store fix for Rosetta 2 from `mac-on-main-wip` (`b51552b`, `04e9301`) to `main`, split by the size rule. Part of #258. Rosetta 2 runs VMASKMOVPS / PD and VPMASKMOVD / Q to memory an element at a time and resumes a fault only on the first element; a fault on a later one ends the process (`rosetta error: unexpectedly need to EmulateForward on a synchronous exception`). Under Wine on macOS the write watch keeps pages protected, so a title's masked store that runs into a watched page ends the run. The fix replaces each such store at image load with a call to a helper that stores one element at a time. This PR is only the decoding; nothing calls it yet. Plan for the rest (each its own PR, stacked): 2. the helpers, `call_site` and their unwind data, with the tests that run each helper against the instruction itself; 3. `plan`, which finds the sites of an image by walking from the start of each function; 4. the loader step (`XCL_MASKED_STORES`, on only under Rosetta 2), the one runtime change. **What is in it** - `maskmov.rs` (new): `insn_len` (length of an x86-64 instruction, `None` for what a walk must not guess at), `decode` / `is_candidate` (the four stores with any memory operand), and two unit tests, `instruction_lengths` and `decodes_the_masked_stores`. Code and tests are Ahmet's from `b51552b`, unchanged; only the module comment now lists what this PR has. The commit keeps him as its author. - `lib.rs`: `pub mod maskmov;`. **Tested** - Apple M4 Pro, macOS 27.2.1, CrossOver 26.3, Rosetta 2. Cross-built for `x86_64-pc-windows-gnu` with mingw-w64 (GCC 16.2.0), Rust 1.100.0, debug; the lib test binary run under CrossOver's `wine`. - `maskmov::` on this head: 2 passed, 0 failed. - The whole `b51552b` module on `main` `930e8b4` (cherry-picked as is): `maskmov::` 7 passed, 1 ignored. The ignored one (`the_instruction_itself_across_a_watched_page_boundary`), run with `--ignored`, ends the process here as on Ahmet's M5 Pro: "a fault on the first element was resumed; now one on the fourth", then `rosetta error: unexpectedly need to EmulateForward on a synchronous exception … inst_index=18`. **Regression run** From @Toons29: AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, Windows 11 build 26300, release builds, `scripts/smoke.ps1`, the same retail title for 60 s, `main` `4178e88` and this head: 100 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: b558ec333047102add1ba3c5ec38c594cd25c087 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1623 (PresentX 1623) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14813 MB ``` Nothing calls this code yet, so the pair shows only that the title runs as on `main`. **Not tested** - Windows: not built with MSVC, not run. The tests are pure byte decoding and do not depend on the host. - `cargo test --workspace` as a whole (it does not finish under CrossOver, see #258). - Ahmet checked `insn_len` against Capstone on 22.4 million instructions of a retail image (in his HANDOFF notes on `mac-on-main-wip`); I did not repeat that. **AI use** - Claude Code with Claude Opus 5.5 (`claude-opus-5-5`): split the commit, ran the tests above and wrote this description. The code and tests are Ahmet's.
DavidM1911 commented 2026-11-24 16:07:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T15:47:02Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7136604374 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1303#issuecomment-7136604374). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T15:47:02Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib -- --test-threads=1`: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodified `main`.) Thanks!
Toons29 commented 2026-11-25 04:10:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:22:06Z.


Regression run of b558ec33 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: b558ec333047102add1ba3c5ec38c594cd25c087
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1623 (PresentX 1623)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14813 MB

Against the limits in CONTRIBUTING.md: 100 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7151848370 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1303#issuecomment-7151848370). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T03:22:06Z. --- Regression run of `b558ec33` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: b558ec333047102add1ba3c5ec38c594cd25c087 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1623 (PresentX 1623) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14813 MB ``` Against the limits in CONTRIBUTING.md: 100 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
upipibi commented 2026-11-26 05:05:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T04:41:29Z.


NVIDIA test report for b558ec3: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug.

  • cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4 (the hle::xaudio2 tests hang on this machine, on main too):
  • this PR: 700 passed, 0 failed, 21 ignored; 2 SKIPPED lines (both no wave64). The new maskmov::tests::instruction_lengths and decodes_the_masked_stores pass.

Lib tests only; no title run.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7182816944 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1303#issuecomment-7182816944). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-26T04:41:29Z. --- NVIDIA test report for `b558ec3`: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug. - `cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4` (the `hle::xaudio2` tests hang on this machine, on `main` too): - this PR: 700 passed, 0 failed, 21 ignored; 2 SKIPPED lines (both `no wave64`). The new `maskmov::tests::instruction_lengths` and `decodes_the_masked_stores` pass. Lib tests only; no title run. AI-assisted (Claude Code, Claude Opus 5.5).
Lucasyudi commented 2026-11-29 15:50:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Lucasyudi on 2026-11-29T15:50:34Z.


Thanks @upipibi for the NVIDIA run. Each part of the masked-store stack now has a run from someone other than me; it waits for a maintainer review and merges cleanly into main.

<!-- greyfinch-sync:ivall/xcl:comment:7258411124 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1303#issuecomment-7258411124). Originally posted by [Lucasyudi](https://github.com/Lucasyudi) on 2026-11-29T15:50:34Z. --- Thanks @upipibi for the NVIDIA run. Each part of the masked-store stack now has a run from someone other than me; it waits for a maintainer review and merges cleanly into `main`.
saintwolf commented 2026-11-30 15:48:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T15:48:25Z.


merge-check claim
head: b558ec3330

<!-- greyfinch-sync:ivall/xcl:comment:7283620703 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1303#issuecomment-7283620703). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-30T15:48:25Z. --- merge-check claim head: b558ec333047102add1ba3c5ec38c594cd25c087
saintwolf commented 2026-11-30 16:08:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T16:08:34Z.


merge-check
base: 9dfbe3ea66
head: b558ec3330
merge: clean (trial merge 81e0e491e8957bab91de82f15cbf24bd13216b97; git diff --check clean; +390/-0, new crates/xcl/src/maskmov.rs plus the module line in lib.rs)
build: cargo build --workspace -> ok (40 pre-existing warnings, none from the PR's file)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 2 failed, 51 ignored across 44 binaries (2887 total = base + the 2 new tests); SKIPPED: 27 (22 "no wave64" — wave32-only GPU, 2 "no heap windows", 1 "cannot disable the driver cache (Developer Mode)", 2 "no xgameruntime.dll"); both new maskmov tests pass. Failing: (1) gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, pre-existing on this machine (fails identically on base 9dfbe3ea, same "2D D16 resinfo clobbered v2/v3" assertion); (2) two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs, flaky on this machine: the same gpu_two_pass_cache_e2e.rs:584 assertion ("releasing the title PSOs releases their two-pass state", 1 vs 0) in this merged run, in two standalone reruns on the merged tree, and in two standalone reruns on a clean base worktree at 9dfbe3ea, while passing once in the base full suite; it is a cross-process test over the persistent Windows driver cache, which this card cannot disable, and the PR's module has no callers, so it cannot affect it. A follow-up full-suite rerun additionally hit the 0xc0000005 parallel-run harness abort the thread reports also on unmodified main, so the first run is the one counted.
review: read the whole diff. First step of the Rosetta 2 masked-store series (#1311 helpers, #1313 walker plan, #1344 loader step are the sibling PRs): maskmov.rs holds the Windows-independent parts — insn_len, an x86-64 instruction-length walk, and decode for the four masked stores (VMASKMOVPS/PD, VPMASKMOVD/Q) — and nothing calls the module yet, so no behaviour change. I hand-checked decode against all 16 test vectors: the VEX fields (R/X/B and the map in byte 1, W/pvvvv/L/ppp in byte 2) round-trip every register, scale, displacement and the RIP-relative form; the W bit separates D from Q; W1 of the floating-point forms, the loads (8C/2C/2D), register "destinations" and the wrong maps are all rejected; SIB index 4 without X is no index, SIB base 5 with mod 0 takes a disp32, disp8 sign-extends. insn_len's table matches its documented "must not guess" contract for the tested cases; a few two-byte opcodes (0F A0-A2, 0x91-0x9F) are read shorter than they are, which makes the walk desync or stop at None rather than invent a site — conservative, and the walker is the next PR's concern. No unsafe, no new dependencies, no stop-criteria files touched.
performance: none; a new module with no callers.
verdict: safe to merge
hardware / tool and model: RTX 4070 SUPER (driver 32.0.16.2140), Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 / OpenCode, Qwen 3.8 27B

<!-- greyfinch-sync:ivall/xcl:comment:7284182520 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1303#issuecomment-7284182520). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-30T16:08:34Z. --- merge-check base: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b head: b558ec333047102add1ba3c5ec38c594cd25c087 merge: clean (trial merge 81e0e491e8957bab91de82f15cbf24bd13216b97; git diff --check clean; +390/-0, new crates/xcl/src/maskmov.rs plus the module line in lib.rs) build: cargo build --workspace -> ok (40 pre-existing warnings, none from the PR's file) tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 2 failed, 51 ignored across 44 binaries (2887 total = base + the 2 new tests); SKIPPED: 27 (22 "no wave64" — wave32-only GPU, 2 "no heap windows", 1 "cannot disable the driver cache (Developer Mode)", 2 "no xgameruntime.dll"); both new maskmov tests pass. Failing: (1) gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, pre-existing on this machine (fails identically on base 9dfbe3ea, same "2D D16 resinfo clobbered v2/v3" assertion); (2) two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs, flaky on this machine: the same gpu_two_pass_cache_e2e.rs:584 assertion ("releasing the title PSOs releases their two-pass state", 1 vs 0) in this merged run, in two standalone reruns on the merged tree, and in two standalone reruns on a clean base worktree at 9dfbe3ea, while passing once in the base full suite; it is a cross-process test over the persistent Windows driver cache, which this card cannot disable, and the PR's module has no callers, so it cannot affect it. A follow-up full-suite rerun additionally hit the 0xc0000005 parallel-run harness abort the thread reports also on unmodified main, so the first run is the one counted. review: read the whole diff. First step of the Rosetta 2 masked-store series (#1311 helpers, #1313 walker plan, #1344 loader step are the sibling PRs): maskmov.rs holds the Windows-independent parts — insn_len, an x86-64 instruction-length walk, and decode for the four masked stores (VMASKMOVPS/PD, VPMASKMOVD/Q) — and nothing calls the module yet, so no behaviour change. I hand-checked decode against all 16 test vectors: the VEX fields (R/X/B and the map in byte 1, W/pvvvv/L/ppp in byte 2) round-trip every register, scale, displacement and the RIP-relative form; the W bit separates D from Q; W1 of the floating-point forms, the loads (8C/2C/2D), register "destinations" and the wrong maps are all rejected; SIB index 4 without X is no index, SIB base 5 with mod 0 takes a disp32, disp8 sign-extends. insn_len's table matches its documented "must not guess" contract for the tested cases; a few two-byte opcodes (0F A0-A2, 0x91-0x9F) are read shorter than they are, which makes the walk desync or stop at None rather than invent a site — conservative, and the walker is the next PR's concern. No unsafe, no new dependencies, no stop-criteria files touched. performance: none; a new module with no callers. verdict: safe to merge hardware / tool and model: RTX 4070 SUPER (driver 32.0.16.2140), Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 / OpenCode, Qwen 3.8 27B
coolpersonnn commented 2026-11-30 18:25:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-30T18:25:50Z.


merge-check claim
head: b558ec3330

<!-- greyfinch-sync:ivall/xcl:comment:7287837485 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1303#issuecomment-7287837485). Originally posted by [coolpersonnn](https://github.com/coolpersonnn) on 2026-11-30T18:25:50Z. --- merge-check claim head: b558ec333047102add1ba3c5ec38c594cd25c087
coolpersonnn commented 2026-11-30 18:32:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-30T18:32:09Z.


merge-check
base: abec7ce9ee
head: b558ec3330
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2888 passed, 0 failed, 51 ignored (25 SKIPPED: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache); failing: none; new tests maskmov::tests::instruction_lengths and maskmov::tests::decodes_the_masked_stores passed
review: none. Read the full diff (+390/-0 across crates/xcl/src/lib.rs and new file crates/xcl/src/maskmov.rs). Pure safe Rust, no unsafe, not wired into the runtime yet (foundation for stacked PRs #1311/#1313/#1344). Verified is_candidate and decode against VEX 3-byte 0F38/66 encoding for VMASKMOVPS (0x2E W0), VMASKMOVPD (0x2F W0), VPMASKMOVD (0x8E W0), VPMASKMOVQ (0x8E W1): inverted VEX R/X/B/vvvv bits, W=1 rejection on FP forms, SIB index=4 (none) vs R12, SIB base=5 mod=0 (disp32 without base), and RIP-relative mod=0 rm=5 are all handled accurately. Verified insn_len prefix/REX/VEX/0F/0F38/0F3A/ModRM/SIB/imm/length-cap rules and rejection of EVEX/XOP/3DNow!/invalid-64-bit opcodes. Both unit tests thoroughly exercise normal, edge, truncated, and non-matching cases. Clean scope; no duplicates found in open/merged PRs or #1607.
performance: none (dead/unused library module until follow-up PRs wire it in; no runtime path touched)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5090 (driver 32.0.16.2101), AMD Ryzen 9 9950X3D, Windows 11 Pro build 26300, Rust 1.100.0 / T3 Code (Antigravity), Gemini 4 Neon (Medium)

<!-- greyfinch-sync:ivall/xcl:comment:7287991704 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1303#issuecomment-7287991704). Originally posted by [coolpersonnn](https://github.com/coolpersonnn) on 2026-11-30T18:32:09Z. --- merge-check base: abec7ce9ee2f25efe8c089ca4128ddf171c37afa head: b558ec333047102add1ba3c5ec38c594cd25c087 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2888 passed, 0 failed, 51 ignored (25 SKIPPED: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache); failing: none; new tests maskmov::tests::instruction_lengths and maskmov::tests::decodes_the_masked_stores passed review: none. Read the full diff (+390/-0 across crates/xcl/src/lib.rs and new file crates/xcl/src/maskmov.rs). Pure safe Rust, no unsafe, not wired into the runtime yet (foundation for stacked PRs #1311/#1313/#1344). Verified is_candidate and decode against VEX 3-byte 0F38/66 encoding for VMASKMOVPS (0x2E W0), VMASKMOVPD (0x2F W0), VPMASKMOVD (0x8E W0), VPMASKMOVQ (0x8E W1): inverted VEX R/X/B/vvvv bits, W=1 rejection on FP forms, SIB index=4 (none) vs R12, SIB base=5 mod=0 (disp32 without base), and RIP-relative mod=0 rm=5 are all handled accurately. Verified insn_len prefix/REX/VEX/0F/0F38/0F3A/ModRM/SIB/imm/length-cap rules and rejection of EVEX/XOP/3DNow!/invalid-64-bit opcodes. Both unit tests thoroughly exercise normal, edge, truncated, and non-matching cases. Clean scope; no duplicates found in open/merged PRs or #1607. performance: none (dead/unused library module until follow-up PRs wire it in; no runtime path touched) verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 5090 (driver 32.0.16.2101), AMD Ryzen 9 9950X3D, Windows 11 Pro build 26300, Rust 1.100.0 / T3 Code (Antigravity), Gemini 4 Neon (Medium)
Foniass commented 2026-12-01 05:22:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:22:50Z.


Triage (#1607) – head b558ec3

#1311, #1313 and #1344 share these lines because they are stacked on this PR (helpers, plan, loader step); this is the base of the stack, not a duplicate. Nothing like maskmov.rs is on main.
No problems found in the decoder (insn_len, decode). Nothing calls it yet, as the description says.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301709574 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1303#issuecomment-7301709574). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:22:50Z. --- **Triage (#1607)** – head b558ec3 #1311, #1313 and #1344 share these lines because they are stacked on this PR (helpers, `plan`, loader step); this is the base of the stack, not a duplicate. Nothing like `maskmov.rs` is on main. No problems found in the decoder (`insn_len`, `decode`). Nothing calls it yet, as the description says. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1303:upstream-pr/1303'
git switch 'upstream-pr/1303'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1303'
git switch 'upstream-pr/1303'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1303'
git switch 'upstream-pr/1303'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1303'
git switch 'main'
git merge --squash 'upstream-pr/1303'
git switch 'main'
git merge --ff-only 'upstream-pr/1303'
git switch 'main'
git merge 'upstream-pr/1303'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1293
No description provided.