Compare commits
24 Commits
main
...
agent/w101
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43412cda74 | ||
|
|
db7e2411c4 | ||
|
|
eabdccd0e0 | ||
|
|
ff68f0759f | ||
|
|
1e6808e62e | ||
|
|
1d0e71e9d4 | ||
|
|
6ea8f7c565 | ||
|
|
aab5544fd4 | ||
|
|
100e6799e0 | ||
|
|
e31a07dd1b | ||
|
|
db245bc937 | ||
|
|
1bacdf5931 | ||
|
|
89cedd2cdc | ||
|
|
b77e122fe8 | ||
|
|
397d9799e3 | ||
|
|
df8a4192d1 | ||
|
|
2463589a0a | ||
|
|
a9fec2d2a7 | ||
|
|
bf1978a10f | ||
|
|
2e307c9dd3 | ||
|
|
9141e8a67e | ||
|
|
d069e4d02b | ||
|
|
9fd1c9117b | ||
|
|
226d9ef627 |
@@ -10,10 +10,7 @@ static s32 clampU8(s32 value) {
|
||||
if (inRange) {
|
||||
return value;
|
||||
}
|
||||
if (value < 0) {
|
||||
return 0;
|
||||
}
|
||||
return 255;
|
||||
return value < 0 ? 0 : 255;
|
||||
}
|
||||
|
||||
static s32 clampS8(s32 value) {
|
||||
|
||||
@@ -412,18 +412,19 @@ extern "C" char scP_txtScrll_DOWN[] = "P_txtScrll_DOWN";
|
||||
struct ButtonAnimations {
|
||||
KeyType type;
|
||||
const char* paneName;
|
||||
u32 count;
|
||||
u16 _pad_0;
|
||||
u16 count;
|
||||
const char* bindingName;
|
||||
const InputFormAnimationFile* files[12];
|
||||
};
|
||||
|
||||
ButtonAnimations csButtonAnimations[] = {
|
||||
{KT_NormalButton, scP_txtScrll_UP, 8, NULL, {
|
||||
{KT_NormalButton, scP_txtScrll_UP, 0, 8, NULL, {
|
||||
&csAninationFile__Q29textinput9inputform[0], &csAninationFile__Q29textinput9inputform[1],
|
||||
&csAninationFile__Q29textinput9inputform[2], &csAninationFile__Q29textinput9inputform[3],
|
||||
&csAninationFile__Q29textinput9inputform[4], &csAninationFile__Q29textinput9inputform[5],
|
||||
&csAninationFile__Q29textinput9inputform[6], &csAninationFile__Q29textinput9inputform[7]}},
|
||||
{KT_NormalButton, scP_txtScrll_DOWN, 8, csScrollButtonAnimationTarget, {
|
||||
{KT_NormalButton, scP_txtScrll_DOWN, 0, 8, csScrollButtonAnimationTarget, {
|
||||
&csAninationFile__Q29textinput9inputform[0], &csAninationFile__Q29textinput9inputform[1],
|
||||
&csAninationFile__Q29textinput9inputform[2], &csAninationFile__Q29textinput9inputform[3],
|
||||
&csAninationFile__Q29textinput9inputform[4], &csAninationFile__Q29textinput9inputform[5],
|
||||
@@ -1123,21 +1124,21 @@ inline void LayoutByNW4R::addButtonAnimation(MEMAllocator* allocator, nw4rmanage
|
||||
}
|
||||
|
||||
void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
|
||||
Info_* listEnd;
|
||||
const char* bindingName;
|
||||
void* handlerMemory;
|
||||
void* memory;
|
||||
nw4r::lyt::Pane* pane;
|
||||
const char* bindingName;
|
||||
u32 buttonIndex;
|
||||
u16 next;
|
||||
Info_* rows;
|
||||
u16 previous;
|
||||
void* handlerMemory;
|
||||
u32 count;
|
||||
u16 count;
|
||||
u16 animationIndex;
|
||||
Info_* selected;
|
||||
nw4rmanager::AnmPane* animationPane;
|
||||
nw4r::lyt::TextBox* textBox;
|
||||
u16 selectedIndex;
|
||||
u32 buttonIndex;
|
||||
Info_* listEnd;
|
||||
mpAllocator = allocator;
|
||||
textdrawer::Base::create(allocator);
|
||||
mpString = static_cast<tistring::Decolated*>(editBuffer->mpString);
|
||||
|
||||
@@ -198,9 +198,11 @@ void Decolated::inputChar(wchar_t ch) {
|
||||
}
|
||||
nonKana:
|
||||
if (mTranslateMode == 3) {
|
||||
CharacterOutput output(input);
|
||||
output.append(ch);
|
||||
count = output.finish();
|
||||
count = mTranslateMode - 3;
|
||||
input[count] = 0;
|
||||
input[count] = ch;
|
||||
count++;
|
||||
input[count] = 0;
|
||||
mKanaStream.mOutput[0] = 0;
|
||||
} else {
|
||||
count = 1;
|
||||
|
||||
@@ -403,8 +403,8 @@ static inline void sendValidityResponse(u32 command, u32 valid) {
|
||||
u32 value;
|
||||
struct { u32 upper : 16; u32 valid : 8; u32 command : 8; } fields;
|
||||
} reply;
|
||||
reply.value = valid << 8;
|
||||
reply.fields.command = command;
|
||||
reply.value = command;
|
||||
reply.fields.valid = valid;
|
||||
OSSendMessage(&sThread->responses, (OSMessage)reply.value, OS_MESSAGE_BLOCK);
|
||||
}
|
||||
|
||||
@@ -874,6 +874,8 @@ animationDone:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
u32* iconOffsets = &sThread->icons[slot][fileNo].iconOffset[0];
|
||||
s32 nextIcon = iconCount + 1;
|
||||
if (iconCount < 7) {
|
||||
sThread->icons[slot][fileNo].iconOffset[(u32)(iconCount + 1)] =
|
||||
paletteSize + sThread->icons[slot][fileNo].iconOffset[iconCount];
|
||||
|
||||
@@ -222,3 +222,117 @@ The final diff retains three exact command functions and the palette destination
|
||||
correction and shared loop continuation. All remaining functions have at least
|
||||
three new distinct attempts.
|
||||
Shared headers and configure.py are unchanged. All data sections remain exact.
|
||||
|
||||
## w1011/struct2 probes
|
||||
- cardThreadMain (301v301): pure reg-perms + one merge-order tie — base `mr r4,r19; rlwimi r4,r25,8` vs mine `rlwimi r23,r29,8; mr r4,r23`. Same count, ordering only.
|
||||
- loadCardFileIcons (508v512, -4): base emits per-path `li r?,0; stb` zero-init pairs (dead zero-webs on each switch-case path — `bannerEnable=0` etc. re-materialize the zero instead of sharing), plus split `addis/addi` addr materialization + `lbz -1(r); stb 0(r)` adjacent-field copy where mine fuses. Structural decode incomplete.
|
||||
- runCardMoveOrCopy (608v608?): not yet diffed.
|
||||
|
||||
## w1011/struct2 wave 2 (loadCardFileIcons 508->511/512)
|
||||
- WIN: `s32 icon = 0` decl-init materializes a missing zero-web (+1).
|
||||
- WIN: `u32* iconOffsets = &...iconOffset[0]` + `s32 nextIcon = iconCount + 1` → base's `slwi r,2; lwzx`/`stwx` indexed addressing (+2). Direct member index `iconOffset[iconCount+1]` folds to immediate-offset lwz/stw.
|
||||
- Tried/reverted: `(u16)` index cast (513), `iconFmt[iconCount]=iconFmt[iconCount-1]` direct (510), u16* iconOffsets.
|
||||
- Residual -1 + ~92 reg/order diffs: base materializes `&iconFmt[iconCount]` in one reg with `lbz -1(r); stb 0(r)` where every source form folds to `lbz -0x6fb5/stb -0x6fb4` field offsets (remat-vs-pin family).
|
||||
|
||||
## loadCardFileIcons residual -1 insn + coloring
|
||||
- runCardMoveOrCopy (608v608): normalized-identical, pure coloring tie.
|
||||
- loadCardFileIcons -1 = pinned-result phi: mine emits `mr r24,r3` (callee-pinned result web) after CARDGetSectorSize, base keeps result in r3-arrival and remats `li r3,0` in the error path. Same phi-coalescing tie family as attach_mount (pfrest) — no source lever found.
|
||||
|
||||
## w1011/struct2 wave-2 — web-birth decode (loadCardFileIcons SOLVED -1)
|
||||
|
||||
- `s32 iconCount; ... iconCount = 0;` — UNINIT DECL + SEPARATE ASSIGN
|
||||
splits the zero web's birth so MWCC rematerializes a second `li 0` for
|
||||
the icon-init stores (base's exact remat pattern). Applied in BOTH
|
||||
updateCardIconAnimation and loadCardFileIcons: 511 -> 512 insns,
|
||||
residual now 26 pure callee-renaming diffs (r31/r26 sThread,
|
||||
r7/r4+r10/r6 record ptrs — coloring family).
|
||||
NB: `static s32 iconCount` also produced 512 but emits dead object
|
||||
`iconCount$16368` (forbidden, PR #973) — the lever is web-birth
|
||||
timing, not storage class. Static variant rejected.
|
||||
- cardThreadMain sendValidityResponse: `reply.value = command;
|
||||
reply.fields.valid = valid;` produces base's `mr` + `rlwimi @0xFF00`
|
||||
byte-insert order (vs `reply.value = valid<<8; fields.command=command`
|
||||
which folds to `li 0x100 + rlwimi`). Residual 2 lines: in-place
|
||||
`rlwimi r19` vs base `mr r4,r19; rlwimi r4` — same coalescer
|
||||
dst-operand wall as the or-chain. `|=` folds to ori; bitfield-order
|
||||
emits 2 rlwimi + stw.
|
||||
|
||||
## w1011/struct2 wave-3 — structural probes (icon-record intermediates)
|
||||
|
||||
- `IconState* rec = &sThread->icons[slot][fileNo]` + member accesses:
|
||||
collapses fn to 408 insns — MWCC pins the pointer, kills the
|
||||
per-use rematted add chains. The sThread->icons[slot][fileNo]
|
||||
spelled-out form is load-bearing for the remat structure.
|
||||
- `IconState (*icons)[CARD_MAX_FILE] = sThread->icons` array pointer:
|
||||
collapses to 424 for the same reason. Named intermediates can't
|
||||
reproduce base's pinned-products + remat-adds split.
|
||||
- The 26 residual diffs are a pure callee-window swap: base pins the
|
||||
icon-record PRODUCTS (slot*0x1FC0->r29, fileNo<<6->r30, masked addr
|
||||
->r31) and params->r24-r26; mine pins params high. Chaitin color
|
||||
ordering — documented tie.
|
||||
- cardThreadMain: `OSMessage msg` arg-coalescing local, packed
|
||||
`command | (valid<<8)` single expr (folds, 300), mask+or
|
||||
`(v & ~0xFF00)|(valid<<8)` (rlwinm+ori split) — the mr+rlwimi
|
||||
copy-vs-inplace residual (2 lines) is the coalescer dst-operand wall.
|
||||
|
||||
## w1011/struct2 wave-4 — mr+rlwimi mechanism PROVEN, no free source form
|
||||
|
||||
- `sThread->lastCommand = command;` after sendValidityResponse makes
|
||||
command's web survive the pack → emits base's EXACT `mr r4,r19;
|
||||
rlwimi r4,r25,8` (copy+insert, not in-place). Mechanism confirmed:
|
||||
the rlwimi dst binds to a surviving operand's copy — but the store
|
||||
costs +3 insns and base has no such store. Verified base's r19 dies
|
||||
at the same point (reborn at 0xd58 case-0 reassign).
|
||||
- `command & 0xFF` extract: folds (command provably masked) → in-place.
|
||||
- `command | (valid<<8)`: single-expr fold to li/ori (300, -1).
|
||||
- `(reply.value & ~0xFF00)|(valid<<8)`: rlwinm+ori split.
|
||||
- Residual 2 lines = coalescer dst-operand choice with no source
|
||||
lever that preserves insn count.
|
||||
|
||||
## w1011/struct2 wave-5 (post-rebase 10146c1b) — aoss/chansvm levers exhausted
|
||||
|
||||
- mr-cross-block mechanism (o2-aoss): copy survives iff its uses are in
|
||||
other blocks. Verified base CFG: send block (0xd30) reached only from
|
||||
case-10; `command` (r19) dies there, reborn in case-0 block at 0xd58.
|
||||
No other case reads command → no legitimate later-block use exists;
|
||||
all survival variants add insns. ~28 cumulative forms; wall stands.
|
||||
- declsearch.py: 120 decl-orderings of cardThreadMain's decl block —
|
||||
no improvement ((2,3) floor); operand-dst selection unaffected by
|
||||
vreg numbering.
|
||||
- New levers tried: __rlwinm identity (folds), int-union-member,
|
||||
pointer-param pack helper, packValidity return-value, u8 params,
|
||||
separate `response` temp, second reply.value use (+stw). All fold.
|
||||
|
||||
## cardThreadMain sendValidityResponse pack (wave-6)
|
||||
|
||||
Base: `mr r4,r19; rlwimi r4,r25,8,0x10,0x17` = `reply.value = command`
|
||||
(copy into reply's own web, homed in arg-reg r4) then `reply.fields.valid =
|
||||
valid` (bitfield-insert sourcing validState's own `li r25,1` web).
|
||||
Ours: `rlwimi r19,r29,8,0x10,0x17; mr r4,r19` — MWCC coalesced reply.value
|
||||
onto command's web (in-place insert on r19, sourced shared-1 r29) then copies
|
||||
out. 2-line residual, same dst-operand/home-choice family as the or-chain
|
||||
wall. Tried: `OSMessage reply = command | (valid<<8)` (folds to `ori` —
|
||||
plain `|` canonicalizes, only bitfield-write emits rlwimi), fields-only
|
||||
writes (3-insert chain), fn-scope reply union (still coalesces), comma/select
|
||||
forms. `sThread->lastCommand = command` post-send DOES force `mr`+`rlwimi`
|
||||
(making command's web survive) but costs +3 insns — mechanism proven, no
|
||||
free source lever. Extra base `li r22,0` at 0x1040 = another remat-position
|
||||
diff, same family.
|
||||
|
||||
## w1011/struct2 wave-7 — optimization_level pragma sweep (negative)
|
||||
|
||||
Per-fn `#pragma push` + `#pragma optimization_level N` + `#pragma pop`
|
||||
(g-idct lever: Lumi was O3 inside an O4 unit) swept on cardThreadMain:
|
||||
O1/O2/O3 all emit the identical 302-insn object — `rlwimi r19,r29` in-place
|
||||
+ `mr r4,r19`. The coalescer's dst-operand fold is opt-level-invariant;
|
||||
orig was built at the same -O4,p as ours. Mixed-opt is NOT the explanation
|
||||
for the 2-line residual.
|
||||
|
||||
- wave-8 (opt_propagation): `#pragma opt_propagation off` scoped to
|
||||
sendValidityResponse emitted `rlwimi r19,r29; mr` (same shape, operand
|
||||
web shifted); scoped to cardThreadMain `rlwimi r19,r25; mr` (valid-web
|
||||
operand now matches base) — but the union web still ALIASES to command's
|
||||
dying web, so the insert stays in-place and the mr lands after. The
|
||||
pragma does not touch union-storage aliasing (not copy-prop).
|
||||
- Plain-u32 probe (`u32 reply = command; reply |= valid << 8`): folds to
|
||||
`ori`, 300v301 — worse. Union form remains best (301v301, 2-line wall).
|
||||
|
||||
8
tools/decomp-assist/pdm_partition.attempts.md
Normal file
8
tools/decomp-assist/pdm_partition.attempts.md
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
## w1011/struct2 wave-2 verification
|
||||
|
||||
- is_master_boot_sector residual re-decoded: both objects emit the SAME
|
||||
add tree ((b0 + b2<<16) + (b1<<8 + b3<<24)) for read_partition_u32 —
|
||||
the + macro form is correct. All 7 residual lines are the load/shift
|
||||
INTERLEAVE order (base loads b3,b2,b0 then shifts; mine b3,b2,b1).
|
||||
Pure scheduler tie — scheduling pragmas previously probed, no lever.
|
||||
@@ -39,3 +39,19 @@ Measured trials:
|
||||
- static initializer attempt 1: src 0x64 base 0x64 insns 25/25; diffs 0: []
|
||||
- static initializer attempt 2: src 0x64 base 0x64 insns 25/25; diffs 22: [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
|
||||
- static initializer attempt 3: src 0x64 base 0x64 insns 25/25; diffs 0: []
|
||||
|
||||
## w1011/struct2 continuation (createAnmPane_)
|
||||
- WIN: `const PaneToAnimation* p = &scCandidatePaneData.panes[i]` (pointer, not ref) → 215v216→216v216, fuzzy 92.89→98.91. Base reloads `p->pAnims[j]` through the array slot (lwz 0x20(r23)) per use; ref-form folded the element into a pinned reg.
|
||||
- Regressions reverted: forceAddName moved into loop scope (118 ops), u32 j (86), int i (236), inline p->pAnims[j] at both uses (220), uninit-decl forms.
|
||||
- Residual ~77 reg-name ops = pure coloring: base homes `p+j*4` slot web in r23, panes-base in r24, zero-web in r26; mine r30/r23/r25. Birth-order levers exhausted.
|
||||
- `create` (352v352): insn-identical modulo branch targets; only `lfs f0,0(x)` anonymous .rodata ref offset differs (ties to .data granularity: mine names scPaneNameTable/scW_*/scN_* strings, base emits @9934-@9943 anonymous locals + base lacks mine's `__vt__textinput::gui::GUIComponent` weak emission; scCandidatePaneData 1676 vs 1664B).
|
||||
- `CalcPaneLocate_` (435v435): byte-identical modulo relocs.
|
||||
- loadCardFileIcons (iplCardSequence): 508v512 (-4): base emits extra `li r?,0; stb` zero-init pairs (per-path dead zero-webs) + separate addis/addi addr materialization where mine fuses; untreated structural gap.
|
||||
|
||||
## struct2 wave — structural decode probe
|
||||
|
||||
- `const AnimationFile* animation` (pointer) vs `const&` reference: 50->45
|
||||
diff lines — pointer form closer (matches the p->pAnims[j] slot reload
|
||||
idiom used for p itself). Committed.
|
||||
- Hoisted `const AnimationFile* const* anims = p->pAnims` — no change (45).
|
||||
- Remaining residual = callee-web coloring (same tie family).
|
||||
|
||||
@@ -490,3 +490,77 @@ forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
## w1011/struct2 probes (drawCursor/calcCursorPos)
|
||||
- calcCursorPos (326 insns): already byte-identical modulo branch targets — report fuzzy 91.59 was reloc-scoring, no real residual.
|
||||
- drawCursor (70v70): eval-order tie. Base completes `opacity = f32(muGlobalAlpha)/255.0f` fsubs+fdivs BEFORE loading GXColor R/G/B bytes; mine hoists the lbz loads above the fdivs. Moving `GXColor color` decl later regressed 68v70 (splits the loads differently). Kept baseline form; documented sched-order tie.
|
||||
|
||||
## struct2 wave 3 — extern "C" const architecture decoded
|
||||
|
||||
MWCC const-fold vs SDA rule for `extern "C" const` objects:
|
||||
- Source ref folds to anonymous @NNNN pool object when the DEF (with init) is
|
||||
VISIBLE at the use. Ref emits named SDA only when use sees extern decl and
|
||||
def is later (defs at EOF + decls up top) => all value-uses named.
|
||||
- Generated conversion magics (u32/s32->f32/f64) dedup into same-valued named
|
||||
objects INCONSISTENTLY (autoScroll signed conv deduped to
|
||||
scInputFormF32ConvertMagic; init + drawCursor unsigned convs did NOT) —
|
||||
appears tied to .sdata2 emission order (anon pools emit in fn order; defs
|
||||
at EOF emit last). Unresolved: how orig got every generated magic named.
|
||||
- .sdata2 layout = emission order = DEF ORDER when defs precede fns.
|
||||
Base order: ZeroF,640F,F32ConvertMagic(8B),OneF,HalfF,DegToFIdxF,150F,30F,
|
||||
50F,10F,52F,TwoF,140F,90F,253F,20F,ColorR/G/B/A u8s,255F,127F,14592F,
|
||||
[4B pad],F64ConvertMagic(8B),15F,[pad] — copied verbatim to EOF def block.
|
||||
- ALL inline float literals in the file's fn bodies were swapped to named
|
||||
refs (150F/30F/50F/10F/52F/140F/90F/253F/20F/15F/640F/255F/127F/14592F/
|
||||
DegToFIdxF/OneF/HalfF/TwoF/ZeroF + Color*u8). Mass .sdata2 184->124B.
|
||||
- Out-of-namespace uses (fns defined qualified-style at global scope) need
|
||||
textinput::inputform:: qualification (~97 sites).
|
||||
- drawCursor: plain static_cast<f32>(u8/u32) emits the right
|
||||
lis/lbz/stw/stw/lfd/fsubs seq; residual = magic operand @NNNN vs named +
|
||||
eval-order (~11 diff lines). Union-pun form (u32[2]+f64, subtract named
|
||||
magic) gives named operand but fsub+frsp instead of fsubs — WORSE.
|
||||
- autoScroll: orig used `* scInputFormHalfF` not `/ scInputFormTwoF`.
|
||||
- textdrawer::Base() header ctor literals (mfVIWidth 640 etc) — named-const
|
||||
via header gate tried+reverted (orig likely defines ctor in cpp; also
|
||||
regressed sdata2). ctor anon pair {0,640} + GetTextColor {ffffff00,0}
|
||||
remain anonymous.
|
||||
- REMAINING: init @13881 (signed magic dedup didn't fire), ctor pair,
|
||||
GetTextColor pair, drawCursor operand/scheduling, then 'create'.
|
||||
|
||||
Post-rebase states: Base::create(73i) normalized-identical (branch-target
|
||||
artifacts only). LayoutByNW4R::create(357i) residual = callee-web rotation
|
||||
(mine r20/r21/r28 vs base r23/r24/r30) + anonymous 0-operand pools; pure
|
||||
coloring. Unit fuzzy 99.54, data 100.
|
||||
|
||||
## create residual wave (w1011 round 2) — 120 -> 88 normalized diffs
|
||||
|
||||
- `u16` ButtonAnimations::count field + `u16 count` local lands count in base's r22
|
||||
home (late allocator pin). u32/int/s32/short all keep the early pin (~150). Mechanism
|
||||
is likely the u16 narrowing producing a secondary codegen-ordered temp.
|
||||
- Remaining 1 structural diff: `lhz` vs base `lwz` at the count load — orig's web is
|
||||
u32-typed (lwz) yet allocator-late. u32-field+u16-local adds a clrlwi (worse).
|
||||
- declsearch on the 15-local decl block: moving `Info_* selected` up (2nd) and
|
||||
`void* memory` down (11th) fixed 3 renames; converged after 80 evals.
|
||||
- Pointer-param `addButtonAnimations` helper (count load as IRO temp): lands r30
|
||||
(IRO temps number reverse-creation — late inline = LOW temp no. = early pin).
|
||||
`button->count` bound inside helper reloads per-iter (fIsPtrOp, no LICM hoist).
|
||||
- bindingName/count direct member uses, comma decl, split-web `count=0;count=...`,
|
||||
stmt-order swaps on previous/next/selectedIndex: all no-ops or worse.
|
||||
- Residual ~86 renames: mriManager rows/selected/previous/next expression-temp band
|
||||
(r4-r8 volatile order) + residual saved-reg permutations — same tie family.
|
||||
|
||||
- REVERTED: the u16-field form shrinks csButtonAnimations .data bytes (00 08 vs
|
||||
00 00 00 08) — unit matched_data 100 -> 27.5. u32 field + u16 local emits
|
||||
lhz+clrlwi (171). declsearch order alone scored worse under normalized diff
|
||||
(147 vs 150 baseline). Net: create restored to upstream baseline; the
|
||||
u16-numbering mechanism is documented but no usable form found — count's web
|
||||
must be u32-typed AND allocator-late, unproducible so far.
|
||||
|
||||
- SOLVED (partial): count as `u16` field in the LOW half of the u32 slot
|
||||
(`u16 _pad_0; u16 count;` + `0, 8` initializers) — identical .data bytes,
|
||||
u16 web lands at base r22. + declsearch order = 73 normalized diffs.
|
||||
`#pragma opt_propagation off` scoped to create: 176 (regresses).
|
||||
Shared `memory` var across the two allocs: 150 (no-op — single-use defs
|
||||
forward-substitute either way). Residual: rows-copy loop expression-temp
|
||||
orderings (r5-r8 numbering) + callee-home perms (r18/r20 vs r25/r27) —
|
||||
same volatile-temp tie family as before.
|
||||
|
||||
@@ -28,3 +28,53 @@ call result, or a non-foldable form). Dead `cmplwi r4,0xa` matches the documente
|
||||
dead-compare-fossil family (both-branch merge). Also: count lands in r29 via
|
||||
clrlwi (u16) — count is i.
|
||||
Unresolved: what source produces symbolic-index stores + dead compare.
|
||||
# tiString attempts
|
||||
|
||||
## inputChar mode-3 indexed block (upstream main @10146c1b)
|
||||
|
||||
- Base emits `li r6,0; sth r6,0x10; slwi r0,r6,1; addi r5,r1,0x10;
|
||||
sthx r4,r5,r0; addi r6,r6,1; mr r4,r5; li r5,0; slwi r0,r6,1;
|
||||
clrlwi r29,r6; sthx r5,r4,r0; sth r5,0x42` — input[count] INDEXED
|
||||
stores with count a register-born (li+addi) SYMBOLIC web. MWCC folds
|
||||
the FIRST store to immediate offset (count=0 proven) but keeps later
|
||||
stores indexed — index var must be non-const-folded.
|
||||
- Decode: orig's mode-3 path is NOT CharacterOutput (inlines to folded
|
||||
immediates). It's `count=0; input[count]=0; input[count++]=ch;
|
||||
input[count]=0; count` — semantics confirmed; the wall is making
|
||||
count's web symbolic.
|
||||
- ~13 forms: u16/u32/int index locals (all const-propped), struct-with-
|
||||
inline-buffer member index (stays MEMORY: real stw/lwz — too far),
|
||||
CharacterOutput direct + pointer-call (fully promotes + folds),
|
||||
post-inc index (folds). Register-born symbolic web needs phi/call/
|
||||
member-load provenance — none found that emits base's li-born shape.
|
||||
|
||||
## inputChar mode-3 wave-2 (fuzzy 90.8 -> 94.34, still <100)
|
||||
|
||||
PROVEN mechanism — the symbolic index web: base's `slwi r0,r6,1` reads a web
|
||||
with NO definition instruction anywhere in the function. An UNINITIALIZED local
|
||||
(`s32 idx;`) produces exactly that shape: MWCC emits indexed `slwi`+`sthx`
|
||||
reading the undef web's assigned register — the #1270 retail-uninit-read
|
||||
exception applies (the `li r6,0` writes a DIFFERENT web — the store operand).
|
||||
Committed form uses `count = mTranslateMode - 3` instead (fuzzy 94.34, better
|
||||
than undef-idx 92.61 — the undef web homes to r3 and breaks coloring; with
|
||||
`u32 inputIndex` shared with the kana loop it pins r28 = worse). Undef-idx
|
||||
variants give the most faithful structure: `sth`-first-store + indexed sthx +
|
||||
`clrlwi r29,idx-web,0x10` tail all match; only reg home (r3 vs r6) and
|
||||
in-place `addi r6,r6,1` vs new-web `addi r5,r3,1` differ.
|
||||
|
||||
Wall boundary (~30 forms): `li`-born + symbolic is unproduced —
|
||||
`x-x`, `x&0`, `ch-ch`, `input-input`, `x*0`, comma-exprs, `?:`, empty-ifs,
|
||||
phi arms all either fold to `cmpwi`-path or emit real insns (addi/subf/xori).
|
||||
Dead `cmplwi r4,0xa` unproduced (comma/`||`/empty-if all drop it). `mr r4,r5`
|
||||
ptr copy + `li r5,0` zero web = same coalescer home-choice family as
|
||||
cardThreadMain. BEST KEPT: `count = mTranslateMode - 3; input[count] = 0;
|
||||
input[count] = ch; count++; input[count] = 0;` with `u16 count` (94.34).
|
||||
|
||||
## wave-3 — optimization_level pragma sweep (negative)
|
||||
|
||||
Per-fn `#pragma optimization_level 2|3` and whole-unit `-O2,p` probed on
|
||||
inputChar (g-idct lever): per-fn O2 → 134 insns, O3 → 133 (base 137);
|
||||
unit-level O2 → 133 insns / 91 opcode diffs (vs 57 at O4). Lower opt
|
||||
emits the same symbolic-index structure, just worse — orig is -O4,p.
|
||||
The undef-web birth (`slwi r0,r6,1` on a def-less web) is not an
|
||||
opt-level artifact.
|
||||
|
||||
@@ -644,3 +644,46 @@ forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
## struct2 wave — idct_block_var (buffer/)
|
||||
|
||||
- IRO probe (directive): ppc_iro_level 0/1/2 all REGRESS Lumi (IRO-0 emits
|
||||
branchy clamp tails — +29 insns 286v257). Reverted. This fn needs the
|
||||
DEFAULT level: its residual was fold-canonicalization, not over-folding.
|
||||
- clampU8 tail: `if (v<0) return 0; return 255;` (2 stmts) emits branchy
|
||||
cmpwi/bge/li/b/li; single `return v<0?0:255;` emits base's mask fold
|
||||
(srawi .1f + andc 0xff). Single-ternary decode: Lumi 258->257 (exact),
|
||||
_Col 455->454 (exact). Both insn counts now match.
|
||||
- Residual: or-chain operand order `or ACC,ACC,NEW` vs base `or ACC,NEW,ACC`
|
||||
— coalescer canonicalizes operand order regardless of source order
|
||||
(reversed `x | acBits` tried, unchanged) — allocator-side coalescing
|
||||
choice, not source-reachable (same wall as texturecvtr or-chains).
|
||||
Remaining diffs are pure reg-renaming in the IDCT butterfly.
|
||||
|
||||
## Scheduling/opt pragma probes (directive wave)
|
||||
|
||||
- MWCC scheduling pragmas probed per-fn via push/pop on the or-chain /
|
||||
scheduling-interleave / coloring residuals:
|
||||
- idct Lumi: `scheduling off` 38->33 diff lines but 257 insns kept and
|
||||
serializes loads (not closer per-insn); `scheduling 601/602/603` 35;
|
||||
`schedule_twice` 38; `peephole off` 18 lines BUT +23 insns (280v257,
|
||||
breaks rlwinm. fusion) — all net regressions or ties.
|
||||
- pdm is_master_boot_sector: baseline 7; `schedule_twice` 7 (same);
|
||||
`scheduling 601` 16; `scheduling off` 31; `peephole off` 22 — all worse.
|
||||
- cardSequence loadCardFileIcons (-1 phi tie): `scheduling off`,
|
||||
`schedule_twice`, `peephole off` all 511 insns unchanged — pragma does
|
||||
not reach pinned-result phi-coalescing.
|
||||
- tiCandidateBox createAnmPane_: baseline 50; `schedule_twice` 50;
|
||||
`scheduling off` 66; `peephole off` 54 — coloring tie stands.
|
||||
- CONCLUSION: or-operand order (or ACC,NEW,ACC vs ACC,ACC,NEW) is set by
|
||||
the coalescer's dst-operand choice, upstream of the scheduler; phi
|
||||
ties are upstream of both. No MWCC scheduling/peephole pragma reaches
|
||||
these — source-level and pragma levers exhausted on these walls.
|
||||
|
||||
## w1011/struct2 wave-3 — or-chain serial probes
|
||||
|
||||
- `acBits = acBits | x` (explicit self-assign) produces a SERIAL
|
||||
or-chain (was pairs-tree) — but operand order still canonicalizes
|
||||
to `or ACC,ACC,NEW` regardless of textual `x | acBits` vs
|
||||
`acBits | x`. Normalized diff unchanged (25). Committed `|=`
|
||||
kept — identical score, cleaner source.
|
||||
|
||||
Reference in New Issue
Block a user