mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-10-04 16:28:11 -04:00
1.1 KiB
1.1 KiB
§360 — THE "COMPILER FOUND A SHORTER EQUIVALENT THAN THE TARGET" PAIR (P31 S68; main/func_800241C0, 68 ins, 68 → 19)
Use when the TARGET is longer than your draft and its extra instructions look redundant: gcc found a shorter equivalent and you must spell the source so it cannot.
$0opaque-copy — writex + zrwithregister s32 zr __asm__("$0")to force a realaddu $vN,$aN,$zerowhere gcc would fuse the copy into the next instruction. It also splits ani = arg2into the target's two-step instead of gcc's one-instructionaddiufusion.- Hoist the narrowing cast to its own statement —
srem = (s16)rem;standalone, pinned to the same register as a non-overlapping-lifetime neighbour, reproduces the target's early rem-shift scheduling.
⚠ A third lever was tried here and is REFUTED — see §361. Duplicating i = i - 1; into both
if/else arms to bait cross_jump appeared to work (it is part of how 68 → 19 was reached) and was
in fact the cause of the residual that remained. It is recorded here only so nobody re-derives it.