match(iqdec_b65): port sibling semantics for decode_iquant (30→13 reg) #955

Merged
coah80 merged 1 commits from agent/grok/decomp-worker-1/iqdec_b65 into main 2026-10-02 21:02:46 +00:00
coah80 commented 2026-10-02 21:02:12 +00:00 (Migrated from github.com)

Summary

Port decode_iquant_rc-style semantics into TMCJPEGDEC_decode_iquant (libs/RVLMiddleware/TMC_JPEG/src/b65/iqdec_b65_frv32.c):

  • u16* huffman table indexing in decodeLongHuffman / decodeACHuffman
  • comma-op load_buff
  • early (s32*)conv_row
  • 1UL << / parenthesized extra -= (tmp - 1) forms

Score: 276/276, 30 → 13 reg-only (structural 0). Single-function unit; no other funcs to regress.

Remaining wall

AC callee-saved permutation (insns 115+):

ours target
huff_tbl r29 r25
huff_sym r30 r24
zztbl r24 r29
zz r25 r30

≥28 coloring levers (scoped DC/AC huff, declsearch×80, zz type/live-range, sibling decl order, coalesce via dc_fast, etc.) could not break this without regenerating the already-identical DC body (0–114). Notes in tools/decomp-assist/attempts/iqdec-b65-worker1.md.

Test plan

  • ninja build of iqdec_b65_frv32.o
  • ctxdiff/odiff: 276/276, 13 reg diffs
  • Unit contains only this function
  • CI objdiff / DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d
## Summary Port `decode_iquant_rc`-style semantics into `TMCJPEGDEC_decode_iquant` (`libs/RVLMiddleware/TMC_JPEG/src/b65/iqdec_b65_frv32.c`): - `u16*` huffman table indexing in `decodeLongHuffman` / `decodeACHuffman` - comma-op `load_buff` - early `(s32*)conv_row` - `1UL <<` / parenthesized `extra -= (tmp - 1)` forms **Score:** 276/276, **30 → 13** reg-only (structural 0). Single-function unit; no other funcs to regress. ## Remaining wall AC callee-saved permutation (insns 115+): | | ours | target | |---|---|---| | `huff_tbl` | r29 | r25 | | `huff_sym` | r30 | r24 | | `zztbl` | r24 | r29 | | `zz` | r25 | r30 | ≥28 coloring levers (scoped DC/AC huff, declsearch×80, zz type/live-range, sibling decl order, coalesce via `dc_fast`, etc.) could not break this without regenerating the already-identical DC body (0–114). Notes in `tools/decomp-assist/attempts/iqdec-b65-worker1.md`. ## Test plan - [x] `ninja` build of `iqdec_b65_frv32.o` - [x] ctxdiff/odiff: 276/276, 13 reg diffs - [x] Unit contains only this function - [ ] CI objdiff / DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`
coah80 commented 2026-10-02 21:02:44 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.