#1598
rdna2spirv: s_movrels_b32 and s_movrels_b64
s_movrels_b32 and s_movrels_b64 raised Unsupported. They are relative SGPR reads through M0 (RDNA2 ISA SOP1): D = SGPR[S0 + M0], and the b64 form reads the pair at S0 + M0 and S0 + M0 + 1. SCC is not written.
Implementation: the SGPR file is already a Function-scope uint array, so this is a dynamic OpAccessChain + OpLoad, the same as v_movrels for VGPRs.
- Every SGPR write goes through
store_reg, which stores into the array, so the load sees the current value. - All reads happen before the destination is written, so D may overlap the source.
- The index wraps to the 128 array slots, so it can't reach the lane-mask parking slots past them. The hardware's range check, and reads past s105 landing on VCC and the other specials, are not modelled. This matches the
v_movrel*row. s_movreld_b32/b64, the relative writes, stayUnsupported. The translator keeps translate-time knowledge of SGPR values (literal S# words insgpr_imm, descriptor caches), and a dynamic write would invalidate it without saying which register changed.- A non-SGPR operand, or a width mismatch, raises
Unsupported.
Tests: tests/semantic/test_salu_movrels.py:
- M0 = 0..5
- a base register other than the seed
- M0 loaded from an SGPR
- the b64 pair
- a destination overlapping the source
- SCC kept, both ways
s_movreld, an immediate source and a width mismatch are rejected
Without the translator change the file fails (14 errors); with it, 6/6 pass. python -I -m unittest discover -s tests/semantic: 1253 tests OK (2 skipped).
docs/design.md: new row after "Relative VGPR moves".
Tested on CPU only (semantic interpreter); no GPU run. No game files.
AI-assisted (Claude Code): I reviewed and ran the change and the tests.