[Mips] Share the address of a global between repeated accesses on the R3000A (PS2-184) #9
Loading…
Reference in a new issue
No description provided.
Delete branch "r3000a-shared-global-base"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on #8 (the diff against
r5900-eeincludes its commit until #8 merges).IRX1 pairs every
%hiwith the%lothat follows it, so-mips-split-hi16gives each access to a global its ownlui. GCC builds the address once and reaches the members through register + offset. For code that touches a global's members many times that is two instructions per access against one.A new
shared-global-basesubtarget feature, implied byr3000aonly, makes the split pass share the address when alui %hi(sym)feeds three or more plain%lo(sym+offset)users of the same global: onelui+addiu %lo(sym)(an adjacent HI16/LO16 pair that IRX1 accepts) andoff($base)for every user. Two accesses cost the same either way and keep their ownlui. Other CPUs are unchanged unless they request the feature. Test:CodeGen/Mips/r3000a-shared-global-base.ll.Results (RiptOPL, all 47 IOP targets at
-Oz; GCC at-Os): the 46 IRX files total 728,222 -> 684,894 bytes (-5.9%), GCC 650,850, so +11.9% -> +5.2% over GCC. At the default-Osthe sdk-core audsrv IRX goes 21,271 -> 20,455 bytes.riptopl.elf4,614,324 -> 4,579,624; packed 1,697,456 -> 1,689,488.Tested
iopfixup --irx1.-Osand-Oz, and audsrv.🤖 Generated with Claude Code