Grind main/menu_letter: 95.90% -> 95.97% (structural)#17667
Merged
Conversation
…>96.66) Ghidra 8016398c LetterLstBaseDraw shows `if (DOUBLE_803330e8 <= param_1)` compiling to `fcmpo cr0, e8, param; cror eq, lt, eq; bne` (constant kept on the left). Our `param_1 >= DOUBLE_803330e8` canonicalized to a plain `blt` with operands swapped. Writing it as `!(param_1 < DOUBLE_803330e8)` (value- identical) preserves the target's operand order and cror+bne, dropping misalign 6->4 and unit fuzzy 95.90219->95.92841. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
….35) Ghidra 80165554 LetterListDraw line 153 reloads sVar1 from *(short*)(field_0x82c + 0x34) immediately before the attachment-icon loop, rather than reusing the topRow CSE from m_singMenuState->topIndex. Adding a branch-local reload (iconTopRow = *(s16*)(GetLetterStateBase+0x34)) drops misalign 23->21 and unit fuzzy 95.92841->95.97173. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two faithful structural fixes to main/menu_letter, verified against the Ghidra ground truth (resources/ghidra-decomp-1-31-2026).
LetterLstBaseDraw:
!(param_1 < e8)form (96.37% -> 96.66%, misalign 6 -> 4)Ghidra 8016398c shows
if (DOUBLE_803330e8 <= param_1)compiling tofcmpo cr0, e8, param; cror eq, lt, eq; bnewith the constant kept on theleft. Our
param_1 >= DOUBLE_803330e8canonicalized to a plainbltwithoperands swapped. Rewriting as
!(param_1 < DOUBLE_803330e8)(value-identical)preserves the target's operand order and the cror+bne idiom.
LetterListDraw: icon loop reloads topIndex (91.85% -> 92.35%, misalign 23 -> 21)
Ghidra 80165554 line 153 reloads
sVar1from*(short*)(field_0x82c + 0x34)immediately before the attachment-icon loop, rather than reusing the
topRowCSE from
m_singMenuState->topIndex. Added a branch-local reload(
iconTopRow = *(s16*)(GetLetterStateBase+0x34)), matching the original.Result
Unit fuzzy_match_percent 95.90219 -> 95.97173. No function regressed; total
misalign 129 -> 125. Remaining divergences are mwcc-internal dead-ends
(int->double-bias anonymous pool, entries[n++] index-materialize scheduling,
andc-vs-nor+andi instruction selection, cntlzw equality-materialize, prologue
register coloring).
🤖 Generated with Claude Code