compute: accept v_cmp_ne_i32 as a vcc_lo lane guard #2110

Manually merged
github merged 2 commits from gh-pr/2110/head into gh-pr/2110/base 2026-11-26 23:57:21 +00:00
Owner

@⁠Leyukaka on GitHub · 2026-11-25 00:34 UTC · original
Leyukaka:compute/v-cmp-ne-i32-guard → main · +73 −14 · 6 files · 2 commits · merged 2026-11-25 00:46 UTC

Part of #2022 (item G, v_cmp_ne_i32).

The lane guard in tools/compute_store_aot.py accepted only v_cmp_{gt,lt,ge,le}_u32_e32 vcc_lo, src0, vN before s_and_saveexec_b32. This adds integer inequality.

  • v_cmp_ne_i32_e32 vcc_lo, src0, vN: source 0 is an integer immediate, or a resolved SGPR or VGPR; source 1 is a VGPR.
  • v_cmp_ne_i32_e64 vcc_lo, src0, src1: source 1 may also be a resolved SGPR or an integer immediate.
  • The guard emits != on the two 32-bit words. Inequality is the same for signed and unsigned words, so the existing unsigned guard path serves both.
  • The unsigned ordered compares now go through the same operand parser (ALU_SOURCE / alu_word). The verified-word rule is unchanged: a word read from a source buffer or computed by ALU in the program is still refused as a guard operand.
  • Still refused: v_cmpx, destinations other than vcc_lo, source modifiers, and VGPRs beyond v255. v_cmp_ne_u32 is not added here, although its lowering would be identical.

Tests

python -B tests/compute_alu_cmp_ne_check.py   # passes

The check covers:

  • both encodings, with SGPR, immediate (-1, 0x80000000, 0) and VGPR operands;
  • refusals: VGPR/SGPR order in _e32, vcc_hi, an SGPR destination, a negated source, v_cmpx, an unset SGPR, an SGPR holding a descriptor word, v256 in source 1, an out-of-range literal, and a word computed in the program (s_add_u32) in _e64 source 1;
  • a mutation that maps ne to ==, which must change the emitted guard.

Registered as compute_alu_cmp_ne_controls and added to the pure-Python lists. The existing controls in compute_store_check.py and compute_lane_mask_check.py, which exercise the unsigned guard, still pass with the shared parser.

Negative control: against the previous tools/compute_store_aot.py, the check fails with Unsupported compute instruction: v_cmp_ne_i32_e32 vcc_lo, s3, v0.

AI-assisted.

**@⁠Leyukaka** on GitHub · 2026-11-25 00:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2110) `Leyukaka:compute/v-cmp-ne-i32-guard` → `main` · +73 −14 · 6 files · 2 commits · merged 2026-11-25 00:46 UTC Part of #2022 (item G, `v_cmp_ne_i32`). The lane guard in `tools/compute_store_aot.py` accepted only `v_cmp_{gt,lt,ge,le}_u32_e32 vcc_lo, src0, vN` before `s_and_saveexec_b32`. This adds integer inequality. - `v_cmp_ne_i32_e32 vcc_lo, src0, vN`: source 0 is an integer immediate, or a resolved SGPR or VGPR; source 1 is a VGPR. - `v_cmp_ne_i32_e64 vcc_lo, src0, src1`: source 1 may also be a resolved SGPR or an integer immediate. - The guard emits `!=` on the two 32-bit words. Inequality is the same for signed and unsigned words, so the existing unsigned guard path serves both. - The unsigned ordered compares now go through the same operand parser (`ALU_SOURCE` / `alu_word`). The verified-word rule is unchanged: a word read from a source buffer or computed by ALU in the program is still refused as a guard operand. - Still refused: `v_cmpx`, destinations other than `vcc_lo`, source modifiers, and VGPRs beyond `v255`. `v_cmp_ne_u32` is not added here, although its lowering would be identical. ## Tests ``` python -B tests/compute_alu_cmp_ne_check.py # passes ``` The check covers: - both encodings, with SGPR, immediate (`-1`, `0x80000000`, `0`) and VGPR operands; - refusals: VGPR/SGPR order in `_e32`, `vcc_hi`, an SGPR destination, a negated source, `v_cmpx`, an unset SGPR, an SGPR holding a descriptor word, `v256` in source 1, an out-of-range literal, and a word computed in the program (`s_add_u32`) in `_e64` source 1; - a mutation that maps `ne` to `==`, which must change the emitted guard. Registered as `compute_alu_cmp_ne_controls` and added to the pure-Python lists. The existing controls in `compute_store_check.py` and `compute_lane_mask_check.py`, which exercise the unsigned guard, still pass with the shared parser. Negative control: against the previous `tools/compute_store_aot.py`, the check fails with `Unsupported compute instruction: v_cmp_ne_i32_e32 vcc_lo, s3, v0`. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:57:20 +00:00
github manually merged commit c4151cacfa into gh-pr/2110/base 2026-11-26 23:57:21 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.