disasm_rdna2: decode 64-bit VOP3A and VOP3B instructions #570

Merged
Holastor merged 1 commit from upstream-pr/576 into main 2026-11-22 22:04:37 +00:00
Holastor commented 2026-11-22 13:25:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-22T13:25:31Z.


Description

This PR implements decoding of 64-bit RDNA 2 (GFX1013) vector ALU instructions (VOP3A and VOP3B, prefix 0xd4000000) in tools/disasm_rdna2.py and synchronizes native VOP3 opcodes in tools/scan_unsupported_shaders.py.

Background & Root Cause

In the RDNA 2 ISA, 64-bit vector instructions share prefix (w0 & 0xfc000000) == 0xd4000000 (bits [31:26] == 0b110101). Previously, disasm_rdna2.py lacked a decoder for this encoding, causing all 64-bit VOP3 instructions to fall through into .long (consuming only 4 bytes instead of 8 or 12).

This desynchronized the instruction stream across thousands of shaders: the second dword (w1) had bit 31 as 0, which was then falsely decoded as a 32-bit VOP2 instruction (producing ~1.8 million phantom v_vop2_00, v_vop2_02, v_vop2_20 instances and ~3 million .long 0xd5... instances in scanning).

Summary of Changes

  1. tools/disasm_rdna2.py:

    • Added complete VOP3_NATIVE_OPS table (117 native VOP3A and VOP3B opcodes from Table 83 and Table 85 of the RDNA 2 ISA manual).
    • Added VOP3A / VOP3B decoder checking (w0 & 0xfc000000) == 0xd4000000:
      • Opcode field: op = (w0 >> 16) & 0x3ff (10 bits).
      • Full mapping of wrapped formats:
        • op < 0x100: VOPC comparisons in VOP3 (e.g. v_cmp_*_e64, destination scalar register decode_s_reg(vdst), 2 sources).
        • 0x100 <= op < 0x140: VOP2 instructions in VOP3 (e.g. v_add_f32_e64, v_cndmask_b32_e64 with 3 sources, 2-source vector arithmetic).
        • 0x180 <= op < 0x200: VOP1 instructions in VOP3 (e.g. v_mov_b32_e64, v_cvt_*_e64, 1 source).
        • 0x270 <= op < 0x274: VINTRP parameter interpolation in VOP3 (v_interp_*_e64).
        • op in VOP3_NATIVE_OPS: Native 3-source and 2-source VOP3A/VOP3B forms.
      • VOP3B distinction:
        • Identifies VOP3B instructions (v_add_co_u32, v_sub_co_u32, v_subrev_co_u32, v_add_co_ci_u32, v_sub_co_ci_u32, v_subrev_co_ci_u32, v_div_scale_f32, v_div_scale_f64, v_mad_u64_u32, v_mad_i64_i32).
        • Decodes scalar destination sdst = (w0 >> 8) & 0x7f (decode_s_reg(sdst)).
      • 32-bit literal support:
        • Consumes trailing 32-bit dword (12 bytes total) when src0 == 255, src1 == 255, or src2 == 255.
        • Proper boundary checks returning vop3_truncated if incomplete.
      • Preserves modifiers:
        • Operand input modifiers: abs (|src|), neg (-src), and combined (-|src|).
        • Output modifiers: clamp (w0[15]), omod (mul:2, mul:4, div:2), and op_sel (op_sel:[s0,s1,s2]).
  2. tools/scan_unsupported_shaders.py:

    • Added all native VOP3A and VOP3B base opcode names to KNOWN_RDNA2_BASE_OPCODES so that is_opcode_recognized() and classify_isa_category() identify them as valid VOP / VALU (Vector ALU - VOP1/VOP2/VOP3).
  3. tests/rdna2_tools_check.py:

    • Added golden vectors in test_golden_vectors:
      • Native 3-source VOP3A: v_fma_f32 v0, v1, v2, v3 (00004bd501050e04)
      • VOP2 with clamp: v_mul_f32_e64 v12, v12, 1.0 clamp (0c8008d50ce50100)
      • VOPC with negation: v_cmp_lt_f32_e64 s0, -s44, -v18 (000001d42c240260)
      • 3-source conditional mask: v_cndmask_b32_e64 v14, 0, 1.0, s0 (0e0001d580e40100)
      • VOP3B with SDST: v_add_co_u32 v1, s0, v2, v3 (01000fd702070200)
      • 12-byte instruction with literal: v_fma_f32 v5, v1, 0x3f800000, v2 (05004bd501ff09040000803f)
      • Input abs and output omod: v_add_f32_e64 v3, |v1|, v2 mul:2 (030103d501050208)
      • Operand select: v_cmp_lt_i16_e64 s52, s44, v18 op_sel:[1,0,0] (340889d42c240200)
    • Added test_vop3_opcode_table_synthetic_forms:
      • Iterates over all 117 native VOP3 opcodes, validating decoding to expected canonical names, length 8, and valid syntax.
      • Validates scanner recognition and category assignment.
    • Added test_vop3_distinguishes_non_default_modifiers:
      • Verifies that abs, neg, clamp, omod, and op_sel all produce distinct, non-colliding disassembled strings for identical register operands.
    • Added stream alignment verification for 12-byte VOP3 literals followed by s_endpgm in test_literal_operands_keep_stream_aligned.
    • Added truncated instruction and literal handling in bad_hex checks.
    • Added representative VOP3 instructions to fixture_instructions in test_llvm_comparison.

Verification

Commit under test: ee49597

python -B tests/rdna2_tools_check.py
# Result: Ran 44 tests in 0.751s - OK (skipped=1)

python -B tests/pixel_aot_check.py
# Result: 0 (all assertion checks passed)

python -B tests/shader_probe_check.py
# Result: Scanned 2/2 files (2 valid shaders) - 10 passed

python -B tests/pso_readiness_check.py
# Result: PSO census, evidence states, and native hash control passed

python -B tests/form_coverage_check.py
# Result: form coverage checks passed

python -B tests/docs_links_check.py
# Result: Checked 10 Markdown files and 117 links - Self-test passed

python -B tests/bidi_controls_check.py
# Result: Checked 530 tracked source, script and build/CI files: no bidirectional controls
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6542923192 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/576). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-22T13:25:31Z. --- ## Description This PR implements decoding of 64-bit RDNA 2 (GFX1013) vector ALU instructions (`VOP3A` and `VOP3B`, prefix `0xd4000000`) in `tools/disasm_rdna2.py` and synchronizes native VOP3 opcodes in `tools/scan_unsupported_shaders.py`. ### Background & Root Cause In the RDNA 2 ISA, 64-bit vector instructions share prefix `(w0 & 0xfc000000) == 0xd4000000` (bits `[31:26] == 0b110101`). Previously, `disasm_rdna2.py` lacked a decoder for this encoding, causing all 64-bit VOP3 instructions to fall through into `.long` (consuming only 4 bytes instead of 8 or 12). This desynchronized the instruction stream across thousands of shaders: the second dword (`w1`) had bit 31 as 0, which was then falsely decoded as a 32-bit VOP2 instruction (producing ~1.8 million phantom `v_vop2_00`, `v_vop2_02`, `v_vop2_20` instances and ~3 million `.long 0xd5...` instances in scanning). ### Summary of Changes 1. **`tools/disasm_rdna2.py`**: - Added complete `VOP3_NATIVE_OPS` table (117 native VOP3A and VOP3B opcodes from Table 83 and Table 85 of the RDNA 2 ISA manual). - Added `VOP3A / VOP3B` decoder checking `(w0 & 0xfc000000) == 0xd4000000`: - Opcode field: `op = (w0 >> 16) & 0x3ff` (10 bits). - Full mapping of wrapped formats: - `op < 0x100`: VOPC comparisons in VOP3 (e.g. `v_cmp_*_e64`, destination scalar register `decode_s_reg(vdst)`, 2 sources). - `0x100 <= op < 0x140`: VOP2 instructions in VOP3 (e.g. `v_add_f32_e64`, `v_cndmask_b32_e64` with 3 sources, 2-source vector arithmetic). - `0x180 <= op < 0x200`: VOP1 instructions in VOP3 (e.g. `v_mov_b32_e64`, `v_cvt_*_e64`, 1 source). - `0x270 <= op < 0x274`: VINTRP parameter interpolation in VOP3 (`v_interp_*_e64`). - `op in VOP3_NATIVE_OPS`: Native 3-source and 2-source VOP3A/VOP3B forms. - VOP3B distinction: - Identifies VOP3B instructions (`v_add_co_u32`, `v_sub_co_u32`, `v_subrev_co_u32`, `v_add_co_ci_u32`, `v_sub_co_ci_u32`, `v_subrev_co_ci_u32`, `v_div_scale_f32`, `v_div_scale_f64`, `v_mad_u64_u32`, `v_mad_i64_i32`). - Decodes scalar destination `sdst = (w0 >> 8) & 0x7f` (`decode_s_reg(sdst)`). - 32-bit literal support: - Consumes trailing 32-bit dword (12 bytes total) when `src0 == 255`, `src1 == 255`, or `src2 == 255`. - Proper boundary checks returning `vop3_truncated` if incomplete. - Preserves modifiers: - Operand input modifiers: `abs` (`|src|`), `neg` (`-src`), and combined (`-|src|`). - Output modifiers: `clamp` (`w0[15]`), `omod` (`mul:2`, `mul:4`, `div:2`), and `op_sel` (`op_sel:[s0,s1,s2]`). 2. **`tools/scan_unsupported_shaders.py`**: - Added all native VOP3A and VOP3B base opcode names to `KNOWN_RDNA2_BASE_OPCODES` so that `is_opcode_recognized()` and `classify_isa_category()` identify them as valid `VOP / VALU (Vector ALU - VOP1/VOP2/VOP3)`. 3. **`tests/rdna2_tools_check.py`**: - Added golden vectors in `test_golden_vectors`: - Native 3-source VOP3A: `v_fma_f32 v0, v1, v2, v3` (`00004bd501050e04`) - VOP2 with clamp: `v_mul_f32_e64 v12, v12, 1.0 clamp` (`0c8008d50ce50100`) - VOPC with negation: `v_cmp_lt_f32_e64 s0, -s44, -v18` (`000001d42c240260`) - 3-source conditional mask: `v_cndmask_b32_e64 v14, 0, 1.0, s0` (`0e0001d580e40100`) - VOP3B with SDST: `v_add_co_u32 v1, s0, v2, v3` (`01000fd702070200`) - 12-byte instruction with literal: `v_fma_f32 v5, v1, 0x3f800000, v2` (`05004bd501ff09040000803f`) - Input abs and output omod: `v_add_f32_e64 v3, |v1|, v2 mul:2` (`030103d501050208`) - Operand select: `v_cmp_lt_i16_e64 s52, s44, v18 op_sel:[1,0,0]` (`340889d42c240200`) - Added `test_vop3_opcode_table_synthetic_forms`: - Iterates over all 117 native VOP3 opcodes, validating decoding to expected canonical names, length 8, and valid syntax. - Validates scanner recognition and category assignment. - Added `test_vop3_distinguishes_non_default_modifiers`: - Verifies that `abs`, `neg`, `clamp`, `omod`, and `op_sel` all produce distinct, non-colliding disassembled strings for identical register operands. - Added stream alignment verification for 12-byte VOP3 literals followed by `s_endpgm` in `test_literal_operands_keep_stream_aligned`. - Added truncated instruction and literal handling in `bad_hex` checks. - Added representative VOP3 instructions to `fixture_instructions` in `test_llvm_comparison`. --- ## Verification Commit under test: `ee49597` ```powershell python -B tests/rdna2_tools_check.py # Result: Ran 44 tests in 0.751s - OK (skipped=1) python -B tests/pixel_aot_check.py # Result: 0 (all assertion checks passed) python -B tests/shader_probe_check.py # Result: Scanned 2/2 files (2 valid shaders) - 10 passed python -B tests/pso_readiness_check.py # Result: PSO census, evidence states, and native hash control passed python -B tests/form_coverage_check.py # Result: form coverage checks passed python -B tests/docs_links_check.py # Result: Checked 10 Markdown files and 117 links - Self-test passed python -B tests/bidi_controls_check.py # Result: Checked 530 tracked source, script and build/CI files: no bidirectional controls ```
upstream-sync closed this pull request 2026-11-24 06:43:46 +00:00
R0Y00 commented 2026-11-24 06:48:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T14:35:11Z.


I checked 97a9eae against LLVM's GFX10 byte cases. fe0064d501050202 currently prints v_add_f64 v254, v1, v2; LLVM prints v_add_f64 v[254:255], v[1:2], v[2:3]. The destination and source widths also vary independently for conversions and mixed-width VOP3B forms. Please add opcode-specific operand widths and independent checks for those forms, or keep those forms explicitly undecoded while consuming the right instruction length. Include a following s_endpgm in the byte-stream check. The VOP3 work can proceed separately from MUBUF/MTBUF and FLAT. LLVM GFX10 disassembler cases

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7080653994 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/576#issuecomment-7080653994). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T14:35:11Z. --- I checked `97a9eae` against LLVM's GFX10 byte cases. `fe0064d501050202` currently prints `v_add_f64 v254, v1, v2`; LLVM prints `v_add_f64 v[254:255], v[1:2], v[2:3]`. The destination and source widths also vary independently for conversions and mixed-width VOP3B forms. Please add opcode-specific operand widths and independent checks for those forms, or keep those forms explicitly undecoded while consuming the right instruction length. Include a following `s_endpgm` in the byte-stream check. The VOP3 work can proceed separately from MUBUF/MTBUF and FLAT. [LLVM GFX10 disassembler cases](https://llvm.googlesource.com/llvm-project/+/refs/heads/main/llvm/test/MC/Disassembler/AMDGPU/gfx10_vop3.txt)
Holastor commented 2026-11-24 06:48:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-22T15:00:58Z.


@R0Y00 Updated in 7daf2e4:

  • Added opcode-specific operand widths across all VOP3 forms and 64-bit VOP1 opcodes:
    • 64-bit float math (v_add_f64, v_mul_f64, v_fma_f64, etc.): vector register pairs v[N:N+1] and scalar register pairs s[N:N+1].
    • Conversions: 32-to-64 bit (v_cvt_f64_i32, v_cvt_f64_u32, v_cvt_f64_f32) format 64-bit destinations and 32-bit sources; 64-to-32 bit (v_cvt_i32_f64, v_cvt_u32_f64, v_cvt_f32_f64, v_frexp_exp_i32_f64) format 32-bit destinations and 64-bit sources (both in _e32 and _e64).
    • Mixed-width operations: 64-bit shifts (v_lshlrev_b64, v_lshrrev_b64, v_ashrrev_i64) format 32-bit shift count and 64-bit input/output; v_ldexp_f64 formats 64-bit float and 32-bit exponent.
    • Mixed-width VOP3B forms: v_mad_u64_u32 / v_mad_i64_i32 format 64-bit vdst, scalar sdst, 32-bit src0/src1, and 64-bit src2; v_div_scale_f64 formats 64-bit vdst, scalar sdst, and 64-bit sources.
  • Added LLVM GFX10 MC golden cases (including fe0064d501050202 -> v_add_f64 v[254:255], v[1:2], v[2:3]).
  • Added byte-stream alignment check test_vop3_operand_widths_and_stream_alignment with mixed-width instructions, 12-byte literal, and trailing s_endpgm.
  • Synchronized KNOWN_RDNA2_BASE_OPCODES with 64-bit conversion and math opcodes.
  • Rebased onto current main.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7080976351 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/576#issuecomment-7080976351). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-22T15:00:58Z. --- @R0Y00 Updated in 7daf2e4: - Added opcode-specific operand widths across all VOP3 forms and 64-bit VOP1 opcodes: - 64-bit float math (`v_add_f64`, `v_mul_f64`, `v_fma_f64`, etc.): vector register pairs `v[N:N+1]` and scalar register pairs `s[N:N+1]`. - Conversions: 32-to-64 bit (`v_cvt_f64_i32`, `v_cvt_f64_u32`, `v_cvt_f64_f32`) format 64-bit destinations and 32-bit sources; 64-to-32 bit (`v_cvt_i32_f64`, `v_cvt_u32_f64`, `v_cvt_f32_f64`, `v_frexp_exp_i32_f64`) format 32-bit destinations and 64-bit sources (both in `_e32` and `_e64`). - Mixed-width operations: 64-bit shifts (`v_lshlrev_b64`, `v_lshrrev_b64`, `v_ashrrev_i64`) format 32-bit shift count and 64-bit input/output; `v_ldexp_f64` formats 64-bit float and 32-bit exponent. - Mixed-width VOP3B forms: `v_mad_u64_u32` / `v_mad_i64_i32` format 64-bit `vdst`, scalar `sdst`, 32-bit `src0`/`src1`, and 64-bit `src2`; `v_div_scale_f64` formats 64-bit `vdst`, scalar `sdst`, and 64-bit sources. - Added LLVM GFX10 MC golden cases (including `fe0064d501050202` -> `v_add_f64 v[254:255], v[1:2], v[2:3]`). - Added byte-stream alignment check `test_vop3_operand_widths_and_stream_alignment` with mixed-width instructions, 12-byte literal, and trailing `s_endpgm`. - Synchronized `KNOWN_RDNA2_BASE_OPCODES` with 64-bit conversion and math opcodes. - Rebased onto current `main`.
alexander-src commented 2026-11-24 06:48:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by alexander-src on 2026-11-22T15:11:50Z.


Ran a 10-bit VOP3 differential sweep (0x000..0x3ff) on 7daf2e4 against LLVM 23.1.4 (libLLVM.so, gfx1013) on Linux x64. All five local Python suites pass (rdna2_tools_check.py, pso_readiness_check.py, form_coverage_check.py, docs_links_check.py, bidi_controls_check.py), and 247 valid gfx1013 VOP3 opcodes match LLVM output exactly. The sweep flagged 23 decoded opcodes that still disagree with LLVM:

VOP1-in-VOP3 slots with swapped mnemonics or widths:

  • 0x180 (000080d502091a04): LLVM prints v_nop, PR prints v_nop v0, v2.
  • 0x1ab (0000abd502091a04): LLVM prints v_rcp_iflag_f32_e64 v0, v2, PR prints v_fract_f64_e64 v[0:1], v[2:3].
  • 0x1af (0000afd502091a04): LLVM prints v_rcp_f64_e64 v[0:1], v[2:3], PR prints v_rndne_f64_e64 v[0:1], v[2:3].
  • 0x1b1 (0000b1d502091a04): LLVM prints v_rsq_f64_e64 v[0:1], v[2:3], PR prints v_rcp_f64_e64 v[0:1], v[2:3].
  • 0x1b4 (0000b4d502091a04): LLVM prints v_sqrt_f64_e64 v[0:1], v[2:3], PR prints v_frexp_mant_f32_e64 v0, v2.
  • 0x1b9 (0000b9d502091a04): LLVM prints v_ffbh_u32_e64 v0, v2, PR prints v_sqrt_f64_e64 v[0:1], v[2:3].
  • 0x1ba (0000bad502091a04): LLVM prints v_ffbl_b32_e64 v0, v2, PR prints v_frexp_exp_i32_f64_e64 v0, v[2:3].
  • 0x1bb (0000bbd502091a04): LLVM prints v_ffbh_i32_e64 v0, v2, PR prints v_frexp_mant_f64_e64 v[0:1], v[2:3].

VOP3A / VOP3B mnemonics, arities, and register classes:

  • 0x128, 0x129, 0x12a: LLVM prints v_add_co_ci_u32_e64, v_sub_co_ci_u32_e64, v_subrev_co_ci_u32_e64; PR drops the _e64 suffix.
  • 0x140 (000040d502091a04): LLVM prints v_mad_legacy_f32, PR prints v_fma_legacy_f32.
  • 0x150 (000050d502091a04): v_mullit_f32 takes three sources (v0, v2, v4, v6); PR prints two (v0, v2, v4).
  • 0x172 (v_qsad_pk_u16_u8), 0x173 (v_mqsad_pk_u16_u8), and 0x175 (v_mqsad_u32_u8) need multi-dword register ranges (v[0:1] / v[0:3], v[2:3], v[6:7] / v[6:9]) rather than single 32-bit registers.
  • 0x342, 0x343, 0x35a (v_interp_p1ll_f16, v_interp_p1lv_f16, v_interp_p2_f16) encode attr and high fields instead of plain VGPR operands.
  • 0x360 (v_readlane_b32) writes a scalar destination (s0, not v0), and 0x361 / 0x377 / 0x378 (v_writelane_b32, v_permlane16_b32, v_permlanex16_b32) take scalar lane-selector operands.

Fixing the VOP1 table slots and either correcting the remaining multi-dword/special forms or leaving them explicitly undecoded (as @R0Y00 suggested) should get the VOP3 sweep clean against LLVM.

AI-assisted: yes (automated LLVM 23 differential check on Linux x64, reviewed before posting).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7081117404 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/576#issuecomment-7081117404). Originally posted by [alexander-src](https://github.com/alexander-src) on 2026-11-22T15:11:50Z. --- Ran a 10-bit VOP3 differential sweep (`0x000..0x3ff`) on `7daf2e4` against LLVM 23.1.4 (`libLLVM.so`, `gfx1013`) on Linux x64. All five local Python suites pass (`rdna2_tools_check.py`, `pso_readiness_check.py`, `form_coverage_check.py`, `docs_links_check.py`, `bidi_controls_check.py`), and 247 valid `gfx1013` VOP3 opcodes match LLVM output exactly. The sweep flagged 23 decoded opcodes that still disagree with LLVM: VOP1-in-VOP3 slots with swapped mnemonics or widths: - `0x180` (`000080d502091a04`): LLVM prints `v_nop`, PR prints `v_nop v0, v2`. - `0x1ab` (`0000abd502091a04`): LLVM prints `v_rcp_iflag_f32_e64 v0, v2`, PR prints `v_fract_f64_e64 v[0:1], v[2:3]`. - `0x1af` (`0000afd502091a04`): LLVM prints `v_rcp_f64_e64 v[0:1], v[2:3]`, PR prints `v_rndne_f64_e64 v[0:1], v[2:3]`. - `0x1b1` (`0000b1d502091a04`): LLVM prints `v_rsq_f64_e64 v[0:1], v[2:3]`, PR prints `v_rcp_f64_e64 v[0:1], v[2:3]`. - `0x1b4` (`0000b4d502091a04`): LLVM prints `v_sqrt_f64_e64 v[0:1], v[2:3]`, PR prints `v_frexp_mant_f32_e64 v0, v2`. - `0x1b9` (`0000b9d502091a04`): LLVM prints `v_ffbh_u32_e64 v0, v2`, PR prints `v_sqrt_f64_e64 v[0:1], v[2:3]`. - `0x1ba` (`0000bad502091a04`): LLVM prints `v_ffbl_b32_e64 v0, v2`, PR prints `v_frexp_exp_i32_f64_e64 v0, v[2:3]`. - `0x1bb` (`0000bbd502091a04`): LLVM prints `v_ffbh_i32_e64 v0, v2`, PR prints `v_frexp_mant_f64_e64 v[0:1], v[2:3]`. VOP3A / VOP3B mnemonics, arities, and register classes: - `0x128`, `0x129`, `0x12a`: LLVM prints `v_add_co_ci_u32_e64`, `v_sub_co_ci_u32_e64`, `v_subrev_co_ci_u32_e64`; PR drops the `_e64` suffix. - `0x140` (`000040d502091a04`): LLVM prints `v_mad_legacy_f32`, PR prints `v_fma_legacy_f32`. - `0x150` (`000050d502091a04`): `v_mullit_f32` takes three sources (`v0, v2, v4, v6`); PR prints two (`v0, v2, v4`). - `0x172` (`v_qsad_pk_u16_u8`), `0x173` (`v_mqsad_pk_u16_u8`), and `0x175` (`v_mqsad_u32_u8`) need multi-dword register ranges (`v[0:1]` / `v[0:3]`, `v[2:3]`, `v[6:7]` / `v[6:9]`) rather than single 32-bit registers. - `0x342`, `0x343`, `0x35a` (`v_interp_p1ll_f16`, `v_interp_p1lv_f16`, `v_interp_p2_f16`) encode `attr` and `high` fields instead of plain VGPR operands. - `0x360` (`v_readlane_b32`) writes a scalar destination (`s0`, not `v0`), and `0x361` / `0x377` / `0x378` (`v_writelane_b32`, `v_permlane16_b32`, `v_permlanex16_b32`) take scalar lane-selector operands. Fixing the VOP1 table slots and either correcting the remaining multi-dword/special forms or leaving them explicitly undecoded (as @R0Y00 suggested) should get the VOP3 sweep clean against LLVM. AI-assisted: yes (automated LLVM 23 differential check on Linux x64, reviewed before posting).
Holastor commented 2026-11-24 06:48:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-22T15:33:38Z.


Updated in 8b9e629 to resolve all 23 discrepancies flagged by the LLVM 23.1.4 (gfx1013) differential sweep:

  1. VOP1-in-VOP3 slot fixes:

    • 0x180: v_nop in VOP3 now correctly formats as v_nop without operands (arity 0).
    • Fixed swapped/mismapped slots in VOP1_OPS:
      • 0x2b (0x1ab): v_rcp_iflag_f32_e64 v0, v2
      • 0x2f (0x1af): v_rcp_f64_e64 v[0:1], v[2:3]
      • 0x31 (0x1b1): v_rsq_f64_e64 v[0:1], v[2:3]
      • 0x34 (0x1b4): v_sqrt_f64_e64 v[0:1], v[2:3]
      • 0x39 (0x1b9): v_ffbh_u32_e64 v0, v2
      • 0x3a (0x1ba): v_ffbl_b32_e64 v0, v2
      • 0x3b (0x1bb): v_ffbh_i32_e64 v0, v2
  2. VOP3A / VOP3B opcode mnemonics & arities:

    • 0x128, 0x129, 0x12a: Kept the _e64 suffix (v_add_co_ci_u32_e64, v_sub_co_ci_u32_e64, v_subrev_co_ci_u32_e64).
    • 0x140: Corrected mnemonic from v_fma_legacy_f32 to v_mad_legacy_f32.
    • 0x150: v_mullit_f32 now takes 3 sources (v0, v2, v4, v6).
  3. Special / Non-standard register forms left explicitly undecoded:

    • As suggested, the 10 special forms requiring custom multi-dword ranges, lane selectors, or parameter interpolation syntax have been left explicitly undecoded (v_vop3_<op>):
      • 0x172 (v_qsad_pk_u16_u8), 0x173 (v_mqsad_pk_u16_u8), 0x175 (v_mqsad_u32_u8) (multi-dword quads)
      • 0x342 (v_interp_p1ll_f16), 0x343 (v_interp_p1lv_f16), 0x35a (v_interp_p2_f16) (attr/high fields)
      • 0x360 (v_readlane_b32), 0x361 (v_writelane_b32), 0x377 (v_permlane16_b32), 0x378 (v_permlanex16_b32) (scalar destination & lane selectors)
    • They continue to consume the proper 8 (or 12) byte instruction width, guaranteeing that stream alignment is preserved without emitting incorrect register operand syntax.
  4. Independent checks & stream tests:

    • Added all flagged test cases (000080d502091a04, 0000abd502091a04, 0000afd502091a04, 0000b1d502091a04, 0000b4d502091a04, 0000b9d502091a04, 0000bad502091a04, 0000bbd502091a04, 000040d502091a04, 000050d502091a04, 010028d502060000) to test_golden_vectors.
    • Updated test_vop3_operand_widths_and_stream_alignment to verify mixed-width forms, 0-source VOP3 v_nop, 3-source v_mullit_f32, and explicitly undecoded 8-byte instructions followed by s_endpgm.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7081397180 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/576#issuecomment-7081397180). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-22T15:33:38Z. --- Updated in 8b9e629 to resolve all 23 discrepancies flagged by the LLVM 23.1.4 (gfx1013) differential sweep: 1. **VOP1-in-VOP3 slot fixes**: - `0x180`: `v_nop` in VOP3 now correctly formats as `v_nop` without operands (arity 0). - Fixed swapped/mismapped slots in `VOP1_OPS`: - `0x2b` (`0x1ab`): `v_rcp_iflag_f32_e64 v0, v2` - `0x2f` (`0x1af`): `v_rcp_f64_e64 v[0:1], v[2:3]` - `0x31` (`0x1b1`): `v_rsq_f64_e64 v[0:1], v[2:3]` - `0x34` (`0x1b4`): `v_sqrt_f64_e64 v[0:1], v[2:3]` - `0x39` (`0x1b9`): `v_ffbh_u32_e64 v0, v2` - `0x3a` (`0x1ba`): `v_ffbl_b32_e64 v0, v2` - `0x3b` (`0x1bb`): `v_ffbh_i32_e64 v0, v2` 2. **VOP3A / VOP3B opcode mnemonics & arities**: - `0x128, 0x129, 0x12a`: Kept the `_e64` suffix (`v_add_co_ci_u32_e64`, `v_sub_co_ci_u32_e64`, `v_subrev_co_ci_u32_e64`). - `0x140`: Corrected mnemonic from `v_fma_legacy_f32` to `v_mad_legacy_f32`. - `0x150`: `v_mullit_f32` now takes 3 sources (`v0, v2, v4, v6`). 3. **Special / Non-standard register forms left explicitly undecoded**: - As suggested, the 10 special forms requiring custom multi-dword ranges, lane selectors, or parameter interpolation syntax have been left explicitly undecoded (`v_vop3_<op>`): - `0x172 (v_qsad_pk_u16_u8)`, `0x173 (v_mqsad_pk_u16_u8)`, `0x175 (v_mqsad_u32_u8)` (multi-dword quads) - `0x342 (v_interp_p1ll_f16)`, `0x343 (v_interp_p1lv_f16)`, `0x35a (v_interp_p2_f16)` (attr/high fields) - `0x360 (v_readlane_b32)`, `0x361 (v_writelane_b32)`, `0x377 (v_permlane16_b32)`, `0x378 (v_permlanex16_b32)` (scalar destination & lane selectors) - They continue to consume the proper 8 (or 12) byte instruction width, guaranteeing that stream alignment is preserved without emitting incorrect register operand syntax. 4. **Independent checks & stream tests**: - Added all flagged test cases (`000080d502091a04`, `0000abd502091a04`, `0000afd502091a04`, `0000b1d502091a04`, `0000b4d502091a04`, `0000b9d502091a04`, `0000bad502091a04`, `0000bbd502091a04`, `000040d502091a04`, `000050d502091a04`, `010028d502060000`) to `test_golden_vectors`. - Updated `test_vop3_operand_widths_and_stream_alignment` to verify mixed-width forms, 0-source VOP3 `v_nop`, 3-source `v_mullit_f32`, and explicitly undecoded 8-byte instructions followed by `s_endpgm`.
Holastor commented 2026-11-24 06:48:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-22T18:15:02Z.


@R0Y00 Rebased onto main (commit 5fc014d), cleanly resolving the merge conflicts with #579 and #580

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7083458706 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/576#issuecomment-7083458706). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-22T18:15:02Z. --- @R0Y00 Rebased onto `main` (commit `5fc014d`), cleanly resolving the merge conflicts with #579 and #580
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
R0Y00/Xbox2Windows!570
No description provided.